utilities.h
Go to the documentation of this file.
00001 //=============================================================================
00002 // File      : utilities.h
00003 // Created   : mar jun 19 13:18:14 CEST 2001
00004 // Author    : Antoine YESSAYAN, Paul RASCLE, EDF
00005 // Project   : SALOME
00006 // Copyright : EDF 2001
00007 // $Header$
00008 //=============================================================================
00009 
00010 /* ---  Definition macros file to print information if _DEBUG_ is defined --- */
00011 
00012 # ifndef UTILITIES_H
00013 # define UTILITIES_H
00014 
00015 # include <stdlib.h>
00016 //# include <iostream> ok for gcc3.01
00017 # include <iostream>
00018 
00019 /* ---  INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
00020 
00021 # define HEREWEARE cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;
00022 # define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
00023 # define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
00024 
00025 /* --- To print date and time of compilation of current source on stdout --- */
00026 
00027 # if defined ( __GNUC__ )
00028 # define COMPILER               "g++" ;
00029 # elif defined ( __sun )
00030 # define COMPILER               "CC" ;
00031 # elif defined ( __KCC )
00032 # define COMPILER               "KCC" ;
00033 # elif defined ( __PGI )
00034 # define COMPILER               "pgCC" ;
00035 # else
00036 # define COMPILER               "undefined" ;
00037 # endif
00038 
00039 # ifdef INFOS_COMPILATION
00040 # error INFOS_COMPILATION already defined
00041 # endif
00042 # define INFOS_COMPILATION      {\
00043                                         cerr << flush;\
00044                                         cout << __FILE__ ;\
00045                                         cout << " [" << __LINE__ << "] : " ;\
00046                                         cout << "COMPILED with " << COMPILER ;\
00047                                         cout << ", " << __DATE__ ; \
00048                                         cout << " at " << __TIME__ << endl ;\
00049                                         cout << "\n\n" ;\
00050                                         cout << flush ;\
00051                                 }
00052 
00053 # ifdef _DEBUG_
00054 
00055 /* --- the following MACROS are useful at debug time --- */
00056 
00057 # define HERE cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;
00058 # define SCRUTE(var) HERE ; cerr << #var << "=" << var << endl ;
00059 # define MESSAGE(chain) {HERE ; cerr << chain << endl ;}
00060 # define INTERRUPTION(code) HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;
00061 
00062 # ifndef ASSERT
00063 # define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}
00064 # endif /* ASSERT */
00065 
00066 #define REPERE cout<<flush ; cerr << "   --------------" << endl << flush ;
00067 #define BEGIN_OF(chain) {REPERE ; HERE ; cerr << "Begin of: " << chain << endl ; REPERE ; }
00068 #define END_OF(chain) {REPERE ; HERE ; cerr << "Normal end of: " << chain << endl ; REPERE ; }
00069 
00070 
00071 
00072 # else /* ifdef _DEBUG_*/
00073 
00074 # define HERE
00075 # define SCRUTE(var)
00076 # define MESSAGE(chain)
00077 # define INTERRUPTION(code)
00078 
00079 # ifndef ASSERT
00080 # define ASSERT(condition)
00081 # endif /* ASSERT */
00082 
00083 #define REPERE
00084 #define BEGIN_OF(chain)
00085 #define END_OF(chain)
00086 
00087 
00088 # endif /* ifdef _DEBUG_*/
00089 
00090 # endif /* ifndef UTILITIES_H */


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:40