3 #ifndef GAUDIKERNEL_GUARDS_H
4 #define GAUDIKERNEL_GUARDS_H 1
14 #include "GaudiKernel/INamedInterface.h"
15 #include "GaudiKernel/IExceptionSvc.h"
16 #include "GaudiKernel/IAuditor.h"
116 template <
class OBJECT,
class FUNCTION>
129 if ( 0 != svc && m_sc.isFailure() ) { m_sc = svc->handleErr ( *obj , m_sc ) ; }
135 if ( 0 != svc ) { m_sc = svc -> handle ( *obj , e ) ; }
137 catch (
const std::exception& e )
141 if ( 0 != svc ) { m_sc = svc -> handle ( *obj , e ) ; }
147 if ( 0 != svc ) { m_sc = svc -> handle ( *obj ) ; }
154 const StatusCode& code ()
const {
return m_sc ; }
156 operator const StatusCode&()
const {
return code() ; }
161 ExceptionGuard (
const ExceptionGuard& ) ;
163 ExceptionGuard& operator=(
const ExceptionGuard& ) ;
168 void handle (
const std::exception& e ,
MsgStream&
s ) ;
241 AuditorGuard (
const std::string &name ,
245 AuditorGuard (
const std::string &name ,
250 AuditorGuard (
const std::string &name ,
255 AuditorGuard (
const std::string &name ,
264 const StatusCode &code ()
const {
return *m_sc ; }
269 AuditorGuard (
const AuditorGuard& right ) ;
271 AuditorGuard& operator=(
const AuditorGuard& right ) ;
276 std::string m_objName;
288 bool m_customEvtType;
290 inline void i_before() {
294 if (m_customEvtType) {
295 m_svc->
before(m_cevt,m_obj);
297 m_svc->
before(m_evt,m_obj);
300 if (m_customEvtType) {
301 m_svc->
before(m_cevt,m_objName);
303 m_svc->
before(m_evt,m_objName);
309 inline void i_after() {
312 if (m_customEvtType) {
314 m_svc->
after(m_cevt,m_obj,*m_sc);
316 m_svc->
after(m_cevt,m_obj);
320 m_svc->
after(m_evt,m_obj,*m_sc);
322 m_svc->
after(m_evt,m_obj);
326 if (m_customEvtType) {
328 m_svc->
after(m_cevt,m_objName,*m_sc);
330 m_svc->
after(m_cevt,m_objName);
334 m_svc->
after(m_evt,m_objName,*m_sc);
336 m_svc->
after(m_evt,m_objName);
352 #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.
virtual unsigned long release()=0
Release Interface instance.
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".
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
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.