bdmerror.h
Go to the documentation of this file.00001 00013 #ifndef bdmerror_h 00014 #define bdmerror_h 00015 00016 // modelled after IT++ assert macros, somewhat simplified 00017 00018 #include <sstream> 00019 #include <string> 00020 00021 namespace bdm { 00022 00024 void bdm_assert_f ( const std::string &ass, const std::string &msg, const std::string &file, int line ); 00025 00027 void bdm_error_f ( const std::string &msg, const std::string &file, int line ); 00028 00030 void bdm_warning_f ( const std::string &msg, const std::string &file, int line ); 00031 00032 } 00033 00035 #define bdm_assert(t, s) \ 00036 if (!(t)) { \ 00037 std::ostringstream bdm_out; \ 00038 bdm_out << s; \ 00039 bdm::bdm_assert_f(#t, bdm_out.str(), __FILE__, __LINE__); \ 00040 } else ((void) 0) 00041 00042 #if defined(NDEBUG) 00044 #define bdm_assert_debug(t, s) ((void) 0) 00045 #else 00047 #define bdm_assert_debug(t, s) bdm_assert(t, s) 00048 #endif // if defined(NDEBUG) 00049 00050 #if defined(NDEBUG) 00052 #define DEBUG(command) ((void) 0) 00053 #else 00055 #define DEBUG(command) command 00056 #endif // if defined(NDEBUG) 00057 00059 #define bdm_error(s) \ 00060 if (true) { \ 00061 std::ostringstream bdm_out; \ 00062 bdm_out << s; \ 00063 bdm::bdm_error_f(bdm_out.str(), __FILE__, __LINE__); \ 00064 } else ((void) 0) 00065 00067 #define bdm_warning(s) \ 00068 if (true) { \ 00069 std::ostringstream bdm_out; \ 00070 bdm_out << s; \ 00071 bdm::bdm_warning_f(bdm_out.str(), __FILE__, __LINE__); \ 00072 } else ((void) 0) 00073 00074 #define NOT_IMPLEMENTED(RESULT) { bdm_error( "Not implemented" ); return RESULT; } 00075 00076 #define NOT_IMPLEMENTED_VOID { bdm_error( "Not implemented" ); } 00077 00078 #endif
Generated on 2 Dec 2013 for mixpp by 1.4.7