| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- File List
- File Members

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 final {
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( IssueSeverity::Level level, int line,
64 std::string file,
65 std::string msg="");
66 IssueSeverity( IssueSeverity::Level level, std::string msg="");
67
68 IssueSeverity( const IssueSeverity& ) = delete;
69 IssueSeverity& operator=( const IssueSeverity& ) = delete;
70 IssueSeverity( IssueSeverity&& ) noexcept;
71 IssueSeverity& operator=(IssueSeverity&& ) noexcept;
72
73 ~IssueSeverity();
74
75 void setLevel(const IssueSeverity::Level& l) {
76 m_level = l;
77 }
78 void setMsg(std::string m) {
79 m_msg = std::move(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 friend inline std::ostream& operator<< ( std::ostream&,
89 const IssueSeverity& ) ;
90
91 private:
92
93 std::string m_file;
94 std::string m_msg;
95
96 int m_line = 0;
97 IssueSeverity::Level m_level = IssueSeverity::NIL;
98 bool m_reported = true;
99
100 static bool m_init;
101 static IIssueLogger* m_ers;
102
103
104 };
105
106
107 inline IssueSeverity::IssueSeverity(IssueSeverity::Level level, int line,
108 std::string file,
109 std::string msg):
110 m_file(std::move(file)),m_msg(std::move(msg)), m_line(line), m_level(level), m_reported(false) {
111 report();
112 }
113
114 inline IssueSeverity::IssueSeverity(IssueSeverity::Level level, std::string msg):
115 IssueSeverity(std::move(level),0,"??",std::move(msg)) { }
116
117 inline IssueSeverity::IssueSeverity( IssueSeverity&& rhs ) noexcept {
118 m_file = std::move(rhs.m_file);
119 m_msg = std::move(rhs.m_msg);
120 m_line = rhs.m_line;
121 m_level = rhs.m_level;
122 m_reported = rhs.m_reported;
123 rhs.m_reported = true;
124 }
125
126 inline IssueSeverity& IssueSeverity::operator=(IssueSeverity&& rhs) noexcept {
127 m_file = rhs.m_file;
128 m_msg = rhs.m_level;
129 m_line = rhs.m_line;
130 m_level = rhs.m_level;
131 m_reported = rhs.m_reported;
132 rhs.m_reported = true;
133 return *this;
134 }
135
136 std::ostream& operator<< ( std::ostream& os , const IssueSeverity& rhs ) {
137 os << "ISSUE: level " << rhs.getLevel() << " from: " << rhs.getOrigin()
138 << " msg: " << rhs.getMsg();
139 return os;
140 }
141
142
143 #endif
IssueSeverity::RECOVERABLE
Definition: IssueSeverity.h:55
IssueSeverity::operator<<
friend std::ostream & operator<<(std::ostream &, const IssueSeverity &)
Definition: IssueSeverity.h:136
IssueSeverity::m_init
static bool m_init
Definition: IssueSeverity.h:100
IssueSeverity::DEBUG1
Definition: IssueSeverity.h:50
IssueSeverity::DEBUG
Definition: IssueSeverity.h:49
Kernel.h
IssueSeverity::m_ers
static IIssueLogger * m_ers
Definition: IssueSeverity.h:101
IssueSeverity
Definition: IssueSeverity.h:42
IssueSeverity::report
void report()
Definition: IssueSeverity.cpp:24
IssueSeverity::getOrigin
std::string getOrigin() const
Definition: IssueSeverity.cpp:38
IssueSeverity::setLevel
void setLevel(const IssueSeverity::Level &l)
Definition: IssueSeverity.h:75
IssueSeverity::DEBUG2
Definition: IssueSeverity.h:51
std
STL namespace.
IssueSeverity::ERROR
Definition: IssueSeverity.h:56
IIssueLogger
Definition: IIssueLogger.h:9
IssueSeverity::IssueSeverity
IssueSeverity()
Definition: IssueSeverity.h:62
IssueSeverity::m_file
std::string m_file
Definition: IssueSeverity.h:93
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
std::string
STL class.
IssueSeverity::VERBOSE
Definition: IssueSeverity.h:48
operator<<
std::ostream & operator<<(std::ostream &os, const IssueSeverity &rhs)
Definition: IssueSeverity.h:136
IssueSeverity::Level
Level
Definition: IssueSeverity.h:46
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:93
IssueSeverity::m_msg
std::string m_msg
Definition: IssueSeverity.h:94
IssueSeverity::ALWAYS
Definition: IssueSeverity.h:58
MSG::NIL
Definition: IMessageSvc.h:16
IssueSeverity::m_level
IssueSeverity::Level m_level
Definition: IssueSeverity.h:97
std::move
T move(T...args)
IssueSeverity::FATAL
Definition: IssueSeverity.h:57
gaudirun.l
dictionary l
Definition: gaudirun.py:421
IssueSeverity::operator=
IssueSeverity & operator=(const IssueSeverity &)=delete
IssueSeverity::setMsg
void setMsg(std::string m)
Definition: IssueSeverity.h:78
IssueSeverity::m_line
int m_line
Definition: IssueSeverity.h:96
MSG::NUM_LEVELS
Definition: IMessageSvc.h:24
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
gaudirun.level
level
Definition: gaudirun.py:261
IssueSeverity::DEBUG3
Definition: IssueSeverity.h:52
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
std::ostream
STL class.
IssueSeverity::getLevel
IssueSeverity::Level getLevel() const
Definition: IssueSeverity.h:82
IssueSeverity::getMsg
std::string getMsg() const
Definition: IssueSeverity.h:83
IssueSeverity::NIL
Definition: IssueSeverity.h:47
plotSpeedupsPyRoot.line
line
Definition: plotSpeedupsPyRoot.py:164
IssueSeverity::m_reported
bool m_reported
Definition: IssueSeverity.h:98
IssueSeverity::INFO
Definition: IssueSeverity.h:53
IssueSeverity::WARNING
Definition: IssueSeverity.h:54