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 #ifndef __ROOTCLING__
57 // ----------------------------------------------------------------------
58 // Synonym for type of ELseverityLevel-generating function:
59 // ----------------------------------------------------------------------
60 
61 typedef ELseverityLevel const ELslGen();
62 
63 
64 // ----------------------------------------------------------------------
65 // ELslProxy class template:
66 // ----------------------------------------------------------------------
67 
68 template< ELslGen ELgen >
69 struct ELslProxy {
70 
71  // --- birth/death:
72  //
73  ELslProxy();
74  ~ELslProxy();
75 
76  // --- copying:
77  //
78  ELslProxy( ELslProxy const & );
79  ELslProxy const & operator= ( ELslProxy const & );
80 
81  // --- conversion::
82  //
83  operator ELseverityLevel const () const;
84 
85  // --- forwarding:
86  //
87  int getLevel() const;
88  const ELstring getSymbol() const;
89  const ELstring getName() const;
90  const ELstring getInputStr() const;
91  const ELstring getVarName() const;
92 
93 }; // ELslProxy<ELslGen>
94 #endif
95 
96 // ----------------------------------------------------------------------
97 
98 
99 // ----------------------------------------------------------------------
100 // ELseverityLevel:
101 // ----------------------------------------------------------------------
102 
104 
105 public:
106 
107  // --- One ELseverityLevel is globally instantiated (see below)
108  // --- for each of the following levels:
109  //
110  enum ELsev_ {
111  ELsev_noValueAssigned = 0 // default returned by map when not found
112  , ELsev_zeroSeverity // threshold use only
113  , ELsev_success // report reaching a milestone
114  , ELsev_info // information
115  , ELsev_warning // warning
116  , ELsev_error // error detected
117  , ELsev_unspecified // severity was not specified
118  , ELsev_severe // future results are suspect
119  , ELsev_highestSeverity // threshold use only
120  // -----
121  , nLevels // how many levels?
122  }; // ELsev_
123 
124  // ----- Birth/death:
125  //
127  ELseverityLevel ( ELstring const & str );
128  // str may match getSymbol, getName, getInputStr,
129  // or getVarName -- see accessors
131 
132  // ----- Comparator:
133  //
134  int cmp( ELseverityLevel const & e ) const;
135 
136  // ----- Accessors:
137  //
138  int getLevel() const;
139  const ELstring getSymbol() const; // example: "-e"
140  const ELstring getName() const; // example: "Error"
141  const ELstring getInputStr() const; // example: "ERROR"
142  const ELstring getVarName() const; // example: "ELerror"
143 
144  // ----- Emitter:
145  //
146  friend std::ostream & operator<< (
147  std::ostream & os
148  , const ELseverityLevel & sev
149  );
150 
151 private:
152 
153  // Data per ELseverityLevel object:
154  //
155  int myLevel;
156 
157 }; // ELseverityLevel
158 
159 
160 #ifndef __ROOTCLING__
161 // ----------------------------------------------------------------------
162 // Declare the globally available severity objects,
163 // one generator function and one proxy per non-default ELsev_:
164 // ----------------------------------------------------------------------
165 
168 
169 extern ELslGen ELdebugGen;
170 extern ELslProxy< ELdebugGen > const ELdebug;
171 
172 extern ELslGen ELinfoGen;
173 extern ELslProxy< ELinfoGen > const ELinfo;
174 
175 extern ELslGen ELwarningGen;
177 
178 extern ELslGen ELerrorGen;
179 extern ELslProxy< ELerrorGen > const ELerror;
180 
183 
184 extern ELslGen ELsevereGen;
186 
189 #else
192 ELseverityLevel const ELinfo;
198 #endif
199 
200 
201 // ----------------------------------------------------------------------
202 // Comparators:
203 // ----------------------------------------------------------------------
204 
205 extern bool operator== ( ELseverityLevel const & e1
206  , ELseverityLevel const & e2 );
207 extern bool operator!= ( ELseverityLevel const & e1
208  , ELseverityLevel const & e2 );
209 extern bool operator< ( ELseverityLevel const & e1
210  , ELseverityLevel const & e2 );
211 extern bool operator<= ( ELseverityLevel const & e1
212  , ELseverityLevel const & e2 );
213 extern bool operator> ( ELseverityLevel const & e1
214  , ELseverityLevel const & e2 );
215 extern bool operator>= ( ELseverityLevel const & e1
216  , ELseverityLevel const & e2 );
217 
218 
219 // ----------------------------------------------------------------------
220 
221 } // end of namespace edm
222 
223 
224 // ----------------------------------------------------------------------
225 
226 #ifndef __ROOTCLING__
227 #define ELSEVERITYLEVEL_ICC
228  #include "FWCore/MessageLogger/interface/ELseverityLevel.icc"
229 #undef ELSEVERITYLEVEL_ICC
230 #endif
231 
232 
233 // ----------------------------------------------------------------------
234 
235 #endif // MessageLogger_ELseverityLevel_h
236 
ELslGen ELinfoGen
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:90
ELslProxy< ELdebugGen > const ELdebug
ELslGen ELzeroSeverityGen
int cmp(ELseverityLevel const &e) const
const ELstring getVarName() const
ELslGen ELerrorGen
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
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:371
ELslGen ELdebugGen
int getLevel() const
ELslProxy const & operator=(ELslProxy const &)
ELseverityLevel const ELslGen()
const ELstring getSymbol() const
bool operator>=(View< T > const &, View< T > const &)
Definition: View.h:383
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
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:377
const ELstring getSymbol() const
Float e1
Definition: deltaR.h:20
ELslGen ELhighestSeverityGen
ELslProxy< ELinfoGen > const ELinfo
ELslProxy< ELsevereGen > const ELsevere
friend std::ostream & operator<<(std::ostream &os, const ELseverityLevel &sev)
Float e2
Definition: deltaR.h:21
ELslGen ELunspecifiedGen
ELslGen ELsevereGen
std::string ELstring
Definition: ELstring.h:26
const ELstring getInputStr() const