The Gaudi Framework  master (37c0b60a)
Gaudi::Guards Namespace Reference

Classes

class  AuditorGuard
 
class  ExceptionGuard
 

Detailed Description

Guards.h GaudiKernel/Guards.h Collection of very simple classes which allows to execution of some functions within the given well-defined and exception-safe context. In addition these utilities allow to remove many ugly lines from many ancient base classes

The namespace contains two simple guards:

Please note tha the class Gaudi::Utils::AlgContext is also some kind of "guard".

All these guards could work together in very collaborative way:

{
// create the message stream:
MsgStream log ( msgSvc() , name() ) ;
// lock the scope for Auditor Service
( this ,
auditorSvc() ,
&IAuditorSvc::beforeInitialize ,
&IAuditorsvc::afterInitialize ) ;
// Lock the scope for Algorithm Context Service:
Gaudi::Utils::AlgContext context ( this , m_contextSvc ) ;
// execute IAlgorithm::initialize within "try{}catch(..)" clause:
( this ,
std::mem_fn(&IAlgorithm::initialize) ,
log ,
m_exceptionSvc ) ;
return guard ;
}

C++ guarantees the proper execution of all "post"-actions for all involved guards when the scope is destroyed.

Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-03-07
Gaudi.Configuration.log
log
Definition: Configuration.py:28
std::mem_fn
T mem_fn(T... args)
AvalancheSchedulerErrorTest.msgSvc
msgSvc
Definition: AvalancheSchedulerErrorTest.py:80
Gaudi::Guards::AuditorGuard
Definition: Guards.h:213
StatusCode
Definition: StatusCode.h:65
Gaudi::Algorithm::sysInitialize
StatusCode sysInitialize() override
Initialization method invoked by the framework.
Definition: Algorithm.cpp:56
Gaudi::Utils::AlgContext
Definition: IAlgContextSvc.h:84
Gaudi::Guards::ExceptionGuard
Definition: Guards.h:115
MsgStream
Definition: MsgStream.h:33
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77