All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::Utils::AlgContext Class Reference

Helper "sentry" class to automatize the safe register/unregister the algorithm's context. More...

#include <GaudiKernel/IAlgContextSvc.h>

Collaboration diagram for Gaudi::Utils::AlgContext:

Public Member Functions

 AlgContext (IAlgContextSvc *svc, IAlgorithm *alg)
 constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg More...
 
 AlgContext (IAlgorithm *alg, IAlgContextSvc *svc)
 constructor from the algorithm and the service Internally invokes IAlgContextSvc::setCurrentAlg More...
 
 ~AlgContext ()
 destructor Internally invokes IAlgContextSvc::unSetCurrentAlg More...
 

Private Member Functions

 AlgContext ()
 no default constructor! More...
 
 AlgContext (const AlgContext &right)
 no copy! More...
 
AlgContextoperator= (const AlgContext &right)
 no assignement! More...
 

Private Attributes

IAlgContextSvcm_svc
 
IAlgorithmm_alg
 

Detailed Description

Helper "sentry" class to automatize the safe register/unregister the algorithm's context.

Typical explicit usage:

{
IAlgContextSvc* acs = ... ;
// define the context
Gaudi::Utils::AlgContext sentry ( this , acs ) ;
...
}

Note: for the regular job the context is properly defined with the help of corresponding auditor AlgContextAuditor. This helper class is needed only if one needs to ensure that the algorithm must register its context independently on job/auditor configuration

See also
AlgContextAuditor
Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.phys..nosp@m.syr..nosp@m.edu
Date
2007-03-07

Definition at line 84 of file IAlgContextSvc.h.

Constructor & Destructor Documentation

Gaudi::Utils::AlgContext::AlgContext ( IAlgContextSvc svc,
IAlgorithm alg 
)

constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg

See also
IAlgorithm
IAlgContextSvc
Parameters
svcpointer to algorithm context service
algpointer to the current algorithm

Definition at line 42 of file AlgContext.cpp.

44  : m_svc ( svc )
45  , m_alg ( alg )
46 {
47  if ( 0 != m_alg ) { m_alg -> addRef() ; }
48  if ( 0 != m_svc ) { m_svc -> addRef() ; }
49  if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; }
50 }
virtual StatusCode setCurrentAlg(IAlgorithm *a)=0
set the currently executing algorithm ("push_back")
void ignore() const
Definition: StatusCode.h:94
IAlgContextSvc * m_svc
Gaudi::Utils::AlgContext::AlgContext ( IAlgorithm alg,
IAlgContextSvc svc 
)

constructor from the algorithm and the service Internally invokes IAlgContextSvc::setCurrentAlg

See also
IAlgorithm
IAlgContextSvc
Parameters
algpointer to the current algorithm
svcpointer to algorithm context service

Definition at line 61 of file AlgContext.cpp.

63  : m_svc ( svc )
64  , m_alg ( alg )
65 {
66  if ( 0 != m_alg ) { m_alg -> addRef() ; }
67  if ( 0 != m_svc ) { m_svc -> addRef() ; }
68  if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; }
69 }
virtual StatusCode setCurrentAlg(IAlgorithm *a)=0
set the currently executing algorithm ("push_back")
void ignore() const
Definition: StatusCode.h:94
IAlgContextSvc * m_svc
Gaudi::Utils::AlgContext::~AlgContext ( )

destructor Internally invokes IAlgContextSvc::unSetCurrentAlg

See also
IAlgorithm
IAlgContextSvc

Definition at line 77 of file AlgContext.cpp.

78 {
79  if ( 0 != m_svc && 0 != m_alg )
80  { m_svc->unSetCurrentAlg ( m_alg ).ignore() ; }
81  if ( 0 != m_svc ) { m_svc -> release () ; m_svc = 0 ; }
82  if ( 0 != m_alg ) { m_alg -> release () ; m_alg = 0 ; }
83 }
void ignore() const
Definition: StatusCode.h:94
IAlgContextSvc * m_svc
virtual StatusCode unSetCurrentAlg(IAlgorithm *a)=0
remove the algorithm ("pop_back")
Gaudi::Utils::AlgContext::AlgContext ( )
private

no default constructor!

Gaudi::Utils::AlgContext::AlgContext ( const AlgContext right)
private

no copy!

Member Function Documentation

AlgContext& Gaudi::Utils::AlgContext::operator= ( const AlgContext right)
private

no assignement!

Member Data Documentation

IAlgorithm* Gaudi::Utils::AlgContext::m_alg
private

Definition at line 122 of file IAlgContextSvc.h.

IAlgContextSvc* Gaudi::Utils::AlgContext::m_svc
private

Definition at line 121 of file IAlgContextSvc.h.


The documentation for this class was generated from the following files: