XnMacros.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 *                                                                            *
00003 *  OpenNI 1.0 Alpha                                                          *
00004 *  Copyright (C) 2010 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 
00023 
00024 
00025 
00026 #ifndef _XN_MACROS_H_
00027 #define _XN_MACROS_H_
00028 
00029 //---------------------------------------------------------------------------
00030 // Includes
00031 //---------------------------------------------------------------------------
00032 #include "XnStatusCodes.h"
00033 
00034 //---------------------------------------------------------------------------
00035 // Macros
00036 //---------------------------------------------------------------------------
00037 
00039 #define XN_SETBITMASK(x) (1 << x-1)
00040 
00042 #define XN_RET_IF_NULL(x, y)    \
00043                 if (x == NULL)                  \
00044                 {                                               \
00045                         return (y);                     \
00046                 }
00047 
00049 #define XN_IS_STATUS_OK_RET(x, y)       \
00050                 if (x != XN_STATUS_OK)          \
00051                 {                                                       \
00052                         return (y);                             \
00053                 }
00054 
00056 #define XN_IS_STATUS_OK_GOCLEANUP_RET(x, y)     \
00057                 if (x != XN_STATUS_OK)                          \
00058                 {                                                                       \
00059                         x = y;                                                  \
00060                         goto ErrorCleanUp;                              \
00061                 }
00062 
00064 #define XN_IS_STATUS_OK(x)                      \
00065                 XN_IS_STATUS_OK_RET(x, x)
00066 
00067 #define XN_IS_STATUS_OK_ASSERT(x)       \
00068         if (x != XN_STATUS_OK)          \
00069         {                                                       \
00070                 XN_ASSERT(FALSE);               \
00071                 return (x);                             \
00072         }
00073                 
00074 
00076 #define XN_IS_STATUS_OK_GOCLEANUP(x)    \
00077                 if (x != XN_STATUS_OK)                  \
00078                 {                                                               \
00079                         goto ErrorCleanUp;                      \
00080                 }
00081 
00083 #define XN_IS_BOOL_OK_RET(x, y)         \
00084                 if (x != TRUE)                          \
00085                 {                                                       \
00086                         return (y);                             \
00087                 }
00088 
00090 #define XN_IS_BOOL_OK_GOCLEANUP_RET(x, y)       \
00091                 if (x != TRUE)                                          \
00092                 {                                                                       \
00093                         goto ErrorCleanUp;                              \
00094                 }
00095 
00097 #define XN_GOCLEANUP_RET(x, y)  \
00098                 x = y;                                  \
00099                 goto ErrorCleanUp;                              
00100 
00102 #define XN_VALIDATE_PTR(x,y)    \
00103                 if (x == NULL)                  \
00104                 {                                               \
00105                         return (y);                     \
00106                 }
00107 
00109 #define XN_CHECK_INPUT_OVERFLOW(x, y)                                   \
00110                 if (x > y)                                                                              \
00111                 {                                                                                               \
00112                         return (XN_STATUS_INPUT_BUFFER_OVERFLOW);       \
00113                 }
00114 
00116 #define XN_CHECK_OUTPUT_OVERFLOW(x, y)                                  \
00117                 if (x > y)                                                                              \
00118                 {                                                                                               \
00119                         return (XN_STATUS_OUTPUT_BUFFER_OVERFLOW);      \
00120                 }
00121 
00122 #endif //_XN_MACROS_H_


nao_openni
Author(s): Bener SUAY
autogenerated on Mon Jan 6 2014 11:27:51