test
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_success // report reaching a milestone
112  , ELsev_info // information
113  , ELsev_warning // warning
114  , ELsev_error // error detected
115  , ELsev_unspecified // severity was not specified
116  , ELsev_severe // future results are suspect
117  , ELsev_highestSeverity // threshold use only
118  // -----
119  , nLevels // how many levels?
120  }; // ELsev_
121 
122  // ----- Birth/death:
123  //
125  ELseverityLevel ( ELstring const & str );
126  // str may match getSymbol, getName, getInputStr,
127  // or getVarName -- see accessors
129 
130  // ----- Comparator:
131  //
132  int cmp( ELseverityLevel const & e ) const;
133 
134  // ----- Accessors:
135  //
136  int getLevel() const;
137  const ELstring getSymbol() const; // example: "-e"
138  const ELstring getName() const; // example: "Error"
139  const ELstring getInputStr() const; // example: "ERROR"
140  const ELstring getVarName() const; // example: "ELerror"
141 
142  // ----- Emitter:
143  //
144  friend std::ostream & operator<< (
145  std::ostream & os
146  , const ELseverityLevel & sev
147  );
148 
149 private:
150 
151  // Data per ELseverityLevel object:
152  //
153  int myLevel;
154 
155 }; // ELseverityLevel
156 
157 
158 // ----------------------------------------------------------------------
159 // Declare the globally available severity objects,
160 // one generator function and one proxy per non-default ELsev_:
161 // ----------------------------------------------------------------------
162 
165 
166 extern ELslGen ELdebugGen;
167 extern ELslProxy< ELdebugGen > const ELdebug;
168 
169 extern ELslGen ELinfoGen;
170 extern ELslProxy< ELinfoGen > const ELinfo;
171 
172 extern ELslGen ELwarningGen;
174 
175 extern ELslGen ELerrorGen;
176 extern ELslProxy< ELerrorGen > const ELerror;
177 
180 
181 extern ELslGen ELsevereGen;
183 
186 
187 
188 // ----------------------------------------------------------------------
189 // Comparators:
190 // ----------------------------------------------------------------------
191 
192 extern bool operator== ( ELseverityLevel const & e1
193  , ELseverityLevel const & e2 );
194 extern bool operator!= ( ELseverityLevel const & e1
195  , ELseverityLevel const & e2 );
196 extern bool operator< ( ELseverityLevel const & e1
197  , ELseverityLevel const & e2 );
198 extern bool operator<= ( ELseverityLevel const & e1
199  , ELseverityLevel const & e2 );
200 extern bool operator> ( ELseverityLevel const & e1
201  , ELseverityLevel const & e2 );
202 extern bool operator>= ( ELseverityLevel const & e1
203  , ELseverityLevel const & e2 );
204 
205 
206 // ----------------------------------------------------------------------
207 
208 } // end of namespace edm
209 
210 
211 // ----------------------------------------------------------------------
212 
213 #define ELSEVERITYLEVEL_ICC
214  #include "FWCore/MessageLogger/interface/ELseverityLevel.icc"
215 #undef ELSEVERITYLEVEL_ICC
216 
217 
218 // ----------------------------------------------------------------------
219 
220 #endif // MessageLogger_ELseverityLevel_h
221 
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:387
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:399
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:393
const ELstring getSymbol() const
ELslGen ELhighestSeverityGen
ELslProxy< ELinfoGen > const ELinfo
ELslProxy< ELsevereGen > const ELsevere
friend std::ostream & operator<<(std::ostream &os, const ELseverityLevel &sev)
ELslGen ELunspecifiedGen
ELslGen ELsevereGen
std::string ELstring
Definition: ELstring.h:26
const ELstring getInputStr() const