Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Guards.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 // STD & STL
5 // ============================================================================
6 #include <exception>
7 // ============================================================================
8 // GaudiKernel
9 // ============================================================================
11 #include "GaudiKernel/Guards.h"
12 #include "GaudiKernel/MsgStream.h"
13 #include "GaudiKernel/System.h"
14 // ============================================================================
21 // ============================================================================
22 // Local handle (print) of GaudiException
23 // ============================================================================
25  // the general printout
26  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << "('" << exc.tag() << "') is caught!" << endmsg;
27  // print the detailes about the exception:
28  log << MSG::ERROR << exc << endmsg;
29  // get the status code form the exception:
30  m_sc = exc.code();
31 }
32 // ============================================================================
33 // Local handle (print) of std::exception
34 // ============================================================================
36  // the general printout
37  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << " is caught!" << endmsg;
38  // print the detailes abotu the exception:
39  log << MSG::ERROR << exc.what() << endmsg;
40 }
41 // ============================================================================
42 // Local handle (print) of unknown exception
43 // ============================================================================
45  // the general printout
46  log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg;
47 }
48 // ============================================================================
49 // dectructor
50 // ============================================================================
52 // ============================================================================
53 // constructor with standard post-action
54 // ============================================================================
56  : m_obj( obj ), m_svc( svc ), m_evt( evt ) {
57  i_before();
58 }
60  : m_obj( obj )
61  , m_svc( svc )
62  , m_evt( IAuditor::Initialize )
63  , // Windows needs an explicit value
64  m_cevt( std::move( evt ) )
65  , m_customEvtType( true ) {
66  i_before();
67 }
69  const StatusCode& sc )
70  : m_obj( obj ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false ) {
71  i_before();
72 }
74  const StatusCode& sc )
75  : m_obj( obj )
76  , m_svc( svc )
77  , m_evt( IAuditor::Initialize )
78  , // Windows needs an explicit value
79  m_cevt( std::move( evt ) )
80  , m_sc( &sc )
81  , m_customEvtType( true ) {
82  i_before();
83 }
85  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_customEvtType( false ) {
86  i_before();
87 }
89  : m_objName( std::move( name ) )
90  , m_svc( svc )
91  , m_evt( IAuditor::Initialize )
92  , // Windows needs an explicit value
93  m_cevt( std::move( evt ) )
94  , m_customEvtType( true ) {
95  i_before();
96 }
98  const StatusCode& sc )
99  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false ) {
100  i_before();
101 }
103  const StatusCode& sc )
104  : m_objName( std::move( name ) )
105  , m_svc( svc )
106  , m_evt( IAuditor::Initialize )
107  , // Windows needs an explicit value
108  m_cevt( std::move( evt ) )
109  , m_sc( &sc )
110  , m_customEvtType( true ) {
111  i_before();
112 }
113 // ============================================================================
114 // destructor
115 // ============================================================================
117 // ============================================================================
119 // ============================================================================
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:24
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
IAuditor::StandardEventType m_evt
Event type (standard events)
Definition: Guards.h:245
Define general base for Gaudi exception.
SmartIF< IAuditor > m_svc
auditor service
Definition: Guards.h:243
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:24
IAuditor::CustomEventType m_cevt
Event type (custom events)
Definition: Guards.h:247
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:309
STL namespace.
~ExceptionGuard()
destructor
Definition: Guards.cpp:51
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:158
virtual const StatusCode & code() const
StatusCode for Exception.
STL class.
INamedInterface * m_obj
the guarded object
Definition: Guards.h:239
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
virtual const std::string & tag() const
name tag for the exception, or exception type
STL class.
std::string m_objName
the guarded object name (if there is no INamedInterface)
Definition: Guards.h:241
IInterface compliant class extending IInterface with the name() method.
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
~AuditorGuard()
dectructor
Definition: Guards.cpp:116
const StatusCode * m_sc
Pointer to a status code instance, to be passed to the "after" function if needed The instance must h...
Definition: Guards.h:251
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
bool m_customEvtType
Flag to remember which event type was used.
Definition: Guards.h:253
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
evt
Definition: IOTest.py:94