| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IssueSeverity.cpp
Go to the documentation of this file.
1 #define GAUDIKERNEL_ISSUESEVERITY_CPP 1
2
3 #include "GaudiKernel/IssueSeverity.h"
4 #include "GaudiKernel/StatusCode.h"
5 #include "GaudiKernel/IIssueLogger.h"
6 #include "GaudiKernel/System.h"
7 #include "GaudiKernel/Bootstrap.h"
8 #include "GaudiKernel/ISvcLocator.h"
9
10 #include <sstream>
11
12 bool IssueSeverity::m_init(false);
13 IIssueLogger* IssueSeverity::m_ers(0);
14
15 void IssueSeverity::init() {
16 if (!m_init) {
17 m_init = true;
18 m_ers = Gaudi::svcLocator()->service<IIssueLogger>("IssueLogger").get();
19 }
20 }
21
22 IssueSeverity::~IssueSeverity() {
23
24 if (!m_reported) {
25 report();
26 // do stuff
27 }
28
29 }
30
31 void
32 IssueSeverity::report() {
33
34 if (m_ers != 0) {
35 m_ers->report(this);
36 } else {
37 std::cerr << *this << std::endl;
38 }
39 m_reported = true;
40
41 }
42
43
44 std::string
45 IssueSeverity::getOrigin() const {
46 std::ostringstream ost;
47 ost << m_file << ":" << m_line;
48 return ost.str();
49 }
50
51 IssueSeverity::operator StatusCode() const {
52 if (m_level == IssueSeverity::RECOVERABLE) {
53 return StatusCode(StatusCode::RECOVERABLE, *this);
54 } else if (m_level < IssueSeverity::ERROR) {
55 return StatusCode(StatusCode::SUCCESS, *this);
56 } else {
57 return StatusCode(StatusCode::FAILURE, *this);
58 }
59 }