00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef ASSURE_H
00015 #define ASSURE_H
00016
00017 #include <unistd.h>
00018 #include <errno.h>
00019 #include <signal.h>
00020
00021 #include "assa/Logger.h"
00022
00023 namespace ASSA {
00024
00039 #define Assure_exit( exp_ ) \
00040 do { \
00041 if ( !(exp_) ) { \
00042 DL((ASSA::ASSAERR,"Assure Aborted False Expression!\n")); \
00043 DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00044 ::raise( SIGTERM ); \
00045 } \
00046 } while (0)
00047
00048
00064 #define Assure_return(exp_) \
00065 do { \
00066 if ( !(exp_) ) { \
00067 DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
00068 DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00069 return (false); \
00070 } \
00071 } while (0)
00072
00084 #define Assure_return_void(exp_) \
00085 do { \
00086 if ( !(exp_) ) { \
00087 DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
00088 DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00089 return; \
00090 } \
00091 } while (0)
00092
00109 #define Assure_return_value(exp_,value_) \
00110 do { \
00111 if ( !(exp_) ) { \
00112 DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
00113 DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00114 return (value_); \
00115 } \
00116 } while (0)
00117
00118 }
00119
00120 #endif