OpenNI 1.5.7
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Include
XnStack.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* *
3
* OpenNI 1.x Alpha *
4
* Copyright (C) 2012 PrimeSense Ltd. *
5
* *
6
* This file is part of OpenNI. *
7
* *
8
* Licensed under the Apache License, Version 2.0 (the "License"); *
9
* you may not use this file except in compliance with the License. *
10
* You may obtain a copy of the License at *
11
* *
12
* http://www.apache.org/licenses/LICENSE-2.0 *
13
* *
14
* Unless required by applicable law or agreed to in writing, software *
15
* distributed under the License is distributed on an "AS IS" BASIS, *
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17
* See the License for the specific language governing permissions and *
18
* limitations under the License. *
19
* *
20
*****************************************************************************/
21
#ifndef _XN_STACK_H
22
#define _XN_STACK_H
23
24
//---------------------------------------------------------------------------
25
// Includes
26
//---------------------------------------------------------------------------
27
#include "
XnList.h
"
28
29
//---------------------------------------------------------------------------
30
// Types
31
//---------------------------------------------------------------------------
35
class
XnStack
36
{
37
public
:
41
XnStack
() {}
45
~XnStack
() {}
46
54
XnStatus
Push
(
XnValue
const
& value)
55
{
56
return
m_List.
AddFirst
(value);
57
}
58
66
XnStatus
Pop
(
XnValue
& value)
67
{
68
if
(
IsEmpty
())
69
{
70
return
XN_STATUS_IS_EMPTY;
71
}
72
73
value = *(m_List.
begin
());
74
return
m_List.
Remove
(m_List.
begin
());
75
}
76
82
XnValue
const
&
Top
()
const
83
{
84
return
*(m_List.
begin
());
85
}
86
92
XnValue
&
Top
()
93
{
94
return
*(m_List.
begin
());
95
}
96
100
XnBool
IsEmpty
()
const
101
{
102
return
m_List.
IsEmpty
();
103
}
104
108
XnUInt32
Size
()
const
109
{
110
return
m_List.
Size
();
111
}
112
113
private
:
114
XN_DISABLE_COPY_AND_ASSIGN(
XnStack
);
115
117
XnList
m_List;
118
};
119
124
#define XN_DECLARE_STACK_WITH_TRANSLATOR_DECL(decl, Type, ClassName, Translator) \
125
/* Note: we use queue declaration, as this is the same interface. */
\
126
XN_DECLARE_QUEUE_WITH_TRANSLATOR_DECL(decl, Type, ClassName, Translator, XnStack)
127
132
#define XN_DECLARE_STACK_WITH_TRANSLATOR(Type, ClassName, Translator) \
133
XN_DECLARE_STACK_WITH_TRANSLATOR_DECL(, ClassName, Translator)
134
139
#define XN_DECLARE_STACK_DECL(decl, Type, ClassName) \
140
XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, Type, XN_DEFAULT_TRANSLATOR_NAME(ClassName)) \
141
XN_DECLARE_STACK_WITH_TRANSLATOR_DECL(decl, Type, ClassName, XN_DEFAULT_TRANSLATOR_NAME(ClassName))
142
146
#define XN_DECLARE_STACK(Type, ClassName) \
147
XN_DECLARE_STACK_DECL(, Type, ClassName)
148
149
150
#endif // _XN_STACK_H
Generated on Tue Nov 12 2013 13:40:20 for OpenNI 1.5.7 by
1.8.3.1