diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-26 09:17:09 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-26 09:21:30 +0300 |
commit | 88695159e16bdfb8424de99d482adf332a93740d (patch) | |
tree | bcf4c815b77f80534e9b1edd33bab3f57283647b /tests/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h | |
parent | bb0e49c6bc7e4e650fc84366ff51ee47c8e5c530 (diff) |
Kinect surface added to tests
- theme changing etc. to be added
Change-Id: I26e72757c90b450aeeecf89ffdf39d312f6c2769
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'tests/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h')
-rw-r--r-- | tests/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h b/tests/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h new file mode 100644 index 00000000..3320d118 --- /dev/null +++ b/tests/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h @@ -0,0 +1,63 @@ +#ifndef _XN_QUEUE_T_H_ +#define _XN_QUEUE_T_H_ + +//--------------------------------------------------------------------------- +// Includes +//--------------------------------------------------------------------------- +#include <XnListT.h> + +//--------------------------------------------------------------------------- +// Code +//--------------------------------------------------------------------------- +template<class T, class TAlloc = XnLinkedNodeDefaultAllocatorT<T> > +class XnQueueT : protected XnListT<T, TAlloc> +{ +public: + typedef XnListT<T, TAlloc> Base; + + XnQueueT() : Base() {} + + XnQueueT(const XnQueueT& other) : Base() + { + *this = other; + } + + XnQueueT& operator=(const XnQueueT& other) + { + Base::operator=(other); + // no other members + return *this; + } + + ~XnQueueT() {} + + using Base::ConstIterator; + using Base::IsEmpty; + + XnStatus Push(T const& value) + { + return Base::AddLast(value); + } + + XnStatus Pop(T& value) + { + Iterator it = Begin(); + if (it == End()) + { + return XN_STATUS_IS_EMPTY; + } + value = *it; + return Base::Remove(it); + } + + T const& Top() const { return *Begin(); } + T& Top() { return *Begin(); } + + using Base::Begin; + using Base::End; + using Base::Size; +}; + + + +#endif // _XN_QUEUE_T_H_
\ No newline at end of file |