OpenNI 1.5.7
XnStatusRegister.h
Go to the documentation of this file.
1/*****************************************************************************
2* *
3* OpenNI 1.x Alpha *
4* Copyright (C) 2012 PrimeSense Ltd. *
5* *
6* This file is part of OpenNI. *
7* *
8* Licensed under the Apache License, Version 2.0 (the "License"); *
9* you may not use this file except in compliance with the License. *
10* You may obtain a copy of the License at *
11* *
12* http://www.apache.org/licenses/LICENSE-2.0 *
13* *
14* Unless required by applicable law or agreed to in writing, software *
15* distributed under the License is distributed on an "AS IS" BASIS, *
16* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17* See the License for the specific language governing permissions and *
18* limitations under the License. *
19* *
20*****************************************************************************/
21#ifndef __XN_STATUS_REGISTER_H__
22#define __XN_STATUS_REGISTER_H__
23
24//---------------------------------------------------------------------------
25// Includes
26//---------------------------------------------------------------------------
27#include "XnStatus.h"
28
29//---------------------------------------------------------------------------
30// Structs
31//---------------------------------------------------------------------------
32typedef struct XnErrorCodeData
33{
35 XnUInt32 nCode;
37 const XnChar* csName;
39 const XnChar* csMessage;
41
42//---------------------------------------------------------------------------
43// Exported Function Declaration
44//---------------------------------------------------------------------------
53XN_C_API XnStatus XN_C_DECL xnRegisterErrorCodeMessages(XnUInt16 nGroup, XnUInt16 nFirst, XnUInt16 nCount, XnErrorCodeData* pErrorCodeData);
54
55//---------------------------------------------------------------------------
56// Macros
57//---------------------------------------------------------------------------
58#undef XN_STATUS_MESSAGE_MAP_START_FROM
59#undef XN_STATUS_MESSAGE
60#undef XN_STATUS_MESSAGE_MAP_END_FROM
61
62#define _XN_ERROR_GROUP_NAME(group, first) _s_##group##first##_errors
63
64#define XN_STATUS_MESSAGE_MAP_START_FROM(group, first) \
65 static XnErrorCodeData _XN_ERROR_GROUP_NAME(group, first)[] = \
66 { \
67 { first, XN_STRINGIFY(group) "_OK", XN_STRINGIFY(group) " OK" },
68
70#define XN_STATUS_MESSAGE(csName, csMessage) \
71 { 0, XN_STRINGIFY(csName), csMessage },
72
74#define XN_STATUS_MESSAGE_MAP_END_FROM(group, first) \
75 }; \
76 static XnStatus s_##group##first##_result = xnRegisterErrorCodeMessages(group, first, sizeof(_XN_ERROR_GROUP_NAME(group, first)) / sizeof(XnErrorCodeData), _XN_ERROR_GROUP_NAME(group, first));
77
78#define XN_STATUS_REGISTER
79
80#endif //__XN_STATUS_REGISTER_H__
#define XN_C_API
Definition XnPlatform.h:121
XnUInt32 XnStatus
Definition XnStatus.h:33
struct XnErrorCodeData XnErrorCodeData
XN_C_API XnStatus XN_C_DECL xnRegisterErrorCodeMessages(XnUInt16 nGroup, XnUInt16 nFirst, XnUInt16 nCount, XnErrorCodeData *pErrorCodeData)
Definition XnStatusRegister.h:33
const XnChar * csMessage
Definition XnStatusRegister.h:39
XnUInt32 nCode
Definition XnStatusRegister.h:35
const XnChar * csName
Definition XnStatusRegister.h:37