OpenNI 1.5.7
XnStatus.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_OPEN_NI_STATUS_H__
00022 #define __XN_OPEN_NI_STATUS_H__
00023 
00024 #include "XnPlatform.h"
00025 
00026 //---------------------------------------------------------------------------
00027 // Types
00028 //---------------------------------------------------------------------------
00029 
00033 typedef XnUInt32 XnStatus;
00034 
00036 #define XN_STATUS_OK ((XnStatus)0)
00037 
00038 //---------------------------------------------------------------------------
00039 // API
00040 //---------------------------------------------------------------------------
00041 
00049 XN_C_API const XnChar* XN_C_DECL xnGetStatusString(const XnStatus Status);
00050 
00058 XN_C_API const XnChar* XN_C_DECL xnGetStatusName(const XnStatus Status);
00059 
00067 XN_C_API void XN_C_DECL xnPrintError(const XnStatus Status, const XnChar* csUserMessage);
00068 
00069 //---------------------------------------------------------------------------
00070 // Enums
00071 //---------------------------------------------------------------------------
00073 typedef enum XnErrorGroup
00074 {
00075     XN_ERROR_GROUP_NI = 1,
00076     XN_ERROR_GROUP_OS = 2,
00077     XN_ERROR_GROUP_PRIMESENSE = 3,
00078 } XnErrorGroup;
00079 
00081 #define XN_STATUS_MAKE(group, code)     ((group << 16) | code)
00082 
00084 #define XN_STATUS_GROUP(status)         XnUInt16(status >> 16)
00085 
00087 #define XN_STATUS_CODE(status)          XnUInt16(status & 0x0000FFFF)
00088 
00090 #define XN_STATUS_MESSAGE_MAP_START_FROM(group, first)      \
00091     enum _##group##first##Errors                            \
00092     {                                                       \
00093         group##first##_OK = XN_STATUS_MAKE(group, first),
00094 
00095 #define XN_STATUS_MESSAGE_MAP_START(group)                  \
00096     XN_STATUS_MESSAGE_MAP_START_FROM(group, 0)
00097 
00099 #define XN_STATUS_MESSAGE(csName, csMessage)    \
00100         csName,
00101 
00103 #define XN_STATUS_MESSAGE_MAP_END_FROM(group, first)    \
00104     };
00105 
00106 #define XN_STATUS_MESSAGE_MAP_END(group)    \
00107     XN_STATUS_MESSAGE_MAP_END_FROM(group, 0)
00108 
00109 #endif // __XN_OPEN_NITE_STATUS_H__