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