OpenNI 1.5.7
XnStatusRegister.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 *                                                                            *
00003 *  OpenNI 1.x Alpha                                                          *
00004 *  Copyright (C) 2012 PrimeSense Ltd.                                        *
00005 *                                                                            *
00006 *  This file is part of OpenNI.                                              *
00007 *                                                                            *
00008 *  Licensed under the Apache License, Version 2.0 (the "License");           *
00009 *  you may not use this file except in compliance with the License.          *
00010 *  You may obtain a copy of the License at                                   *
00011 *                                                                            *
00012 *      http://www.apache.org/licenses/LICENSE-2.0                            *
00013 *                                                                            *
00014 *  Unless required by applicable law or agreed to in writing, software       *
00015 *  distributed under the License is distributed on an "AS IS" BASIS,         *
00016 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
00017 *  See the License for the specific language governing permissions and       *
00018 *  limitations under the License.                                            *
00019 *                                                                            *
00020 *****************************************************************************/
00021 #ifndef __XN_STATUS_REGISTER_H__
00022 #define __XN_STATUS_REGISTER_H__
00023 
00024 //---------------------------------------------------------------------------
00025 // Includes
00026 //---------------------------------------------------------------------------
00027 #include "XnStatus.h"
00028 
00029 //---------------------------------------------------------------------------
00030 // Structs
00031 //---------------------------------------------------------------------------
00032 typedef struct XnErrorCodeData
00033 {
00035     XnUInt32 nCode;
00037     const XnChar* csName;
00039     const XnChar* csMessage;
00040 } XnErrorCodeData;
00041 
00042 //---------------------------------------------------------------------------
00043 // Exported Function Declaration
00044 //---------------------------------------------------------------------------
00053 XN_C_API XnStatus XN_C_DECL xnRegisterErrorCodeMessages(XnUInt16 nGroup, XnUInt16 nFirst, XnUInt16 nCount, XnErrorCodeData* pErrorCodeData);
00054 
00055 //---------------------------------------------------------------------------
00056 // Macros
00057 //---------------------------------------------------------------------------
00058 #undef XN_STATUS_MESSAGE_MAP_START_FROM
00059 #undef XN_STATUS_MESSAGE
00060 #undef XN_STATUS_MESSAGE_MAP_END_FROM
00061 
00062 #define _XN_ERROR_GROUP_NAME(group, first)  _s_##group##first##_errors
00063 
00064 #define XN_STATUS_MESSAGE_MAP_START_FROM(group, first)                  \
00065     static XnErrorCodeData _XN_ERROR_GROUP_NAME(group, first)[] =       \
00066     {                                                                   \
00067         { first, XN_STRINGIFY(group) "_OK", XN_STRINGIFY(group) " OK" },
00068 
00070 #define XN_STATUS_MESSAGE(csName, csMessage)        \
00071         { 0, XN_STRINGIFY(csName), csMessage },
00072 
00074 #define XN_STATUS_MESSAGE_MAP_END_FROM(group, first)    \
00075     };                                                  \
00076     static XnStatus s_##group##first##_result = xnRegisterErrorCodeMessages(group, first, sizeof(_XN_ERROR_GROUP_NAME(group, first)) / sizeof(XnErrorCodeData), _XN_ERROR_GROUP_NAME(group, first));
00077 
00078 #define XN_STATUS_REGISTER
00079 
00080 #endif //__XN_STATUS_REGISTER_H__