OpenNI 1.5.4
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Include
XnCyclicQueueT.h
Go to the documentation of this file.
1
#ifndef _XN_CYCLIC_QUEUE_T_H_
2
#define _XN_CYCLIC_QUEUE_T_H_
3
4
//---------------------------------------------------------------------------
5
// Includes
6
//---------------------------------------------------------------------------
7
#include "
XnQueueT.h
"
8
9
//---------------------------------------------------------------------------
10
// Code
11
//---------------------------------------------------------------------------
12
13
template
<
class
T, XnUInt32 TDefaultMaxDepth,
class
TAlloc = XnLinkedNodeDefaultAllocatorT<T> >
14
class
XnCyclicQueueT
:
protected
XnQueueT
<T, TAlloc>
15
{
16
public
:
17
typedef
XnQueueT<T, TAlloc>
Base
;
18
19
XnCyclicQueueT
(XnUInt32 nMaxDepth = TDefaultMaxDepth) :
Base
(),
m_nMaxDepth
(nMaxDepth) {}
20
21
XnCyclicQueueT
(
const
XnCyclicQueueT
& other) :
Base
(other)
22
{
23
*
this
= other;
24
}
25
26
XnCyclicQueueT
&
operator=
(
const
XnCyclicQueueT
& other)
27
{
28
Base::operator=
(other);
29
m_nMaxDepth
= other.
m_nMaxDepth
;
30
return
*
this
;
31
}
32
33
~XnCyclicQueueT
() {}
34
35
using
Base::ConstIterator;
36
using
Base::IsEmpty
;
37
using
Base::Size
;
38
39
XnStatus
SetMaxSize
(XnUInt32 nMaxSize)
40
{
41
XnStatus
nRetVal =
XN_STATUS_OK
;
42
43
while
(
Size
() > nMaxSize)
44
{
45
nRetVal =
Remove
(this->
Begin
());
46
XN_IS_STATUS_OK
(nRetVal);
47
}
48
49
m_nMaxDepth
= nMaxSize;
50
51
return
(
XN_STATUS_OK
);
52
}
53
54
XnStatus
Push
(T
const
& value)
55
{
56
XnStatus
nRetVal =
XN_STATUS_OK
;
57
if
(
Size
() ==
m_nMaxDepth
)
58
{
59
nRetVal =
Remove
(this->
Begin
());
60
XN_IS_STATUS_OK
(nRetVal);
61
}
62
63
nRetVal =
Base::Push
(value);
64
XN_IS_STATUS_OK
(nRetVal);
65
66
return
(
XN_STATUS_OK
);
67
}
68
69
using
Base::Pop
;
70
using
Base::Top
;
71
using
Base::Begin
;
72
using
Base::End
;
73
74
protected
:
75
XnUInt32
m_nMaxDepth
;
76
};
77
78
79
#endif // _XN_CYCLIC_QUEUE_T_H_
Generated on Thu Apr 25 2013 22:36:23 for OpenNI 1.5.4 by
1.8.3.1