OpenNI 1.5.4
|
XnMacros.h
Go to the documentation of this file.
00001 /**************************************************************************** 00002 * * 00003 * OpenNI 1.x Alpha * 00004 * Copyright (C) 2011 PrimeSense Ltd. * 00005 * * 00006 * This file is part of OpenNI. * 00007 * * 00008 * OpenNI is free software: you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published * 00010 * by the Free Software Foundation, either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * OpenNI is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with OpenNI. If not, see <http://www.gnu.org/licenses/>. * 00020 * * 00021 ****************************************************************************/ 00022 #ifndef _XN_MACROS_H_ 00023 #define _XN_MACROS_H_ 00024 00025 //--------------------------------------------------------------------------- 00026 // Includes 00027 //--------------------------------------------------------------------------- 00028 #include "XnStatusCodes.h" 00029 00030 //--------------------------------------------------------------------------- 00031 // Macros 00032 //--------------------------------------------------------------------------- 00033 00035 #define XN_SETBITMASK(x) (1 << x-1) 00036 00038 #define XN_RET_IF_NULL(x, y) \ 00039 if (x == NULL) \ 00040 { \ 00041 return (y); \ 00042 } 00043 00045 #define XN_IS_STATUS_OK_RET(x, y) \ 00046 if (x != XN_STATUS_OK) \ 00047 { \ 00048 return (y); \ 00049 } 00050 00052 #define XN_IS_STATUS_OK_GOCLEANUP_RET(x, y) \ 00053 if (x != XN_STATUS_OK) \ 00054 { \ 00055 x = y; \ 00056 goto ErrorCleanUp; \ 00057 } 00058 00060 #define XN_IS_STATUS_OK(x) \ 00061 XN_IS_STATUS_OK_RET(x, x) 00062 00063 #define XN_IS_STATUS_OK_ASSERT(x) \ 00064 if (x != XN_STATUS_OK) \ 00065 { \ 00066 XN_ASSERT(FALSE); \ 00067 return (x); \ 00068 } 00069 00070 00072 #define XN_IS_STATUS_OK_GOCLEANUP(x) \ 00073 if (x != XN_STATUS_OK) \ 00074 { \ 00075 goto ErrorCleanUp; \ 00076 } 00077 00079 #define XN_IS_BOOL_OK_RET(x, y) \ 00080 if (x != TRUE) \ 00081 { \ 00082 return (y); \ 00083 } 00084 00086 #define XN_IS_BOOL_OK_GOCLEANUP_RET(x, y) \ 00087 if (x != TRUE) \ 00088 { \ 00089 goto ErrorCleanUp; \ 00090 } 00091 00093 #define XN_GOCLEANUP_RET(x, y) \ 00094 x = y; \ 00095 goto ErrorCleanUp; 00096 00098 #define XN_VALIDATE_PTR(x,y) \ 00099 if (x == NULL) \ 00100 { \ 00101 return (y); \ 00102 } 00103 00105 #define XN_CHECK_INPUT_OVERFLOW(x, y) \ 00106 if (x > y) \ 00107 { \ 00108 return (XN_STATUS_INPUT_BUFFER_OVERFLOW); \ 00109 } 00110 00112 #define XN_CHECK_OUTPUT_OVERFLOW(x, y) \ 00113 if (x > y) \ 00114 { \ 00115 return (XN_STATUS_OUTPUT_BUFFER_OVERFLOW); \ 00116 } 00117 00119 #define XN_DISABLE_COPY_AND_ASSIGN(TypeName) \ 00120 TypeName(const TypeName&); \ 00121 void operator=(const TypeName&); 00122 00125 #define XN_REFERENCE_VARIABLE(x) \ 00126 ((void)x) 00127 00128 #endif //_XN_MACROS_H_
Generated on Wed May 16 2012 10:16:05 for OpenNI 1.5.4 by 1.7.5.1