Salome HOME
NRI : Comment unused ComponentType enum.
[modules/kernel.git] / src / Utils / utilities.h
1 //=============================================================================
2 // File      : utilities.h
3 // Created   : mar jun 19 13:18:14 CEST 2001
4 // Author    : Antoine YESSAYAN, Paul RASCLE, EDF
5 // Project   : SALOME
6 // Copyright : EDF 2001
7 // $Header$
8 //=============================================================================
9
10 /* ---  Definition macros file to print informations if _DEBUG_ is defined --- */
11
12 # ifndef UTILITIES_H
13 # define UTILITIES_H
14
15 # include <stdlib.h>
16 # include <iostream>
17
18 //VRV: T2.4 - replacement macro for using special CORBA server
19 #include "SALOME_Trace.hxx"
20 //VRV: T2.4 - replacement macro for using special CORBA server
21
22 /* ---  INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
23
24 //VRV: T2.4 - replacement of these macros for using special CORBA server
25
26 #define INFOS(msg) { GLogger.putMessage(GLogger << __FILE__<< " [" << __LINE__ << "] : " << msg<< endl << ends ); }
27 #define PYSCRIPT(msg) { GLogger.putMessage(GLogger<<"---PYSCRIPT--- "<<msg<<endl<<ends ); }
28
29 //# define HEREWEARE {cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;}
30 //# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
31 //# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
32
33 //VRV: T2.4 - replacement of these macros for using special CORBA server
34
35
36 /* --- To print date and time of compilation of current source on stdout --- */
37
38 # if defined ( __GNUC__ )
39 # define COMPILER               "g++" 
40 # elif defined ( __sun )
41 # define COMPILER               "CC" 
42 # elif defined ( __KCC )
43 # define COMPILER               "KCC" 
44 # elif defined ( __PGI )
45 # define COMPILER               "pgCC" 
46 # else
47 # define COMPILER               "undefined" 
48 # endif
49
50 # ifdef INFOS_COMPILATION
51 # error INFOS_COMPILATION already defined
52 # endif
53
54 //VRV: T2.4 - replacement macro for using special CORBA server
55 #define INFOS_COMPILATION { \
56                               GLogger.putMessage(\
57                                                  GLogger << __FILE__ << " [" << __LINE__ << "] : "\
58                                                  << "COMPILED with " << COMPILER \
59                                                  << ", " << __DATE__ \
60                                                  << " at " << __TIME__ << endl << endl <<endl<<ends); }
61 /* # define INFOS_COMPILATION   {\ */
62 /*                                      cerr << flush;\ */
63 /*                                      cout << __FILE__ ;\ */
64 /*                                      cout << " [" << __LINE__ << "] : " ;\ */
65 /*                                      cout << "COMPILED with " << COMPILER ;\ */
66 /*                                      cout << ", " << __DATE__ ; \ */
67 /*                                      cout << " at " << __TIME__ << endl ;\ */
68 /*                                      cout << "\n\n" ;\ */
69 /*                                      cout << flush ;\ */
70 /*                              } */
71 //VRV: T2.4 - replacement macro for using special CORBA server
72
73 # ifdef _DEBUG_
74
75 /* --- the following MACROS are useful at debug time --- */
76
77 //VRV: T2.4 - replacement of these macros for using special CORBA server
78
79 #define MYTRACE GLogger << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " 
80
81 #define MESSAGE(msg) { GLogger.putMessage( MYTRACE <<msg<<endl<<ends); }
82 #define SCRUTE(var) { GLogger.putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
83
84 #define REPERE GLogger << "   --------------" << endl 
85 #define BEGIN_OF(msg) {REPERE ; MYTRACE << "Begin of: " << msg << endl ; REPERE ; GLogger.putMessage(GLogger<<ends); } 
86 #define END_OF(msg) {REPERE ; MYTRACE << "Normal end of: " << msg << endl ; REPERE ; GLogger.putMessage(GLogger<<ends); } 
87
88 # define HERE {cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;}
89
90 //VRV: T2.4 - replacement of these macros for using special CORBA server
91
92 # define INTERRUPTION(code) {HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;}
93
94 # ifndef ASSERT
95 # define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}
96 # endif /* ASSERT */
97
98 # else /* ifdef _DEBUG_*/
99
100 #define HERE 
101 #define SCRUTE(var) {}
102 #define MESSAGE(msg) {}
103 #define REPERE
104 #define BEGIN_OF(msg) {}
105 #define END_OF(msg) {}
106
107 # define INTERRUPTION(code) {}
108
109 # ifndef ASSERT
110 # define ASSERT(condition) {}
111 # endif /* ASSERT */
112
113
114
115 # endif /* ifdef _DEBUG_*/
116
117 # endif /* ifndef UTILITIES_H */