Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v29r3 (fa547fc2)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
StatusCode.cpp
Go to the documentation of this file.
1 #define GAUDIKERNEL_STATUSCODE_CPP 1
2 
9 #include "GaudiKernel/System.h"
10 #include <exception>
11 #include <fstream>
12 #include <iostream>
13 #include <sstream>
14 #include <stdlib.h>
15 
16 bool StatusCode::s_checking( false );
17 
19 
21 
23 
25 {
26 
28 
29  auto msg = Gaudi::svcLocator()->as<IMessageSvc>();
30  auto scs = Gaudi::svcLocator()->service<IStatusCodeSvc>( "StatusCodeSvc" );
31 
32  const size_t depth = 21;
33  void* addresses[depth];
34 
35  std::string lib, fnc;
36  void* addr = nullptr;
38  if ( System::backTrace( addresses, depth ) ) {
39 
40  for ( size_t idx : {2, 3} ) {
41  if ( System::getStackLevel( addresses[idx], addr, fnc, lib ) && fnc != "StatusCode::~StatusCode()" ) {
42 
43  if ( scs ) {
44  scs->regFnc( fnc, lib );
45  } else {
46  MsgStream log( msg, "StatusCode" );
47  log << MSG::WARNING << "Unchecked in " << fnc << " (" << lib << ")" << endmsg;
48  }
49  break;
50  }
51  }
52  }
53  }
54 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
void check()
Definition: StatusCode.cpp:24
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
bool m_checked
If the Status code has been checked.
Definition: StatusCode.h:155
static bool s_proc
"previous" element in the linked list
static GAUDI_API void enableChecking()
Definition: StatusCode.cpp:18
SmartIF< IFace > as()
Definition: ISvcLocator.h:109
static GAUDI_API bool checkingEnabled()
Definition: StatusCode.cpp:22
GAUDI_API int backTrace(void **addresses, const int depth)
STL class.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
GAUDI_API ISvcLocator * svcLocator()
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:38
static bool s_checking
Global flag to control if StatusCode need to be checked.
Definition: StatusCode.h:157
T uncaught_exception(T...args)
static GAUDI_API void disableChecking()
Definition: StatusCode.cpp:20
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209