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