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 
43 
44 public:
45 
46  enum Level {
47  NIL = 0,
60  };
61 
62  IssueSeverity();
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 );
70 
71  IssueSeverity& operator=(const IssueSeverity& rhs);
72 
73  ~IssueSeverity();
74 
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;
100 
102  std::string m_msg;
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 
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 
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 
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 
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 
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
static bool m_init
Definition: IssueSeverity.h:98
static IIssueLogger * m_ers
Definition: IssueSeverity.h:99
static void init()
std::string getOrigin() const
void setLevel(const IssueSeverity::Level &l)
Definition: IssueSeverity.h:75
std::string m_file
Definition: IssueSeverity.h:96
std::ostream & operator<<(std::ostream &os, const IssueSeverity &rhs)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::string m_msg
void setMsg(const std::string &m)
Definition: IssueSeverity.h:78
IssueSeverity::Level m_level
list file
Definition: ana.py:160
IssueSeverity & operator=(const IssueSeverity &rhs)
dictionary l
Definition: gaudirun.py:365
#define GAUDI_API
Definition: Kernel.h:108
IssueSeverity::Level getLevel() const
Definition: IssueSeverity.h:82
std::string getMsg() const
Definition: IssueSeverity.h:83
int line
Definition: ana.py:50