OpenNI 1.3.2
XnStatus.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * OpenNI 1.1 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_OPEN_NI_STATUS_H__
23 #define __XN_OPEN_NI_STATUS_H__
24 
25 #include "XnPlatform.h"
26 
27 //---------------------------------------------------------------------------
28 // Types
29 //---------------------------------------------------------------------------
30 
34 typedef XnUInt32 XnStatus;
35 
37 #define XN_STATUS_OK ((XnStatus)0)
38 
39 //---------------------------------------------------------------------------
40 // API
41 //---------------------------------------------------------------------------
42 
50 XN_C_API const XnChar* XN_C_DECL xnGetStatusString(const XnStatus Status);
51 
59 XN_C_API const XnChar* XN_C_DECL xnGetStatusName(const XnStatus Status);
60 
68 XN_C_API void XN_C_DECL xnPrintError(const XnStatus Status, const XnChar* csUserMessage);
69 
70 //---------------------------------------------------------------------------
71 // Enums
72 //---------------------------------------------------------------------------
74 typedef enum XnErrorGroup
75 {
79 } XnErrorGroup;
80 
82 #define XN_STATUS_MAKE(group, code) ((group << 16) | code)
83 
85 #define XN_STATUS_GROUP(status) (status >> 16)
86 
88 #define XN_STATUS_CODE(status) (status & 0x0000FFFF)
89 
91 #define XN_STATUS_MESSAGE_MAP_START_FROM(group, first) \
92  enum _##group##first##Errors \
93  { \
94  group##first##_OK = XN_STATUS_MAKE(group, first),
95 
96 #define XN_STATUS_MESSAGE_MAP_START(group) \
97  XN_STATUS_MESSAGE_MAP_START_FROM(group, 0)
98 
100 #define XN_STATUS_MESSAGE(csName, csMessage) \
101  csName,
102 
104 #define XN_STATUS_MESSAGE_MAP_END_FROM(group, first) \
105  };
106 
107 #define XN_STATUS_MESSAGE_MAP_END(group) \
108  XN_STATUS_MESSAGE_MAP_END_FROM(group, 0)
109 
110 #endif // __XN_OPEN_NITE_STATUS_H__