OpenNI 1.5.4
XnMacros.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_MACROS_H_
23#define _XN_MACROS_H_
24
25//---------------------------------------------------------------------------
26// Includes
27//---------------------------------------------------------------------------
28#include "XnStatusCodes.h"
29
30//---------------------------------------------------------------------------
31// Macros
32//---------------------------------------------------------------------------
33
35#define XN_SETBITMASK(x) (1 << x-1)
36
38#define XN_RET_IF_NULL(x, y) \
39 if (x == NULL) \
40 { \
41 return (y); \
42 }
43
45#define XN_IS_STATUS_OK_RET(x, y) \
46 if (x != XN_STATUS_OK) \
47 { \
48 return (y); \
49 }
50
52#define XN_IS_STATUS_OK_GOCLEANUP_RET(x, y) \
53 if (x != XN_STATUS_OK) \
54 { \
55 x = y; \
56 goto ErrorCleanUp; \
57 }
58
60#define XN_IS_STATUS_OK(x) \
61 XN_IS_STATUS_OK_RET(x, x)
62
63#define XN_IS_STATUS_OK_ASSERT(x) \
64 if (x != XN_STATUS_OK) \
65 { \
66 XN_ASSERT(FALSE); \
67 return (x); \
68 }
69
70
72#define XN_IS_STATUS_OK_GOCLEANUP(x) \
73 if (x != XN_STATUS_OK) \
74 { \
75 goto ErrorCleanUp; \
76 }
77
79#define XN_IS_BOOL_OK_RET(x, y) \
80 if (x != TRUE) \
81 { \
82 return (y); \
83 }
84
86#define XN_IS_BOOL_OK_GOCLEANUP_RET(x, y) \
87 if (x != TRUE) \
88 { \
89 goto ErrorCleanUp; \
90 }
91
93#define XN_GOCLEANUP_RET(x, y) \
94 x = y; \
95 goto ErrorCleanUp;
96
98#define XN_VALIDATE_PTR(x,y) \
99 if (x == NULL) \
100 { \
101 return (y); \
102 }
103
105#define XN_CHECK_INPUT_OVERFLOW(x, y) \
106 if (x > y) \
107 { \
108 return (XN_STATUS_INPUT_BUFFER_OVERFLOW); \
109 }
110
112#define XN_CHECK_OUTPUT_OVERFLOW(x, y) \
113 if (x > y) \
114 { \
115 return (XN_STATUS_OUTPUT_BUFFER_OVERFLOW); \
116 }
117
119#define XN_DISABLE_COPY_AND_ASSIGN(TypeName) \
120 TypeName(const TypeName&); \
121 void operator=(const TypeName&);
122
125#define XN_REFERENCE_VARIABLE(x) \
126 ((void)x)
127
128#endif //_XN_MACROS_H_