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  //
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<<(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
edm::ELzeroSeverityGen
ELslGen ELzeroSeverityGen
edm::ELseverityLevel::ELsev_highestSeverity
Definition: ELseverityLevel.h:118
edm::ELseverityLevel::ELsev_zeroSeverity
Definition: ELseverityLevel.h:104
edm::ELseverityLevel::getLevel
int getLevel() const
Definition: ELseverityLevel.cc:123
edm::ELseverityLevel::operator<<
friend std::ostream & operator<<(std::ostream &os, const ELseverityLevel &sev)
Definition: ELseverityLevel.cc:273
edm::ELwarning
const ELslProxy< ELwarningGen > ELwarning
Definition: ELseverityLevel.cc:302
edm::ELseverityLevel::getVarName
const ELstring getVarName() const
Definition: ELseverityLevel.cc:233
edm::ELslProxy::getInputStr
const ELstring getInputStr() const
edm::ELslProxy::getVarName
const ELstring getVarName() const
edm::ELslProxy::getName
const ELstring getName() const
edm::ELseverityLevel::ELsev_
ELsev_
Definition: ELseverityLevel.h:101
edm::ELzeroSeverity
const ELslProxy< ELzeroSeverityGen > ELzeroSeverity
Definition: ELseverityLevel.cc:284
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ELerrorGen
ELslGen ELerrorGen
edm::ELinfoGen
ELslGen ELinfoGen
edm::ELslProxy::operator=
ELslProxy const & operator=(ELslProxy const &)
edm::ELseverityLevel::~ELseverityLevel
~ELseverityLevel()
Definition: ELseverityLevel.cc:111
edm::ELseverityLevel::getSymbol
const ELstring getSymbol() const
Definition: ELseverityLevel.cc:125
edm::ELwarningGen
ELslGen ELwarningGen
edm::ELseverityLevel::ELsev_severe
Definition: ELseverityLevel.h:116
edm::ELslProxy::ELslProxy
ELslProxy()
edm::ELslProxy
Definition: ELseverityLevel.h:64
edm::ELslProxy::getSymbol
const ELstring getSymbol() const
edm::ELseverityLevel::getInputStr
const ELstring getInputStr() const
Definition: ELseverityLevel.cc:197
edm::ELstring
std::string ELstring
Definition: ELstring.h:21
edm::operator!=
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:75
edm::operator==
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:72
edm::operator<
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
str
#define str(s)
Definition: TestProcessor.cc:48
edm::ELsevereGen
ELslGen ELsevereGen
edm::ELseverityLevel::ELsev_error
Definition: ELseverityLevel.h:112
edm::operator<=
bool operator<=(View< T > const &, View< T > const &)
Definition: View.h:320
edm::operator>
bool operator>(View< T > const &, View< T > const &)
Definition: View.h:325
edm::ELseverityLevel::ELsev_unspecified
Definition: ELseverityLevel.h:114
edm::ELsevere
const ELslProxy< ELsevereGen > ELsevere
Definition: ELseverityLevel.cc:320
edm::ELdebug
const ELslProxy< ELdebugGen > ELdebug
Definition: ELseverityLevel.cc:290
edm::ELslProxy::getLevel
int getLevel() const
edm::ELseverityLevel::ELsev_warning
Definition: ELseverityLevel.h:110
edm::ELhighestSeverity
const ELslProxy< ELhighestSeverityGen > ELhighestSeverity
Definition: ELseverityLevel.cc:326
edm::ELslProxy::~ELslProxy
~ELslProxy()
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
edm::ELseverityLevel::nLevels
Definition: ELseverityLevel.h:121
edm::ELseverityLevel::ELsev_success
Definition: ELseverityLevel.h:106
edm::ELseverityLevel
Definition: ELseverityLevel.h:96
edm::ELseverityLevel::ELsev_noValueAssigned
Definition: ELseverityLevel.h:102
edm::ELslGen
const ELseverityLevel ELslGen()
Definition: ELseverityLevel.h:57
edm::ELseverityLevel::getName
const ELstring getName() const
Definition: ELseverityLevel.cc:161
edm::operator>=
bool operator>=(View< T > const &, View< T > const &)
Definition: View.h:330
edm::ELerror
const ELslProxy< ELerrorGen > ELerror
Definition: ELseverityLevel.cc:308
edm::ELhighestSeverityGen
ELslGen ELhighestSeverityGen
edm::ELseverityLevel::myLevel
int myLevel
Definition: ELseverityLevel.h:151
edm::ELunspecifiedGen
ELslGen ELunspecifiedGen
edm::ELseverityLevel::cmp
int cmp(ELseverityLevel const &e) const
Definition: ELseverityLevel.cc:117
edm::ELinfo
const ELslProxy< ELinfoGen > ELinfo
Definition: ELseverityLevel.cc:296
ELstring.h
edm::ELseverityLevel::ELseverityLevel
ELseverityLevel(ELsev_ lev=ELsev_unspecified)
Definition: ELseverityLevel.cc:98
edm::ELunspecified
const ELslProxy< ELunspecifiedGen > ELunspecified
Definition: ELseverityLevel.cc:314
edm::ELdebugGen
ELslGen ELdebugGen
edm::ELseverityLevel::ELsev_info
Definition: ELseverityLevel.h:108
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37