summaryrefslogtreecommitdiffstats
path: root/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h')
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h
new file mode 100644
index 00000000..3320d118
--- /dev/null
+++ b/tests/manual/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