The Gaudi Framework  v30r3 (a5ef0a68)
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 {
26  // the general printout
27  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << "('" << exc.tag() << "') is caught!" << endmsg;
28  // print the detailes about the exception:
29  log << MSG::ERROR << exc << endmsg;
30  // get the status code form the exception:
31  m_sc = exc.code();
32 }
33 // ============================================================================
34 // Local handle (print) of std::exception
35 // ============================================================================
37 {
38  // the general printout
39  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << " is caught!" << endmsg;
40  // print the detailes abotu the exception:
41  log << MSG::ERROR << exc.what() << endmsg;
42 }
43 // ============================================================================
44 // Local handle (print) of unknown exception
45 // ============================================================================
47 {
48  // the general printout
49  log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg;
50 }
51 // ============================================================================
52 // dectructor
53 // ============================================================================
55 // ============================================================================
56 // constructor with standard post-action
57 // ============================================================================
59  : m_obj( obj ), m_svc( svc ), m_evt( evt )
60 {
61  i_before();
62 }
64  : m_obj( obj )
65  , m_svc( svc )
66  , m_evt( IAuditor::Initialize )
67  , // Windows needs an explicit value
68  m_cevt( std::move( evt ) )
69  , m_customEvtType( true )
70 {
71  i_before();
72 }
74  const StatusCode& sc )
75  : m_obj( obj ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false )
76 {
77  i_before();
78 }
80  const StatusCode& sc )
81  : m_obj( obj )
82  , m_svc( svc )
83  , m_evt( IAuditor::Initialize )
84  , // Windows needs an explicit value
85  m_cevt( std::move( evt ) )
86  , m_sc( &sc )
87  , m_customEvtType( true )
88 {
89  i_before();
90 }
92  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_customEvtType( false )
93 {
94  i_before();
95 }
97  : m_objName( std::move( name ) )
98  , m_svc( svc )
99  , m_evt( IAuditor::Initialize )
100  , // Windows needs an explicit value
101  m_cevt( std::move( evt ) )
102  , m_customEvtType( true )
103 {
104  i_before();
105 }
107  const StatusCode& sc )
108  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false )
109 {
110  i_before();
111 }
113  const StatusCode& sc )
114  : m_objName( std::move( name ) )
115  , m_svc( svc )
116  , m_evt( IAuditor::Initialize )
117  , // Windows needs an explicit value
118  m_cevt( std::move( evt ) )
119  , m_sc( &sc )
120  , m_customEvtType( true )
121 {
122  i_before();
123 }
124 // ============================================================================
125 // destructor
126 // ============================================================================
128 // ============================================================================
130 // ============================================================================
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:258
Define general base for Gaudi exception.
SmartIF< IAuditor > m_svc
auditor service
Definition: Guards.h:256
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:25
IAuditor::CustomEventType m_cevt
Event type (custom events)
Definition: Guards.h:260
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
STL namespace.
~ExceptionGuard()
destructor
Definition: Guards.cpp:54
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:170
virtual const StatusCode & code() const
StatusCode for Exception.
STL class.
INamedInterface * m_obj
the guarded object
Definition: Guards.h:252
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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:254
IInterface compliant class extending IInterface with the name() method.
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
~AuditorGuard()
dectructor
Definition: Guards.cpp:127
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:264
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:266
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
evt
Definition: IOTest.py:96