OpenNI 1.5.7
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Include
XnQueueT.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_QUEUE_T_H_
22
#define _XN_QUEUE_T_H_
23
24
//---------------------------------------------------------------------------
25
// Includes
26
//---------------------------------------------------------------------------
27
#include <
XnListT.h
>
28
29
//---------------------------------------------------------------------------
30
// Code
31
//---------------------------------------------------------------------------
32
template
<
class
T,
class
TAlloc = XnLinkedNodeDefaultAllocatorT<T> >
33
class
XnQueueT
:
protected
XnListT
<T, TAlloc>
34
{
35
public
:
36
typedef
XnListT<T, TAlloc>
Base
;
37
38
XnQueueT
() :
Base
() {}
39
40
XnQueueT
(
const
XnQueueT
& other) :
Base
()
41
{
42
*
this
= other;
43
}
44
45
XnQueueT
&
operator=
(
const
XnQueueT
& other)
46
{
47
Base::operator=
(other);
48
// no other members
49
return
*
this
;
50
}
51
52
~XnQueueT
() {}
53
54
using
Base::ConstIterator;
55
using
Base::IsEmpty
;
56
57
XnStatus
Push
(T
const
& value)
58
{
59
return
Base::AddLast
(value);
60
}
61
62
XnStatus
Pop
(T& value)
63
{
64
Iterator
it =
Begin
();
65
if
(it ==
End
())
66
{
67
return
XN_STATUS_IS_EMPTY;
68
}
69
value = *it;
70
return
Base::Remove
(it);
71
}
72
73
T
const
&
Top
()
const
{
return
*
Begin
(); }
74
T&
Top
() {
return
*
Begin
(); }
75
76
using
Base::Begin
;
77
using
Base::End
;
78
using
Base::Size
;
79
};
80
81
82
83
#endif // _XN_QUEUE_T_H_
Generated on Tue Nov 12 2013 13:40:20 for OpenNI 1.5.7 by
1.8.3.1