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