00001 #ifndef _GEMFIRE_ASSERT_HPP_
00002 #define _GEMFIRE_ASSERT_HPP_
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "gfcpp_globals.hpp"
00012
00019 namespace gemfire {
00020
00026 class CPPCACHE_EXPORT Assert
00027 {
00028 public:
00029
00033 inline static void assertTrue( bool expression, const char* expressionText, const char* file, int line )
00034 {
00035 if ( ! expression ) {
00036 throwAssertion( expressionText, file, line );
00037 }
00038 }
00039
00042 static void throwAssertion( const char* expressionText, const char* file, int line );
00043 };
00044
00045 }
00046
00048 #define GF_R_ASSERT(x) gemfire::Assert::assertTrue( x, #x, __FILE__, __LINE__ )
00049
00050 #ifndef GF_DEBUG_ASSERTS
00051
00052 #define GF_DEBUG_ASSERTS 0
00053 #endif
00054
00055 #ifndef GF_DEVEL_ASSERTS
00056 #define GF_DEVEL_ASSERTS 0
00057 #endif
00058
00059 #if GF_DEVEL_ASSERTS == 1
00060 #undef GF_DEBUG_ASSERTS
00061 #define GF_DEBUG_ASSERTS 1
00062 #endif
00063
00064 #if GF_DEBUG_ASSERTS == 1
00065 #undef GF_DEVEL_ASSERTS
00066 #define GF_DEVEL_ASSERTS 1
00067 #endif
00068
00070 #if GF_DEBUG_ASSERTS == 1
00071 #define GF_D_ASSERT(x) gemfire::Assert::assertTrue( x, #x, __FILE__, __LINE__ )
00072 #else
00073 #define GF_D_ASSERT(x)
00074 #endif
00075
00077 #if GF_DEVEL_ASSERTS == 1
00078 #define GF_DEV_ASSERT(x) gemfire::Assert::assertTrue( x, #x, __FILE__, __LINE__ )
00079 #else
00080 #define GF_DEV_ASSERT(x)
00081 #endif
00082
00083
00084 #endif