fbxsdk/core/arch/fbxdebug.h Source File
 
 
 
fbxsdk/core/arch/fbxdebug.h
Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00022 #ifndef _FBXSDK_CORE_ARCH_DEBUG_H_
00023 #define _FBXSDK_CORE_ARCH_DEBUG_H_
00024 
00025 #include <fbxsdk/fbxsdk_def.h>
00026 
00027 #include <fbxsdk/fbxsdk_nsbegin.h>
00028 
00030 #define FBXSDK_ASSERT_ENVSTR "FBXSDK_ASSERT"
00031 
00038 typedef void (*FbxAssertProc)(const char* pFileName, const char* pFunctionName, const unsigned int pLineNumber, const char* pMessage);
00039 
00041 FBXSDK_DLL void FbxAssert(const char* pFileName, const char* pFunctionName, const unsigned int pLineNumber, const char* pMessage);
00042 
00046 FBXSDK_DLL void FbxAssertSetProc(FbxAssertProc pAssertProc);
00047 
00049 FBXSDK_DLL void FbxAssertSetDefaultProc();
00050 
00051 #ifdef _DEBUG
00052     template <bool x> struct FbxStaticAssertType;
00053     template<> struct FbxStaticAssertType<true>                 {enum{value=1};};
00054     template<> struct FbxStaticAssertType<false>                {enum{value=-1};};   
00055         #define FBX_ASSERT_MSG(Condition, Message)                      if(!(Condition)){FbxAssert(__FILE__,__FUNCTION__,__LINE__,Message);}
00056         #define FBX_ASSERT(Condition)                                           FBX_ASSERT_MSG(Condition, #Condition);
00057         #define FBX_ASSERT_NOW(Message)                                         FbxAssert(__FILE__,__FUNCTION__,__LINE__,Message);
00058         #define FBX_ASSERT_RETURN(Condition)                            if(!(Condition)){FBX_ASSERT_NOW(#Condition); return;}
00059         #define FBX_ASSERT_RETURN_VALUE(Condition, Value)       if(!(Condition)){FBX_ASSERT_NOW(#Condition); return Value;}
00060         #define FBX_ASSERT_STATIC(Condition)                            typedef char FbxBuildBreakIfFalse[FbxStaticAssertType<(bool)(Condition)>::value];
00061 #else
00062         #define FBX_ASSERT(Condition)                                           ((void)0)
00063         #define FBX_ASSERT_MSG(Condition, Message)                      ((void)0)
00064         #define FBX_ASSERT_NOW(Message)                                         ((void)0)
00065         #define FBX_ASSERT_RETURN(Condition)                            if(!(Condition)){return;}
00066         #define FBX_ASSERT_RETURN_VALUE(Condition, Value)       if(!(Condition)){return Value;}
00067     #define FBX_ASSERT_STATIC(Condition)
00068 #endif
00069 
00070 template<typename T> struct FbxIncompatibleWithArray{ enum {value = 0}; };
00071 
00072 #define FBXSDK_INCOMPATIBLE_WITH_ARRAY_TEMPLATE(T)\
00073         struct FbxIncompatibleWithArray< T >{\
00074                 union {\
00075                         T t();\
00076                 } catcherr;\
00077                 enum {value = 1};}
00078 
00079 #define FBXSDK_INCOMPATIBLE_WITH_ARRAY(T)\
00080         template<> FBXSDK_INCOMPATIBLE_WITH_ARRAY_TEMPLATE(T)
00081 
00082 #define FBXSDK_IS_INCOMPATIBLE_WITH_ARRAY(T) ((bool) FbxIncompatibleWithArray<T>::value)
00083 
00084 #include <fbxsdk/fbxsdk_nsend.h>
00085 
00086 #endif /* _FBXSDK_CORE_ARCH_DEBUG_H_ */