| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IssueSeverity.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_ISSUESEVERITY_H
2 #define GAUDIKERNEL_ISSUESEVERITY_H 1
3
4 class StatusCode;
5
6 #include <string>
7 #include <map>
8 #include <iostream>
9
10 #include "GaudiKernel/Kernel.h"
11
12 #define ISSUE(x,y) IssueSeverity(x,__LINE__,__FILE__,y)
13 #define STATUSCODE(z,x,y) StatusCode(z,ISSUE(x,y))
14
15 class IIssueLogger;
16
17 // namespace IS {
18 // enum Level {
19 // NIL = 0,
20 // VERBOSE,
21 // DEBUG,
22 // DEBUG1,
23 // DEBUG2,
24 // DEBUG3,
25 // INFO,
26 // WARNING,
27 // RECOVERABLE,
28 // ERROR,
29 // FATAL,
30 // ALWAYS,
31 // NUM_LEVELS
32 // };
33 // }
34
35
36 #ifdef _WIN32
37 #ifdef ERROR
38 #undef ERROR
39 #endif
40 #endif
41
42 class GAUDI_API IssueSeverity {
43
44 public:
45
46 enum Level {
47 NIL = 0,
48 VERBOSE,
49 DEBUG,
50 DEBUG1,
51 DEBUG2,
52 DEBUG3,
53 INFO,
54 WARNING,
55 RECOVERABLE,
56 ERROR,
57 FATAL,
58 ALWAYS,
59 NUM_LEVELS
60 };
61
62 IssueSeverity();
63 IssueSeverity( const IssueSeverity::Level &level, int line,
64 const std::string& file,
65 const std::string& msg="");
66 IssueSeverity( const IssueSeverity::Level &level, const std::string& msg="");
67
68 IssueSeverity( const IssueSeverity& es );
69 IssueSeverity( IssueSeverity* es );
70
71 IssueSeverity& operator=(const IssueSeverity& rhs);
72
73 ~IssueSeverity();
74
75 void setLevel(const IssueSeverity::Level& l) {
76 m_level = l;
77 }
78 void setMsg(const std::string& m) {
79 m_msg = m;
80 }
81
82 IssueSeverity::Level getLevel() const { return m_level; }
83 std::string getMsg() const { return m_msg; }
84 std::string getOrigin() const;
85
86 void report();
87
88 operator StatusCode() const;
89
90 friend inline std::ostream& operator<< ( std::ostream&,
91 const IssueSeverity& ) ;
92
93 private:
94
95 int m_line;
96 std::string m_file;
97
98 static bool m_init;
99 static IIssueLogger* m_ers;
100
101 IssueSeverity::Level m_level;
102 std::string m_msg;
103 bool m_reported;
104
105 static void init();
106
107 };
108
109 inline IssueSeverity::IssueSeverity(): m_line(0), m_file(""),
110 m_level(IssueSeverity::NIL),
111 m_msg(""), m_reported(true) {}
112
113 inline IssueSeverity::IssueSeverity(const IssueSeverity::Level &level, int line,
114 const std::string& file,
115 const std::string& msg):
116 m_line(line), m_file(file), m_level(level), m_msg(msg), m_reported(false) {
117
118 init();
119 report();
120
121 }
122
123 inline IssueSeverity::IssueSeverity(const IssueSeverity::Level &level,
124 const std::string& msg):
125 m_line(0), m_file("??"), m_level(level), m_msg(msg), m_reported(false) {
126
127 init();
128 report();
129
130 }
131
132 inline IssueSeverity::IssueSeverity( const IssueSeverity& rhs ) {
133 m_line = rhs.m_line;
134 m_file = rhs.m_file;
135 m_level = rhs.m_level;
136 m_msg = rhs.m_msg;
137 m_reported = true;
138 }
139
140 inline IssueSeverity::IssueSeverity( IssueSeverity* rhs ) {
141 m_line = rhs->m_line;
142 m_file = rhs->m_file;
143 m_level = rhs->m_level;
144 m_msg = rhs->m_msg;
145 m_reported = true;
146 }
147
148 inline IssueSeverity& IssueSeverity::operator=(const IssueSeverity& rhs) {
149 m_line = rhs.m_line;
150 m_file = rhs.m_file;
151 m_level = rhs.m_level;
152 m_msg = rhs.m_level;
153 m_reported = true;
154 return *this;
155 }
156
157 std::ostream& operator<< ( std::ostream& os , const IssueSeverity& rhs ) {
158 os << "ISSUE: level " << rhs.getLevel() << " from: " << rhs.getOrigin()
159 << " msg: " << rhs.getMsg();
160 return os;
161 }
162
163
164 #endif