00001
00002
00003
00004
00005 #ifndef BALL_COMMON_DEBUG_H
00006 #define BALL_COMMON_DEBUG_H
00007
00008 #ifndef BALL_CONFIG_CONFIG_H
00009 # include <BALL/CONFIG/config.h>
00010 #endif
00011
00012 #ifdef BALL_NO_INLINE_FUNCTIONS
00013 # define BALL_INLINE
00014 #else
00015 # define BALL_INLINE inline
00016 #endif
00017
00018 #include <string>
00019 #include <cstring>
00020
00021 #ifdef BALL_DEBUG
00022
00023 # define BALL_PRECONDITION_EXCEPTION(condition, message)\
00024 if (!(condition))\
00025 {\
00026 Exception::Precondition e(__FILE__, __LINE__, #condition);\
00027 if (strcmp(message, "") != 0)\
00028 {\
00029 ::std::string tmp(e.getMessage());\
00030 tmp += ::std::string(message);\
00031 e.setMessage(tmp);\
00032 }\
00033 throw e;\
00034 }\
00035
00036 # define BALL_POSTCONDITION_EXCEPTION(condition, message)\
00037 if (!(condition))\
00038 {\
00039 Exception::Postcondition e(__FILE__, __LINE__, #condition);\
00040 if (strcmp(message, "") != 0)\
00041 {\
00042 std::string tmp(e.getMessage());\
00043 tmp += std::string(message);\
00044 e.setMessage(tmp);\
00045 }\
00046 throw e;\
00047 }\
00048
00049 #else
00050
00051 # define BALL_PRECONDITION_EXCEPTION(condition, message)
00052 # define BALL_POSTCONDITION_EXCEPTION(condition, message)
00053
00054 #endif // BALL_DEBUG
00055
00056 #endif // BALL_COMMON_DEBUG_H