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 // ============================================================================
10 #include "GaudiKernel/Guards.h"
11 #include "GaudiKernel/System.h"
12 #include "GaudiKernel/MsgStream.h"
14 // ============================================================================
21 // ============================================================================
22 // Local handle (print) of GaudiException
23 // ============================================================================
25 ( const GaudiException& exc , MsgStream& log )
26 {
27  // the general printout
28  log << MSG::FATAL
29  << System::typeinfoName( typeid ( exc ) )
30  << "('" << exc.tag() << "') is caught!" << endmsg ;
31  // print the detailes about the exception:
32  log << MSG::ERROR << exc << endmsg ;
33  // get the status code form the exception:
34  m_sc = exc.code() ;
35 }
36 // ============================================================================
37 // Local handle (print) of std::exception
38 // ============================================================================
40 ( const std::exception& exc , MsgStream& log )
41 {
42  // the general printout
43  log << MSG::FATAL
44  << System::typeinfoName( typeid ( exc ) ) << " is caught!" << endmsg ;
45  // print the detailes abotu the exception:
46  log << MSG::ERROR << exc.what() << endmsg ;
47 }
48 // ============================================================================
49 // Local handle (print) of unknown exception
50 // ============================================================================
52 ( MsgStream& log )
53 {
54  // the general printout
55  log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg ;
56 }
57 // ============================================================================
58 // dectructor
59 // ============================================================================
61 // ============================================================================
62 // constructor with standard post-action
63 // ============================================================================
65  IAuditor* svc ,
67  m_obj(obj),
68  m_svc(svc),
69  m_evt(evt)
70 {
71  i_before();
72 }
74  IAuditor* svc ,
76  m_obj(obj),
77  m_svc(svc),
78  m_evt(IAuditor::Initialize), // Windows needs an explicit value
79  m_cevt(std::move(evt)),
80  m_customEvtType(true)
81 {
82  i_before();
83 }
85  IAuditor* svc ,
87  const StatusCode &sc ):
88  m_obj(obj),
89  m_svc(svc),
90  m_evt(evt),
91  m_sc(&sc),
92  m_customEvtType(false)
93 {
94  i_before();
95 }
97  IAuditor* svc ,
99  const StatusCode &sc ):
100  m_obj(obj),
101  m_svc(svc),
102  m_evt(IAuditor::Initialize), // Windows needs an explicit value
103  m_cevt(std::move(evt)),
104  m_sc(&sc),
105  m_customEvtType(true)
106 {
107  i_before();
108 }
110  IAuditor* svc ,
112  m_objName(std::move(name)),
113  m_svc(svc),
114  m_evt(evt),
115  m_customEvtType(false)
116 {
117  i_before();
118 }
120  IAuditor* svc ,
122  m_objName(std::move(name)),
123  m_svc(svc),
124  m_evt(IAuditor::Initialize), // Windows needs an explicit value
125  m_cevt(std::move(evt)),
126  m_customEvtType(true)
127 {
128  i_before();
129 }
131  IAuditor* svc ,
133  const StatusCode &sc ):
134  m_objName(std::move(name)),
135  m_svc(svc),
136  m_evt(evt),
137  m_sc(&sc),
138  m_customEvtType(false)
139 {
140  i_before();
141 }
143  IAuditor* svc ,
145  const StatusCode &sc ):
146  m_objName(std::move(name)),
147  m_svc(svc),
148  m_evt(IAuditor::Initialize), // Windows needs an explicit value
149  m_cevt(std::move(evt)),
150  m_sc(&sc),
151  m_customEvtType(true)
152 {
153  i_before();
154 }
155 // ============================================================================
156 // destructor
157 // ============================================================================
159 {
160  i_after();
161 }
162 // ============================================================================
164 // ============================================================================
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:25
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
IAuditor::StandardEventType m_evt
Event type (standard events)
Definition: Guards.h:274
Define general base for Gaudi exception.
SmartIF< IAuditor > m_svc
auditor service
Definition: Guards.h:272
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:276
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
STL namespace.
~ExceptionGuard()
destructor
Definition: Guards.cpp:60
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:169
virtual const StatusCode & code() const
StatusCode for Exception.
STL class.
INamedInterface * m_obj
the guarded object
Definition: Guards.h:268
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:270
IInterface compliant class extending IInterface with the name() method.
~AuditorGuard()
dectructor
Definition: Guards.cpp:158
void ignore() const
Definition: StatusCode.h:106
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:280
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:282
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
evt
Definition: IOTest.py:85