OpenNI 1.5.4
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Include
XnStackT.h
Go to the documentation of this file.
1
#ifndef _XN_STACK_T_H_
2
#define _XN_STACK_T_H_
3
4
//---------------------------------------------------------------------------
5
// Includes
6
//---------------------------------------------------------------------------
7
#include "
XnListT.h
"
8
9
//---------------------------------------------------------------------------
10
// Code
11
//---------------------------------------------------------------------------
12
template
<
class
T,
class
TAlloc = XnLinkedNodeDefaultAllocatorT<T> >
13
class
XnStackT
:
protected
XnListT
<T, TAlloc>
14
{
15
public
:
16
typedef
XnListT<T, TAlloc>
Base
;
17
18
typedef
typename
Base::ConstIterator
ConstIterator
;
19
20
XnStackT
() :
Base
() {}
21
22
XnStackT
(
const
XnStackT
& other) :
Base
()
23
{
24
*
this
= other;
25
}
26
27
XnStackT
&
operator=
(
const
XnStackT
& other)
28
{
29
Base::operator=
(other);
30
// no other members
31
return
*
this
;
32
}
33
34
~XnStackT
() {}
35
36
XnBool
IsEmpty
()
const
{
return
Base::IsEmpty
(); }
37
38
XnStatus
Push
(T
const
& value) {
return
Base::AddFirst
(value); }
39
40
XnStatus
Pop
(T& value)
41
{
42
ConstIterator
it =
Begin
();
43
if
(it ==
End
())
44
{
45
return
XN_STATUS_IS_EMPTY;
46
}
47
value = *it;
48
return
Base::Remove
(it);
49
}
50
51
T
const
&
Top
()
const
{
return
*
Begin
(); }
52
T&
Top
() {
return
*
Begin
(); }
53
54
ConstIterator
Begin
()
const
{
return
Base::Begin
(); }
55
ConstIterator
End
()
const
{
return
Base::End
(); }
56
};
57
58
#endif // _XN_STACK_T_H_
Generated on Thu Dec 20 2012 21:24:27 for OpenNI 1.5.4 by
1.8.1.2