![]() |
OpenNI 1.5.7
|
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_MACROS_H_ 00022 #define _XN_MACROS_H_ 00023 00024 //--------------------------------------------------------------------------- 00025 // Includes 00026 //--------------------------------------------------------------------------- 00027 #include "XnStatusCodes.h" 00028 00029 //--------------------------------------------------------------------------- 00030 // Macros 00031 //--------------------------------------------------------------------------- 00032 00034 #define XN_SETBITMASK(x) (1 << x-1) 00035 00037 #define XN_RET_IF_NULL(x, y) \ 00038 if (x == NULL) \ 00039 { \ 00040 return (y); \ 00041 } 00042 00044 #define XN_IS_STATUS_OK_RET(x, y) \ 00045 if (x != XN_STATUS_OK) \ 00046 { \ 00047 return (y); \ 00048 } 00049 00051 #define XN_IS_STATUS_OK_GOCLEANUP_RET(x, y) \ 00052 if (x != XN_STATUS_OK) \ 00053 { \ 00054 x = y; \ 00055 goto ErrorCleanUp; \ 00056 } 00057 00059 #define XN_IS_STATUS_OK(x) \ 00060 XN_IS_STATUS_OK_RET(x, x) 00061 00062 #define XN_IS_STATUS_OK_ASSERT(x) \ 00063 if (x != XN_STATUS_OK) \ 00064 { \ 00065 XN_ASSERT(FALSE); \ 00066 return (x); \ 00067 } 00068 00069 00071 #define XN_IS_STATUS_OK_GOCLEANUP(x) \ 00072 if (x != XN_STATUS_OK) \ 00073 { \ 00074 goto ErrorCleanUp; \ 00075 } 00076 00078 #define XN_IS_BOOL_OK_RET(x, y) \ 00079 if (x != TRUE) \ 00080 { \ 00081 return (y); \ 00082 } 00083 00085 #define XN_IS_BOOL_OK_GOCLEANUP_RET(x, y) \ 00086 if (x != TRUE) \ 00087 { \ 00088 goto ErrorCleanUp; \ 00089 } 00090 00092 #define XN_GOCLEANUP_RET(x, y) \ 00093 x = y; \ 00094 goto ErrorCleanUp; 00095 00097 #define XN_VALIDATE_PTR(x,y) \ 00098 if (x == NULL) \ 00099 { \ 00100 return (y); \ 00101 } 00102 00104 #define XN_CHECK_INPUT_OVERFLOW(x, y) \ 00105 if (x > y) \ 00106 { \ 00107 return (XN_STATUS_INPUT_BUFFER_OVERFLOW); \ 00108 } 00109 00111 #define XN_CHECK_OUTPUT_OVERFLOW(x, y) \ 00112 if (x > y) \ 00113 { \ 00114 return (XN_STATUS_OUTPUT_BUFFER_OVERFLOW); \ 00115 } 00116 00118 #define XN_DISABLE_COPY_AND_ASSIGN(TypeName) \ 00119 TypeName(const TypeName&); \ 00120 void operator=(const TypeName&); 00121 00124 #define XN_REFERENCE_VARIABLE(x) \ 00125 ((void)x) 00126 00127 #endif //_XN_MACROS_H_