OpenNI 1.5.4
XnDataTypes.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
#ifndef _XN_DATA_TYPES_H_
23
#define _XN_DATA_TYPES_H_
24
25
//---------------------------------------------------------------------------
26
// Includes
27
//---------------------------------------------------------------------------
28
#include "
XnOS.h
"
29
30
//---------------------------------------------------------------------------
31
// Types
32
//---------------------------------------------------------------------------
36
typedef
void
*
XnValue
;
37
42
#define XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, Type, ClassName) \
43
class decl ClassName \
44
{ \
45
public: \
46
XN_PRAGMA_START_DISABLED_WARNING_SECTION(XN_CONDITION_IS_CONST_WARNING_ID) \
47
\
48
static XnValue CreateValueCopy(Type const& orig) \
49
{ \
50
if (sizeof(Type) > sizeof(XnValue)) \
51
{ \
52
Type* pNew = XN_NEW(Type, orig); \
53
return (XnValue)pNew; \
54
} \
55
else \
56
{ \
57
XnValue result = 0; \
58
xnOSMemCopy(&result, &orig, sizeof(Type)); \
59
return result; \
60
} \
61
} \
62
static void FreeValue(XnValue& Value) \
63
{ \
64
if (sizeof(Type) > sizeof(XnValue)) \
65
{ \
66
Type* p = (Type*)Value; \
67
XN_DELETE(p); \
68
} \
69
} \
70
static XnValue GetAsValue(Type const& orig) \
71
{ \
72
if (sizeof(Type) > sizeof(XnValue)) \
73
{ \
74
return (XnValue)&orig; \
75
} \
76
else \
77
{ \
78
XnValue result = 0; \
79
xnOSMemCopy(&result, &orig, sizeof(Type)); \
80
return result; \
81
} \
82
} \
83
static Type const& GetFromValue(const XnValue& Value) \
84
{ \
85
if (sizeof(Type) > sizeof(XnValue)) \
86
{ \
87
Type const* p = (Type const*)Value; \
88
return *p; \
89
} \
90
else \
91
{ \
92
Type const* p = (Type const*)&Value; \
93
return *p; \
94
} \
95
} \
96
static Type& GetFromValue(XnValue& Value) \
97
{ \
98
if (sizeof(Type) > sizeof(XnValue)) \
99
{ \
100
Type* p = (Type*)Value; \
101
return *p; \
102
} \
103
else \
104
{ \
105
Type* p = (Type*)&Value; \
106
return *p; \
107
} \
108
} \
109
XN_PRAGMA_STOP_DISABLED_WARNING_SECTION \
110
};
111
115
#define XN_DECLARE_DEFAULT_VALUE_TRANSLATOR(Type, ClassName) \
116
XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(, Type, ClassName)
117
118
#define XN_DEFAULT_TRANSLATOR_NAME(ClassName) ClassName ## Translator
119
120
#endif // _XN_DATA_TYPES_H_
XnOS.h
XnValue
void * XnValue
Definition:
XnDataTypes.h:36
Include
XnDataTypes.h
Generated on Sat Sep 14 2019 07:20:36 for OpenNI 1.5.4 by
1.8.13