OpenNI 1.5.4
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
XnDerivedCast.h
Go to the documentation of this file.
1
/****************************************************************************
2
* *
3
* OpenNI 1.x Alpha *
4
* Copyright (C) 2011 PrimeSense Ltd. *
5
* *
6
* This file is part of OpenNI. *
7
* *
8
* OpenNI is free software: you can redistribute it and/or modify *
9
* it under the terms of the GNU Lesser General Public License as published *
10
* by the Free Software Foundation, either version 3 of the License, or *
11
* (at your option) any later version. *
12
* *
13
* OpenNI is distributed in the hope that it will be useful, *
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16
* GNU Lesser General Public License for more details. *
17
* *
18
* You should have received a copy of the GNU Lesser General Public License *
19
* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
20
* *
21
****************************************************************************/
22
/****************************************************************************
23
* *
24
* OpenNI 1.1 Alpha *
25
* Copyright (C) 2011 PrimeSense Ltd. *
26
* *
27
* This file is part of OpenNI. *
28
* *
29
* OpenNI is free software: you can redistribute it and/or modify *
30
* it under the terms of the GNU Lesser General Public License as published *
31
* by the Free Software Foundation, either version 3 of the License, or *
32
* (at your option) any later version. *
33
* *
34
* OpenNI is distributed in the hope that it will be useful, *
35
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
36
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
37
* GNU Lesser General Public License for more details. *
38
* *
39
* You should have received a copy of the GNU Lesser General Public License *
40
* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
41
* *
42
****************************************************************************/
\
43
44
#ifndef __XN_DERIVED_CAST_H__
45
#define __XN_DERIVED_CAST_H__
46
47
// derived_cast Acts as dynamic_cast without the need for RTTI. used in platforms that not implement RTTI well like Linux-Arm.
48
template
<
class
T>
49
static
T derived_cast(ModuleProductionNode* pPrdNode);
50
51
#define DERIVED_CAST_IMPL(T, enm) \
52
template<> \
53
T* derived_cast<T*>(ModuleProductionNode* pPrdNode) \
54
{ \
55
return (T*)pPrdNode->m_aInterfaces[enm]; \
56
}
57
58
DERIVED_CAST_IMPL
(ModuleDevice,
XN_NODE_TYPE_DEVICE
)
59
DERIVED_CAST_IMPL
(ModuleRecorder,
XN_NODE_TYPE_RECORDER
)
60
DERIVED_CAST_IMPL
(ModulePlayer,
XN_NODE_TYPE_PLAYER
)
61
DERIVED_CAST_IMPL
(ModuleCodec,
XN_NODE_TYPE_CODEC
)
62
DERIVED_CAST_IMPL
(ModuleScriptNode,
XN_NODE_TYPE_SCRIPT
)
63
DERIVED_CAST_IMPL
(ModuleGenerator,
XN_NODE_TYPE_GENERATOR
)
64
DERIVED_CAST_IMPL
(ModuleUserGenerator,
XN_NODE_TYPE_USER
)
65
DERIVED_CAST_IMPL
(ModuleHandsGenerator,
XN_NODE_TYPE_HANDS
)
66
DERIVED_CAST_IMPL
(ModuleGestureGenerator,
XN_NODE_TYPE_GESTURE
)
67
DERIVED_CAST_IMPL
(ModuleAudioGenerator,
XN_NODE_TYPE_AUDIO
)
68
DERIVED_CAST_IMPL
(ModuleMapGenerator,
XN_NODE_TYPE_MAP_GENERATOR
)
69
DERIVED_CAST_IMPL
(ModuleDepthGenerator,
XN_NODE_TYPE_DEPTH
)
70
DERIVED_CAST_IMPL
(ModuleImageGenerator,
XN_NODE_TYPE_IMAGE
)
71
DERIVED_CAST_IMPL
(ModuleIRGenerator,
XN_NODE_TYPE_IR
)
72
DERIVED_CAST_IMPL
(ModuleSceneAnalyzer,
XN_NODE_TYPE_SCENE
)
73
74
#ifdef dynamic_cast
75
#undef dynamic_cast
76
#endif
77
78
#define dynamic_cast derived_cast
79
80
#endif
Include
XnDerivedCast.h
Generated on Wed Oct 2 2013 01:40:58 for OpenNI 1.5.4 by
1.8.4