The Gaudi Framework  v28r3 (cc1cf868)
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 
18 #ifdef _WIN32
19 #ifdef ERROR
20 #undef ERROR
21 #endif
22 #endif
23 
24 class GAUDI_API IssueSeverity final {
25 
26 public:
27 
28  enum Level {
29  NIL = 0,
42  };
43 
46  std::string file,
47  std::string msg="");
49 
50  IssueSeverity( const IssueSeverity& ) = delete;
51  IssueSeverity& operator=( const IssueSeverity& ) = delete;
52  IssueSeverity( IssueSeverity&& ) noexcept;
54 
55  ~IssueSeverity();
56 
58  m_level = l;
59  }
61  m_msg = std::move(m);
62  }
63 
64  IssueSeverity::Level getLevel() const { return m_level; }
65  std::string getMsg() const { return m_msg; }
66  std::string getOrigin() const;
67 
68  void report();
69 
70  friend inline std::ostream& operator<< ( std::ostream&,
71  const IssueSeverity& ) ;
72 
73 private:
74 
77 
78  int m_line = 0;
80  bool m_reported = true;
81 
82  static bool m_init;
84 
85 
86 };
87 
88 
90  std::string file,
92  m_file(std::move(file)),m_msg(std::move(msg)), m_line(line), m_level(level), m_reported(false) {
93  report();
94 }
95 
97  IssueSeverity(std::move(level),0,"??",std::move(msg)) { }
98 
99 inline IssueSeverity::IssueSeverity( IssueSeverity&& rhs ) noexcept {
100  m_file = std::move(rhs.m_file);
101  m_msg = std::move(rhs.m_msg);
102  m_line = rhs.m_line;
103  m_level = rhs.m_level;
104  m_reported = std::exchange( rhs.m_reported, true );
105 }
106 
108  m_file = std::move(rhs.m_file);
109  m_msg = std::move(rhs.m_msg);
110  m_line = rhs.m_line;
111  m_level = rhs.m_level;
112  m_reported = std::exchange( rhs.m_reported, true );
113  return *this;
114 }
115 
117  os << "ISSUE: level " << rhs.getLevel() << " from: " << rhs.getOrigin()
118  << " msg: " << rhs.getMsg();
119  return os;
120 }
121 
122 
123 #endif
friend std::ostream & operator<<(std::ostream &, const IssueSeverity &)
static bool m_init
Definition: IssueSeverity.h:82
static IIssueLogger * m_ers
Definition: IssueSeverity.h:83
std::string getOrigin() const
void setLevel(const IssueSeverity::Level &l)
Definition: IssueSeverity.h:57
STL namespace.
std::string m_file
Definition: IssueSeverity.h:75
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:76
IssueSeverity::Level m_level
Definition: IssueSeverity.h:79
T move(T...args)
dictionary l
Definition: gaudirun.py:421
IssueSeverity & operator=(const IssueSeverity &)=delete
void setMsg(std::string m)
Definition: IssueSeverity.h:60
#define GAUDI_API
Definition: Kernel.h:107
STL class.
IssueSeverity::Level getLevel() const
Definition: IssueSeverity.h:64
std::string getMsg() const
Definition: IssueSeverity.h:65