XnQueueT.h
Go to the documentation of this file.
#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_
XnListT.h
XnStatus
XnUInt32 XnStatus
Definition XnStatus.h:34
XnListT::XnListT
XnListT()
Definition XnListT.h:231
XnListT< T, TAlloc >::Size
XnUInt32 Size() const
Definition XnListT.h:490
XnListT< T, TAlloc >::AddLast
XnStatus AddLast(T const &value)
Definition XnListT.h:383
XnListT< T, TAlloc >::operator=
XnListT & operator=(const XnListT &other)
Definition XnListT.h:242
XnListT< T, TAlloc >::End
Iterator End()
Definition XnListT.h:281
XnListT< T, TAlloc >::Begin
Iterator Begin()
Definition XnListT.h:265
XnListT< T, TAlloc >::Remove
XnStatus Remove(ConstIterator where)
Definition XnListT.h:426
XnListT< T, TAlloc >::IsEmpty
XnBool IsEmpty() const
Definition XnListT.h:482
XnQueueT::Push
XnStatus Push(T const &value)
Definition XnQueueT.h:37
XnQueueT< T, TAlloc >::Base
XnListT< T, TAlloc > Base
Definition XnQueueT.h:16
XnQueueT::Pop
XnStatus Pop(T &value)
Definition XnQueueT.h:42
XnQueueT::operator=
XnQueueT & operator=(const XnQueueT &other)
Definition XnQueueT.h:25
XnQueueT::XnQueueT
XnQueueT(const XnQueueT &other)
Definition XnQueueT.h:20
XnQueueT::End
Iterator End()
Definition XnListT.h:281
XnQueueT::Begin
Iterator Begin()
Definition XnListT.h:265
XnQueueT::~XnQueueT
~XnQueueT()
Definition XnQueueT.h:32
XnQueueT::Top
T const & Top() const
Definition XnQueueT.h:53
XnQueueT::Top
T & Top()
Definition XnQueueT.h:54
XnQueueT::XnQueueT
XnQueueT()
Definition XnQueueT.h:18