CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ELseverityLevel.h
Go to the documentation of this file.
1 #ifndef MessageLogger_ELseverityLevel_h
2 #define MessageLogger_ELseverityLevel_h
3 
4 
5 // ----------------------------------------------------------------------
6 //
7 // ELseverityLevel.h - declare objects that encode a message's urgency
8 //
9 // Both frameworker and user will often pass one of the
10 // instantiated severity levels to logger methods.
11 //
12 // The only other methods of ELseverityLevel a frameworker
13 // might use is to check the relative level of two severities
14 // using operator< or the like.
15 //
16 // 30-Jun-1998 mf Created file.
17 // 26-Aug-1998 WEB Made ELseverityLevel object less weighty.
18 // 16-Jun-1999 mf Added constructor from string.
19 // 23-Jun-1999 mf Additional ELsev_noValueAssigned to allow constructor
20 // from string to give ELunspecified when not found, while
21 // still allowing finding zero severity.
22 // 23-Jun-1999 mf Corrections for subtleties in initialization of
23 // global symbols:
24 // Added ELsevLevGlobals array
25 // Changed extern consts of SLseverityLevels into
26 // const ELseverityLevel & 's
27 // Inserted class ELinitializeGlobalSeverityObjects
28 // in place of the
29 // initializeGlobalSeverityObjects() function.
30 // Changed globalSeverityObjectsGuarantor to an
31 // ELinitializeGlobalSeverityObjects instance.
32 // 30-Jun-1999 mf Modifications to eliminate problems with order of
33 // globals initializations:
34 // translate(), getInputStr(), getVarName()
35 // 12-Jun-2000 web Final fix to global static initialization problem
36 // 14-Jun-2000 web Declare classes before granting friendship.
37 // 27-Jun-2000 web Fix order-of-static-destruction problem
38 //
39 // ----------------------------------------------------------------------
40 
41 
42 #ifndef ELSTRING_H
44 #endif
45 
46 namespace edm {
47 
48 
49 // ----------------------------------------------------------------------
50 // Forward declaration:
51 // ----------------------------------------------------------------------
52 
53 class ELseverityLevel;
54 
55 
56 // ----------------------------------------------------------------------
57 // Synonym for type of ELseverityLevel-generating function:
58 // ----------------------------------------------------------------------
59 
60 typedef ELseverityLevel const ELslGen();
61 
62 
63 // ----------------------------------------------------------------------
64 // ELslProxy class template:
65 // ----------------------------------------------------------------------
66 
67 template< ELslGen ELgen >
68 struct ELslProxy {
69 
70  // --- birth/death:
71  //
72  ELslProxy();
73  ~ELslProxy();
74 
75  // --- copying:
76  //
77  ELslProxy( ELslProxy const & );
78  ELslProxy const & operator= ( ELslProxy const & );
79 
80  // --- conversion::
81  //
82  operator ELseverityLevel const () const;
83 
84  // --- forwarding:
85  //
86  int getLevel() const;
87  const ELstring getSymbol() const;
88  const ELstring getName() const;
89  const ELstring getInputStr() const;
90  const ELstring getVarName() const;
91 
92 }; // ELslProxy<ELslGen>
93 
94 // ----------------------------------------------------------------------
95 
96 
97 // ----------------------------------------------------------------------
98 // ELseverityLevel:
99 // ----------------------------------------------------------------------
100 
102 
103 public:
104 
105  // --- One ELseverityLevel is globally instantiated (see below)
106  // --- for each of the following levels:
107  //
108  enum ELsev_ {
109  ELsev_noValueAssigned = 0 // default returned by map when not found
110  , ELsev_zeroSeverity // threshold use only
111  , ELsev_incidental // flash this on a screen
112  , ELsev_success // report reaching a milestone
113  , ELsev_info // information
114  , ELsev_warning // warning
115  , ELsev_warning2 // more serious warning
116  , ELsev_error // error detected
117  , ELsev_error2 // more serious error
118  , ELsev_next // advise to skip to next event
119  , ELsev_unspecified // severity was not specified
120  , ELsev_severe // future results are suspect
121  , ELsev_severe2 // more severe
122  , ELsev_abort // suggest aborting
123  , ELsev_fatal // strongly suggest aborting!
124  , ELsev_highestSeverity // threshold use only
125  // -----
126  , nLevels // how many levels?
127  }; // ELsev_
128 
129  // ----- Birth/death:
130  //
132  ELseverityLevel ( ELstring const & str );
133  // str may match getSymbol, getName, getInputStr,
134  // or getVarName -- see accessors
136 
137  // ----- Comparator:
138  //
139  int cmp( ELseverityLevel const & e ) const;
140 
141  // ----- Accessors:
142  //
143  int getLevel() const;
144  const ELstring getSymbol() const; // example: "-e"
145  const ELstring getName() const; // example: "Error"
146  const ELstring getInputStr() const; // example: "ERROR"
147  const ELstring getVarName() const; // example: "ELerror"
148 
149  // ----- Emitter:
150  //
151  friend std::ostream & operator<< (
152  std::ostream & os
153  , const ELseverityLevel & sev
154  );
155 
156 private:
157 
158  // Data per ELseverityLevel object:
159  //
160  int myLevel;
161 
162 }; // ELseverityLevel
163 
164 
165 // ----------------------------------------------------------------------
166 // Declare the globally available severity objects,
167 // one generator function and one proxy per non-default ELsev_:
168 // ----------------------------------------------------------------------
169 
172 
173 extern ELslGen ELincidentalGen;
175 
176 extern ELslGen ELsuccessGen;
178 
179 extern ELslGen ELinfoGen;
180 extern ELslProxy< ELinfoGen > const ELinfo;
181 
182 extern ELslGen ELwarningGen;
184 
185 extern ELslGen ELwarning2Gen;
187 
188 extern ELslGen ELerrorGen;
189 extern ELslProxy< ELerrorGen > const ELerror;
190 
191 extern ELslGen ELerror2Gen;
193 
194 extern ELslGen ELnextEventGen;
196 
199 
200 extern ELslGen ELsevereGen;
202 
203 extern ELslGen ELsevere2Gen;
205 
206 extern ELslGen ELabortGen;
207 extern ELslProxy< ELabortGen > const ELabort;
208 
209 extern ELslGen ELfatalGen;
210 extern ELslProxy< ELfatalGen > const ELfatal;
211 
214 
215 
216 // ----------------------------------------------------------------------
217 // Comparators:
218 // ----------------------------------------------------------------------
219 
220 extern bool operator== ( ELseverityLevel const & e1
221  , ELseverityLevel const & e2 );
222 extern bool operator!= ( ELseverityLevel const & e1
223  , ELseverityLevel const & e2 );
224 extern bool operator< ( ELseverityLevel const & e1
225  , ELseverityLevel const & e2 );
226 extern bool operator<= ( ELseverityLevel const & e1
227  , ELseverityLevel const & e2 );
228 extern bool operator> ( ELseverityLevel const & e1
229  , ELseverityLevel const & e2 );
230 extern bool operator>= ( ELseverityLevel const & e1
231  , ELseverityLevel const & e2 );
232 
233 
234 // ----------------------------------------------------------------------
235 
236 } // end of namespace edm
237 
238 
239 // ----------------------------------------------------------------------
240 
241 #define ELSEVERITYLEVEL_ICC
242  #include "FWCore/MessageLogger/interface/ELseverityLevel.icc"
243 #undef ELSEVERITYLEVEL_ICC
244 
245 
246 // ----------------------------------------------------------------------
247 
248 #endif // MessageLogger_ELseverityLevel_h
249 
ELslGen ELinfoGen
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:77
ELslGen ELzeroSeverityGen
ELslProxy< ELnextEventGen > const ELnextEvent
int cmp(ELseverityLevel const &e) const
const ELstring getVarName() const
ELslProxy< ELsuccessGen > const ELsuccess
ELslGen ELerrorGen
ELslGen ELincidentalGen
ELslGen ELerror2Gen
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
ELslProxy< ELfatalGen > const ELfatal
ELslProxy< ELunspecifiedGen > const ELunspecified
ELseverityLevel(ELsev_ lev=ELsev_unspecified)
const ELstring getVarName() const
ELslProxy< ELwarningGen > const ELwarning
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
bool operator<=(View< T > const &, View< T > const &)
Definition: View.h:414
int getLevel() const
ELslProxy const & operator=(ELslProxy const &)
ELseverityLevel const ELslGen()
ELslProxy< ELsevere2Gen > const ELsevere2
const ELstring getSymbol() const
bool operator>=(View< T > const &, View< T > const &)
Definition: View.h:428
ELslGen ELnextEventGen
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
ELslProxy< ELincidentalGen > const ELincidental
ELslProxy< ELabortGen > const ELabort
ELslProxy< ELerrorGen > const ELerror
ELslGen ELwarningGen
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
const ELstring getName() const
const ELstring getName() const
const ELstring getInputStr() const
bool operator>(View< T > const &, View< T > const &)
Definition: View.h:421
const ELstring getSymbol() const
ELslGen ELabortGen
ELslGen ELhighestSeverityGen
ELslProxy< ELinfoGen > const ELinfo
ELslGen ELsevere2Gen
ELslProxy< ELerror2Gen > const ELerror2
ELslGen ELwarning2Gen
ELslProxy< ELsevereGen > const ELsevere
friend std::ostream & operator<<(std::ostream &os, const ELseverityLevel &sev)
ELslGen ELsuccessGen
ELslProxy< ELwarning2Gen > const ELwarning2
ELslGen ELunspecifiedGen
ELslGen ELsevereGen
ELslGen ELfatalGen
std::string ELstring
Definition: ELstring.h:26
const ELstring getInputStr() const