00001 #ifndef IOTRUTILITIES
00002 #define IOTRUTILITIES
00003
00004 #include <iostream>
00005 #include <stdexcept>
00006
00007
00008
00009 #if ! defined(IOTRNODEBUG) && ! defined(NDEBUG)
00010 #
00011 #define IotrAssert(expr) \
00012 if( !(expr) ) { \
00013 std::cerr << "Assertion violated " << #expr << std::endl; \
00014 std::cerr << "On line " << __LINE__ << \
00015 " in file " << __FILE__ << std::endl; \
00016 throw( "IotrAssert failed" ); \
00017 }
00018
00019 #else
00020
00021 #define IotrAssert(expr) ((void) (0))
00022
00023 #endif
00024
00025 #if ! defined(IOTRNODEBUG) && ! defined(NDEBUG)
00026 #
00027 #define IotrArgCheck(expr) \
00028 if( !(expr) ) { \
00029 throw std::invalid_argument( "Invalid argument on line " \
00030 "__LINE__" " of file " \
00031 __FILE__ "." ); \
00032 }
00033
00034 #else
00035
00036 #define IotrArgCheck(expr) ((void) (0))
00037
00038 #endif
00039
00040
00041 #if defined (IOTRINTENSEDEBUG) && ! defined (NDEBUG)
00042
00043 #define IotrVerify(expr) \
00044 if( !(expr) ) { \
00045 std::cerr << "Verify failed " << #expr << std::endl; \
00046 std::cerr << "On line " << __LINE__ << " in file "; \
00047 std::cerr << __FILE__ << std::endl; \
00048 throw( "IotrVerify failed" ); \
00049 }
00050
00051 #else
00052
00053 #define IotrVerify(expr) ((void) (0))
00054
00055 #endif
00056
00057 #endif