CMS 3D CMS Logo

ELseverityLevel.h
Go to the documentation of this file.
1 #ifndef MessageLogger_ELseverityLevel_h
2 #define MessageLogger_ELseverityLevel_h
3 
4 // ----------------------------------------------------------------------
5 //
6 // ELseverityLevel.h - declare objects that encode a message's urgency
7 //
8 // Both frameworker and user will often pass one of the
9 // instantiated severity levels to logger methods.
10 //
11 // The only other methods of ELseverityLevel a frameworker
12 // might use is to check the relative level of two severities
13 // using operator< or the like.
14 //
15 // 30-Jun-1998 mf Created file.
16 // 26-Aug-1998 WEB Made ELseverityLevel object less weighty.
17 // 16-Jun-1999 mf Added constructor from string.
18 // 23-Jun-1999 mf Additional ELsev_noValueAssigned to allow constructor
19 // from string to give ELunspecified when not found, while
20 // still allowing finding zero severity.
21 // 23-Jun-1999 mf Corrections for subtleties in initialization of
22 // global symbols:
23 // Added ELsevLevGlobals array
24 // Changed extern consts of SLseverityLevels into
25 // const ELseverityLevel & 's
26 // Inserted class ELinitializeGlobalSeverityObjects
27 // in place of the
28 // initializeGlobalSeverityObjects() function.
29 // Changed globalSeverityObjectsGuarantor to an
30 // ELinitializeGlobalSeverityObjects instance.
31 // 30-Jun-1999 mf Modifications to eliminate problems with order of
32 // globals initializations:
33 // translate(), getInputStr(), getVarName()
34 // 12-Jun-2000 web Final fix to global static initialization problem
35 // 14-Jun-2000 web Declare classes before granting friendship.
36 // 27-Jun-2000 web Fix order-of-static-destruction problem
37 //
38 // ----------------------------------------------------------------------
39 
40 #ifndef ELSTRING_H
42 #endif
43 
44 namespace edm {
45 
46  // ----------------------------------------------------------------------
47  // Forward declaration:
48  // ----------------------------------------------------------------------
49 
50  class ELseverityLevel;
51 
52 #ifndef __ROOTCLING__
53  // ----------------------------------------------------------------------
54  // Synonym for type of ELseverityLevel-generating function:
55  // ----------------------------------------------------------------------
56 
57  typedef ELseverityLevel const ELslGen();
58 
59  // ----------------------------------------------------------------------
60  // ELslProxy class template:
61  // ----------------------------------------------------------------------
62 
63  template <ELslGen ELgen>
64  struct ELslProxy {
65  // --- birth/death:
66  //
67  ELslProxy();
68  ~ELslProxy();
69 
70  // --- copying:
71  //
72  ELslProxy(ELslProxy const&);
73  ELslProxy const& operator=(ELslProxy const&);
74 
75  // --- conversion::
76  //
77  operator ELseverityLevel const() const;
78 
79  // --- forwarding:
80  //
81  int getLevel() const;
82  const ELstring getSymbol() const;
83  const ELstring getName() const;
84  const ELstring getInputStr() const;
85  const ELstring getVarName() const;
86 
87  }; // ELslProxy<ELslGen>
88 #endif
89 
90  // ----------------------------------------------------------------------
91 
92  // ----------------------------------------------------------------------
93  // ELseverityLevel:
94  // ----------------------------------------------------------------------
95 
97  public:
98  // --- One ELseverityLevel is globally instantiated (see below)
99  // --- for each of the following levels:
100  //
101  enum ELsev_ {
102  ELsev_noValueAssigned = 0 // default returned by map when not found
103  ,
104  ELsev_zeroSeverity // threshold use only
105  ,
106  ELsev_success // report reaching a milestone
107  ,
108  ELsev_info // information
109  ,
110  ELsev_warning // warning
111  ,
112  ELsev_error // error detected
113  ,
114  ELsev_unspecified // severity was not specified
115  ,
116  ELsev_severe // future results are suspect
117  ,
118  ELsev_highestSeverity // threshold use only
119  // -----
120  ,
121  nLevels // how many levels?
122  }; // ELsev_
123 
124  // ----- Birth/death:
125  //
126  ELseverityLevel(ELsev_ lev = ELsev_unspecified);
127  ELseverityLevel(ELstring const& str);
128  // str may match getSymbol, getName, getInputStr,
129  // or getVarName -- see accessors
130  ~ELseverityLevel();
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<<(std::ostream& os, const ELseverityLevel& sev);
147 
148  private:
149  // Data per ELseverityLevel object:
150  //
151  int myLevel;
152 
153  }; // ELseverityLevel
154 
155 #ifndef __ROOTCLING__
156  // ----------------------------------------------------------------------
157  // Declare the globally available severity objects,
158  // one generator function and one proxy per non-default ELsev_:
159  // ----------------------------------------------------------------------
160 
161  extern ELslGen ELzeroSeverityGen;
163 
164  extern ELslGen ELdebugGen;
165  extern ELslProxy<ELdebugGen> const ELdebug;
166 
167  extern ELslGen ELinfoGen;
168  extern ELslProxy<ELinfoGen> const ELinfo;
169 
170  extern ELslGen ELwarningGen;
171  extern ELslProxy<ELwarningGen> const ELwarning;
172 
173  extern ELslGen ELerrorGen;
174  extern ELslProxy<ELerrorGen> const ELerror;
175 
176  extern ELslGen ELunspecifiedGen;
178 
179  extern ELslGen ELsevereGen;
180  extern ELslProxy<ELsevereGen> const ELsevere;
181 
184 #else
186  ELseverityLevel const ELdebug;
187  ELseverityLevel const ELinfo;
189  ELseverityLevel const ELerror;
193 #endif
194 
195  // ----------------------------------------------------------------------
196  // Comparators:
197  // ----------------------------------------------------------------------
198 
199  extern bool operator==(ELseverityLevel const& e1, ELseverityLevel const& e2);
200  extern bool operator!=(ELseverityLevel const& e1, ELseverityLevel const& e2);
201  extern bool operator<(ELseverityLevel const& e1, ELseverityLevel const& e2);
202  extern bool operator<=(ELseverityLevel const& e1, ELseverityLevel const& e2);
203  extern bool operator>(ELseverityLevel const& e1, ELseverityLevel const& e2);
204  extern bool operator>=(ELseverityLevel const& e1, ELseverityLevel const& e2);
205 
206  // ----------------------------------------------------------------------
207 
208 } // end of namespace edm
209 
210 // ----------------------------------------------------------------------
211 
212 #ifndef __ROOTCLING__
213 #define ELSEVERITYLEVEL_ICC
214 #include "FWCore/MessageLogger/interface/ELseverityLevel.icc"
215 #undef ELSEVERITYLEVEL_ICC
216 #endif
217 
218 // ----------------------------------------------------------------------
219 
220 #endif // MessageLogger_ELseverityLevel_h
ELslGen ELinfoGen
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:92
ELslProxy< ELdebugGen > const ELdebug
ELslGen ELzeroSeverityGen
const ELstring getVarName() const
ELslGen ELerrorGen
ELslProxy< ELunspecifiedGen > const ELunspecified
ELslProxy< ELwarningGen > const ELwarning
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
bool operator<=(View< T > const &, View< T > const &)
Definition: View.h:376
ELslGen ELdebugGen
int getLevel() const
ELslProxy const & operator=(ELslProxy const &)
ELseverityLevel const ELslGen()
bool operator>=(View< T > const &, View< T > const &)
Definition: View.h:388
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
ELslProxy< ELerrorGen > const ELerror
ELslGen ELwarningGen
const ELstring getName() const
bool operator>(View< T > const &, View< T > const &)
Definition: View.h:382
const ELstring getSymbol() const
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
ELslGen ELhighestSeverityGen
ELslProxy< ELinfoGen > const ELinfo
ELslProxy< ELsevereGen > const ELsevere
HLT enums.
ELslGen ELunspecifiedGen
ELslGen ELsevereGen
#define str(s)
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
std::string ELstring
Definition: ELstring.h:21
const ELstring getInputStr() const