#include <GaudiKernel/Guards.h>
Collaboration diagram for Gaudi::Guards::AuditorGuard:
Public Member Functions | |
AuditorGuard (INamedInterface *obj, IAuditor *svc, IAuditor::StandardEventType evt) | |
constructor | |
AuditorGuard (INamedInterface *obj, IAuditor *svc, IAuditor::CustomEventTypeRef evt) | |
constructor | |
AuditorGuard (INamedInterface *obj, IAuditor *svc, IAuditor::StandardEventType evt, const StatusCode &sc) | |
constructor | |
AuditorGuard (INamedInterface *obj, IAuditor *svc, IAuditor::CustomEventTypeRef evt, const StatusCode &sc) | |
constructor | |
AuditorGuard (const std::string &name, IAuditor *svc, IAuditor::StandardEventType evt) | |
constructor | |
AuditorGuard (const std::string &name, IAuditor *svc, IAuditor::CustomEventTypeRef evt) | |
constructor | |
AuditorGuard (const std::string &name, IAuditor *svc, IAuditor::StandardEventType evt, const StatusCode &sc) | |
constructor | |
AuditorGuard (const std::string &name, IAuditor *svc, IAuditor::CustomEventTypeRef evt, const StatusCode &sc) | |
constructor | |
~AuditorGuard () | |
dectructor | |
const StatusCode & | code () const |
Private Member Functions | |
AuditorGuard () | |
the default constructor is disabled | |
AuditorGuard (const AuditorGuard &right) | |
no copy | |
AuditorGuard & | operator= (const AuditorGuard &right) |
no assignement | |
void | i_before () |
void | i_after () |
Private Attributes | |
INamedInterface * | m_obj |
the guarded object | |
std::string | m_objName |
the guarded object name (if there is no INamedInterface) | |
IAuditor * | m_svc |
auditor service | |
IAuditor::StandardEventType | m_evt |
Event type (standard events). | |
IAuditor::CustomEventType | m_cevt |
Event type (custom events). | |
const StatusCode * | m_sc |
Pointer to a status code instance, to be passed to the "after" function if needed The instance must have a scope larger than the one of the guard. | |
bool | m_customEvtType |
Flag to remember which event type was used. |
The pattern ensures that "post-action" will be always executed
StatusCode Algorithm::sysInitialize () { AuditorGuard auditor ( this , auditSvc() , IAuditor::Initialize ) ; ... StatusCode sc = ... ; ... return sc ; }
StatusCode Algorithm::sysExecute () { AuditorGuard auditor ( this , auditSvc() , IAuditor::execute ) ; ... StatusCode sc = ... ; ... auditor.setCode ( sc ) ; ... return sc ; }
Definition at line 218 of file Guards.h.
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | INamedInterface * | obj, | |
IAuditor * | svc, | |||
IAuditor::StandardEventType | evt | |||
) |
constructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | INamedInterface * | obj, | |
IAuditor * | svc, | |||
IAuditor::CustomEventTypeRef | evt | |||
) |
constructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | INamedInterface * | obj, | |
IAuditor * | svc, | |||
IAuditor::StandardEventType | evt, | |||
const StatusCode & | sc | |||
) |
constructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | INamedInterface * | obj, | |
IAuditor * | svc, | |||
IAuditor::CustomEventTypeRef | evt, | |||
const StatusCode & | sc | |||
) |
constructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | const std::string & | name, | |
IAuditor * | svc, | |||
IAuditor::StandardEventType | evt | |||
) |
constructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | const std::string & | name, | |
IAuditor * | svc, | |||
IAuditor::CustomEventTypeRef | evt | |||
) |
constructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | const std::string & | name, | |
IAuditor * | svc, | |||
IAuditor::StandardEventType | evt, | |||
const StatusCode & | sc | |||
) |
constructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | const std::string & | name, | |
IAuditor * | svc, | |||
IAuditor::CustomEventTypeRef | evt, | |||
const StatusCode & | sc | |||
) |
constructor
Gaudi::Guards::AuditorGuard::~AuditorGuard | ( | ) |
dectructor
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | ) | [private] |
the default constructor is disabled
Gaudi::Guards::AuditorGuard::AuditorGuard | ( | const AuditorGuard & | right | ) | [private] |
no copy
const StatusCode& Gaudi::Guards::AuditorGuard::code | ( | ) | const [inline] |
AuditorGuard& Gaudi::Guards::AuditorGuard::operator= | ( | const AuditorGuard & | right | ) | [private] |
no assignement
void Gaudi::Guards::AuditorGuard::i_before | ( | ) | [inline, private] |
Definition at line 290 of file Guards.h.
00290 { 00291 if ( 0 != m_svc ) { // if the service is not available, we cannot do anything 00292 m_svc->addRef(); // increase the reference counting 00293 if (0 != m_obj) { 00294 if (m_customEvtType) { 00295 m_svc->before(m_cevt,m_obj); 00296 } else { 00297 m_svc->before(m_evt,m_obj); 00298 } 00299 } else { // use object name 00300 if (m_customEvtType) { 00301 m_svc->before(m_cevt,m_objName); 00302 } else { 00303 m_svc->before(m_evt,m_objName); 00304 } 00305 } 00306 } 00307 }
void Gaudi::Guards::AuditorGuard::i_after | ( | ) | [inline, private] |
Definition at line 309 of file Guards.h.
00309 { 00310 if ( 0 != m_svc ) { // if the service is not available, we cannot do anything 00311 if (0 != m_obj) { 00312 if (m_customEvtType) { 00313 if (0 != m_sc) { 00314 m_svc->after(m_cevt,m_obj,*m_sc); 00315 } else { 00316 m_svc->after(m_cevt,m_obj); 00317 } 00318 } else { 00319 if (0 != m_sc) { 00320 m_svc->after(m_evt,m_obj,*m_sc); 00321 } else { 00322 m_svc->after(m_evt,m_obj); 00323 } 00324 } 00325 } else { // use object name 00326 if (m_customEvtType) { 00327 if (0 != m_sc) { 00328 m_svc->after(m_cevt,m_objName,*m_sc); 00329 } else { 00330 m_svc->after(m_cevt,m_objName); 00331 } 00332 } else { 00333 if (0 != m_sc) { 00334 m_svc->after(m_evt,m_objName,*m_sc); 00335 } else { 00336 m_svc->after(m_evt,m_objName); 00337 } 00338 } 00339 } 00340 m_svc->release(); // we do not need the service anymore 00341 m_svc = 0 ; 00342 } 00343 }
std::string Gaudi::Guards::AuditorGuard::m_objName [private] |
IAuditor* Gaudi::Guards::AuditorGuard::m_svc [private] |
const StatusCode* Gaudi::Guards::AuditorGuard::m_sc [private] |
bool Gaudi::Guards::AuditorGuard::m_customEvtType [private] |