| The Gaudi Framework v29r1 (5cd95fa2)

- 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 <iostream>
7 #include <map>
8 #include <string>
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 #ifdef _WIN32
18 #ifdef ERROR
19 #undef ERROR
20 #endif
21 #endif
22
23 class GAUDI_API IssueSeverity final
24 {
25
26 public:
27 enum Level {
28 NIL = 0,
29 VERBOSE,
30 DEBUG,
31 DEBUG1,
32 DEBUG2,
33 DEBUG3,
34 INFO,
35 WARNING,
36 RECOVERABLE,
37 ERROR,
38 FATAL,
39 ALWAYS,
40 NUM_LEVELS
41 };
42
43 IssueSeverity() {}
44 IssueSeverity( IssueSeverity::Level level, int line, std::string file, std::string msg = "" );
45 IssueSeverity( IssueSeverity::Level level, std::string msg = "" );
46
47 IssueSeverity( const IssueSeverity& ) = delete;
48 IssueSeverity& operator=( const IssueSeverity& ) = delete;
49 IssueSeverity( IssueSeverity&& ) noexcept;
50 IssueSeverity& operator=( IssueSeverity&& ) noexcept;
51
52 ~IssueSeverity();
53
54 void setLevel( const IssueSeverity::Level& l ) { m_level = l; }
55 void setMsg( std::string m ) { m_msg = std::move( m ); }
56
57 IssueSeverity::Level getLevel() const { return m_level; }
58 std::string getMsg() const { return m_msg; }
59 std::string getOrigin() const;
60
61 void report();
62
63 friend inline std::ostream& operator<<( std::ostream&, const IssueSeverity& );
64
65 private:
66 std::string m_file;
67 std::string m_msg;
68
69 int m_line = 0;
70 IssueSeverity::Level m_level = IssueSeverity::NIL;
71 bool m_reported = true;
72
73 static bool m_init;
74 static IIssueLogger* m_ers;
75 };
76
77 inline IssueSeverity::IssueSeverity( IssueSeverity::Level level, int line, std::string file, std::string msg )
78 : m_file( std::move( file ) ), m_msg( std::move( msg ) ), m_line( line ), m_level( level ), m_reported( false )
79 {
80 report();
81 }
82
83 inline IssueSeverity::IssueSeverity( IssueSeverity::Level level, std::string msg )
84 : IssueSeverity( std::move( level ), 0, "??", std::move( msg ) )
85 {
86 }
87
88 inline IssueSeverity::IssueSeverity( IssueSeverity&& rhs ) noexcept
89 {
90 m_file = std::move( rhs.m_file );
91 m_msg = std::move( rhs.m_msg );
92 m_line = rhs.m_line;
93 m_level = rhs.m_level;
94 m_reported = std::exchange( rhs.m_reported, true );
95 }
96
97 inline IssueSeverity& IssueSeverity::operator=( IssueSeverity&& rhs ) noexcept
98 {
99 m_file = std::move( rhs.m_file );
100 m_msg = std::move( rhs.m_msg );
101 m_line = rhs.m_line;
102 m_level = rhs.m_level;
103 m_reported = std::exchange( rhs.m_reported, true );
104 return *this;
105 }
106
107 std::ostream& operator<<( std::ostream& os, const IssueSeverity& rhs )
108 {
109 os << "ISSUE: level " << rhs.getLevel() << " from: " << rhs.getOrigin() << " msg: " << rhs.getMsg();
110 return os;
111 }
112
113 #endif
IssueSeverity::RECOVERABLE
Definition: IssueSeverity.h:36
IssueSeverity::operator<<
friend std::ostream & operator<<(std::ostream &, const IssueSeverity &)
Definition: IssueSeverity.h:107
IssueSeverity::m_init
static bool m_init
Definition: IssueSeverity.h:73
IssueSeverity::DEBUG1
Definition: IssueSeverity.h:31
IssueSeverity::DEBUG
Definition: IssueSeverity.h:30
Kernel.h
IssueSeverity::m_ers
static IIssueLogger * m_ers
Definition: IssueSeverity.h:74
IssueSeverity
Definition: IssueSeverity.h:23
IssueSeverity::report
void report()
Definition: IssueSeverity.cpp:22
IssueSeverity::getOrigin
std::string getOrigin() const
Definition: IssueSeverity.cpp:36
IssueSeverity::setLevel
void setLevel(const IssueSeverity::Level &l)
Definition: IssueSeverity.h:54
IssueSeverity::DEBUG2
Definition: IssueSeverity.h:32
std
STL namespace.
IssueSeverity::ERROR
Definition: IssueSeverity.h:37
IIssueLogger
Definition: IIssueLogger.h:8
IssueSeverity::IssueSeverity
IssueSeverity()
Definition: IssueSeverity.h:43
IssueSeverity::m_file
std::string m_file
Definition: IssueSeverity.h:66
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
std::string
STL class.
IssueSeverity::VERBOSE
Definition: IssueSeverity.h:29
operator<<
std::ostream & operator<<(std::ostream &os, const IssueSeverity &rhs)
Definition: IssueSeverity.h:107
IssueSeverity::Level
Level
Definition: IssueSeverity.h:27
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:94
IssueSeverity::m_msg
std::string m_msg
Definition: IssueSeverity.h:67
IssueSeverity::ALWAYS
Definition: IssueSeverity.h:39
MSG::NIL
Definition: IMessageSvc.h:16
IssueSeverity::m_level
IssueSeverity::Level m_level
Definition: IssueSeverity.h:70
std::move
T move(T...args)
IssueSeverity::FATAL
Definition: IssueSeverity.h:38
gaudirun.l
dictionary l
Definition: gaudirun.py:440
IssueSeverity::operator=
IssueSeverity & operator=(const IssueSeverity &)=delete
IssueSeverity::setMsg
void setMsg(std::string m)
Definition: IssueSeverity.h:55
IssueSeverity::m_line
int m_line
Definition: IssueSeverity.h:69
MSG::NUM_LEVELS
Definition: IMessageSvc.h:16
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
gaudirun.level
level
Definition: gaudirun.py:271
IssueSeverity::DEBUG3
Definition: IssueSeverity.h:33
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
std::ostream
STL class.
IssueSeverity::getLevel
IssueSeverity::Level getLevel() const
Definition: IssueSeverity.h:57
IssueSeverity::getMsg
std::string getMsg() const
Definition: IssueSeverity.h:58
IssueSeverity::NIL
Definition: IssueSeverity.h:28
plotSpeedupsPyRoot.line
line
Definition: plotSpeedupsPyRoot.py:172
IssueSeverity::m_reported
bool m_reported
Definition: IssueSeverity.h:71
IssueSeverity::INFO
Definition: IssueSeverity.h:34
IssueSeverity::WARNING
Definition: IssueSeverity.h:35