| # 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
StatusCode.cpp
Go to the documentation of this file.
1 #define GAUDIKERNEL_STATUSCODE_CPP 1
2
3 #include "GaudiKernel/StatusCode.h"
4 #include "GaudiKernel/System.h"
5 #include "GaudiKernel/Bootstrap.h"
6 #include "GaudiKernel/IMessageSvc.h"
7 #include "GaudiKernel/IStatusCodeSvc.h"
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/MsgStream.h"
10 #include "GaudiKernel/IssueSeverity.h"
11 #include <fstream>
12 #include <iostream>
13 #include <sstream>
14 #include <stdlib.h>
15 #include <exception>
16
17 bool StatusCode::s_checking(false);
18
19 void StatusCode::enableChecking() {
20 s_checking = true;
21 }
22
23 void StatusCode::disableChecking() {
24 s_checking = false;
25 }
26
27 const IssueSeverity& StatusCode::severity() const {
28 static IssueSeverity dummy;
29 if (m_severity) return *m_severity;
30 else return dummy;
31 }
32
33 StatusCode::~StatusCode() {
34 if(UNLIKELY(s_checking)) {
35
36 if (!m_checked && !GaudiException::s_proc && !std::uncaught_exception() ) {
37
38 SmartIF<IMessageSvc> msg(Gaudi::svcLocator());
39
40 SmartIF<IStatusCodeSvc> scs(Gaudi::svcLocator()->service("StatusCodeSvc"));
41
42 const size_t depth = 21;
43 void* addresses[depth];
44
45 std::string lib, fnc;
46 void* addr = 0;
48 if (System::backTrace(addresses, depth)) {
49
50 if (System::getStackLevel(addresses[2], addr, fnc, lib)) {
51
52 if (scs) {
53 scs->regFnc(fnc,lib);
54 } else {
55 if (msg) {
56 MsgStream log(msg,"StatusCode");
57 log << MSG::WARNING << "Unchecked in " << fnc << " " << lib << endmsg;
58 } else {
59 std::cout << MSG::WARNING << "Unchecked in " << fnc << " " << lib << std::endl;
60 }
61 }
62
63 }
64
65 }
66 }
67 }
68 }
69