OpenNI 1.5.4
XnStatusRegister.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_STATUS_REGISTER_H__
23 #define __XN_STATUS_REGISTER_H__
24 
25 //---------------------------------------------------------------------------
26 // Includes
27 //---------------------------------------------------------------------------
28 #include "XnStatus.h"
29 
30 //---------------------------------------------------------------------------
31 // Structs
32 //---------------------------------------------------------------------------
33 typedef struct XnErrorCodeData
34 {
36  XnUInt32 nCode;
38  const XnChar* csName;
40  const XnChar* csMessage;
42 
43 //---------------------------------------------------------------------------
44 // Exported Function Declaration
45 //---------------------------------------------------------------------------
54 XN_C_API XnStatus XN_C_DECL xnRegisterErrorCodeMessages(XnUInt16 nGroup, XnUInt16 nFirst, XnUInt16 nCount, XnErrorCodeData* pErrorCodeData);
55 
56 //---------------------------------------------------------------------------
57 // Macros
58 //---------------------------------------------------------------------------
59 #undef XN_STATUS_MESSAGE_MAP_START_FROM
60 #undef XN_STATUS_MESSAGE
61 #undef XN_STATUS_MESSAGE_MAP_END_FROM
62 
63 #define _XN_ERROR_GROUP_NAME(group, first) _s_##group##first##_errors
64 
65 #define XN_STATUS_MESSAGE_MAP_START_FROM(group, first) \
66  static XnErrorCodeData _XN_ERROR_GROUP_NAME(group, first)[] = \
67  { \
68  { first, XN_STRINGIFY(group) "_OK", XN_STRINGIFY(group) " OK" },
69 
71 #define XN_STATUS_MESSAGE(csName, csMessage) \
72  { 0, XN_STRINGIFY(csName), csMessage },
73 
75 #define XN_STATUS_MESSAGE_MAP_END_FROM(group, first) \
76  }; \
77  static XnStatus s_##group##first##_result = xnRegisterErrorCodeMessages(group, first, sizeof(_XN_ERROR_GROUP_NAME(group, first)) / sizeof(XnErrorCodeData), _XN_ERROR_GROUP_NAME(group, first));
78 
79 #define XN_STATUS_REGISTER
80 
81 #endif //__XN_STATUS_REGISTER_H__