1 #ifndef GAUDIKERNEL_GUARDS_H
2 #define GAUDIKERNEL_GUARDS_H 1
12 #include "GaudiKernel/SmartIF.h"
13 #include "GaudiKernel/INamedInterface.h"
14 #include "GaudiKernel/IExceptionSvc.h"
15 #include "GaudiKernel/IAuditor.h"
115 template <
class OBJECT,
class FUNCTION>
127 if ( svc && m_sc.isFailure() ) { m_sc = svc->handleErr ( *obj , m_sc ) ; }
133 if ( svc ) { m_sc = svc -> handle ( *obj , e ) ; }
135 catch (
const std::exception& e )
139 if ( svc ) { m_sc = svc -> handle ( *obj , e ) ; }
145 if ( svc ) { m_sc = svc -> handle ( *obj ) ; }
152 const StatusCode& code ()
const {
return m_sc ; }
154 operator const StatusCode&()
const {
return code() ; }
157 ExceptionGuard() =
delete;
158 ExceptionGuard (
const ExceptionGuard& ) =
delete;
159 ExceptionGuard& operator=(
const ExceptionGuard& ) =
delete;
164 void handle (
const std::exception& e ,
MsgStream&
s ) ;
237 AuditorGuard ( std::string
name ,
241 AuditorGuard ( std::string
name ,
246 AuditorGuard ( std::string
name ,
251 AuditorGuard ( std::string
name ,
260 const StatusCode &code ()
const {
return *m_sc ; }
263 AuditorGuard () =
delete;
264 AuditorGuard (
const AuditorGuard& right ) =
delete;
265 AuditorGuard& operator=(
const AuditorGuard& right ) =
delete;
270 std::string m_objName;
282 bool m_customEvtType =
false;
284 inline void i_before() {
287 if (m_customEvtType) {
288 m_svc->
before(m_cevt,m_obj);
290 m_svc->
before(m_evt,m_obj);
293 if (m_customEvtType) {
294 m_svc->
before(m_cevt,m_objName);
296 m_svc->
before(m_evt,m_objName);
302 inline void i_after() {
305 if (m_customEvtType) {
307 m_svc->
after(m_cevt,m_obj,*m_sc);
309 m_svc->
after(m_cevt,m_obj);
313 m_svc->
after(m_evt,m_obj,*m_sc);
315 m_svc->
after(m_evt,m_obj);
319 if (m_customEvtType) {
321 m_svc->
after(m_cevt,m_objName,*m_sc);
323 m_svc->
after(m_cevt,m_objName);
327 m_svc->
after(m_evt,m_objName,*m_sc);
329 m_svc->
after(m_evt,m_objName);
344 #endif // GAUDIKERNEL_GUARDS_H
virtual void before(StandardEventType, INamedInterface *)=0
Audit the start of a standard "event".
Definition of the MsgStream class used to transmit messages.
Define general base for Gaudi exception.
StandardEventType
Defines the standard (= used by the framework) auditable event types.
const CustomEventType & CustomEventTypeRef
Used in function calls for optimization purposes.
std::string CustomEventType
Type used to allow users to specify a custom event to be audit.
This class is used for returning status codes from appropriate routines.
IInterface compliant class extending IInterface with the name() method.
double fun(const std::vector< double > &x)
virtual void after(StandardEventType, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
Audit the end of a standard "event".
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
A DataObject is the base class of any identifiable object on any data store.
The IAuditor is the interface implmented by the AlgAuditor base class.
Helper functions to set/get the application return code.
The abstract interface for exception handling service.