Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v28r2p1 (f1a77ff4)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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 final {
43 
44 public:
45 
46  enum Level {
47  NIL = 0,
60  };
61 
64  std::string file,
65  std::string msg="");
67 
68  IssueSeverity( const IssueSeverity& ) = delete;
69  IssueSeverity& operator=( const IssueSeverity& ) = delete;
70  IssueSeverity( IssueSeverity&& ) noexcept;
72 
73  ~IssueSeverity();
74 
76  m_level = l;
77  }
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 
95 
96  int m_line = 0;
98  bool m_reported = true;
99 
100  static bool m_init;
102 
103 
104 };
105 
106 
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 
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 
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 
137  os << "ISSUE: level " << rhs.getLevel() << " from: " << rhs.getOrigin()
138  << " msg: " << rhs.getMsg();
139  return os;
140 }
141 
142 
143 #endif
friend std::ostream & operator<<(std::ostream &, const IssueSeverity &)
static bool m_init
static IIssueLogger * m_ers
std::string getOrigin() const
void setLevel(const IssueSeverity::Level &l)
Definition: IssueSeverity.h:75
STL namespace.
std::string m_file
Definition: IssueSeverity.h:93
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
std::ostream & operator<<(std::ostream &os, const IssueSeverity &rhs)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
constexpr double m
Definition: SystemOfUnits.h:93
std::string m_msg
Definition: IssueSeverity.h:94
IssueSeverity::Level m_level
Definition: IssueSeverity.h:97
T move(T...args)
dictionary l
Definition: gaudirun.py:421
IssueSeverity & operator=(const IssueSeverity &)=delete
void setMsg(std::string m)
Definition: IssueSeverity.h:78
#define GAUDI_API
Definition: Kernel.h:107
STL class.
IssueSeverity::Level getLevel() const
Definition: IssueSeverity.h:82
std::string getMsg() const
Definition: IssueSeverity.h:83