00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OPENMS_CONCEPT_MACROS_H
00028 #define OPENMS_CONCEPT_MACROS_H
00029
00030
00031 #include <OpenMS/config.h>
00032 #include <OpenMS/CONCEPT/Exception.h>
00033
00034 #include <string>
00035
00051 #if defined OPENMS_DEBUG || defined OPENMS_WITHIN_CLASSTEST
00052
00058 #define OPENMS_PRECONDITION(condition, message)\
00059 if (!(condition))\
00060 {\
00061 Exception::Precondition e(__FILE__, __LINE__, __PRETTY_FUNCTION__, #condition);\
00062 if (std::strcmp(message,"")!=0)\
00063 {\
00064 ::std::string tmp(e.getMessage());\
00065 tmp += ::std::string(message);\
00066 e.setMessage(tmp);\
00067 }\
00068 throw e;\
00069 }\
00070
00071
00076 #define OPENMS_POSTCONDITION(condition, message)\
00077 if (!(condition))\
00078 {\
00079 Exception::Postcondition e(__FILE__, __LINE__, __PRETTY_FUNCTION__, #condition);\
00080 if (std::strcmp(message,"")!=0)\
00081 {\
00082 std::string tmp(e.getMessage());\
00083 tmp += std::string(message);\
00084 e.setMessage(tmp);\
00085 }\
00086 throw e;\
00087 }\
00088
00089 #else
00090
00096 #define OPENMS_PRECONDITION(condition, message)
00097
00103 #define OPENMS_POSTCONDITION(condition, message)
00104
00105 #endif
00106
00108
00109 #endif //OPENMS_CONCEPT_MACROS_H