Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Gaudi::Utils::AlgContext Class Referencefinal

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 (IAlgorithm *alg, IAlgContextSvc *svc, const EventContext &context)
 constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg More...
 
 AlgContext (IAlgorithm *alg, IAlgContextSvc *svc)
 constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg More...
 
 ~AlgContext ()
 destructor Internally invokes IAlgContextSvc::unSetCurrentAlg More...
 

Private Member Functions

 AlgContext (const AlgContext &right)=delete
 
AlgContextoperator= (const AlgContext &right)=delete
 

Private Attributes

SmartIF< IAlgContextSvcm_svc
 
SmartIF< IAlgorithmm_alg
 
const EventContext m_context
 

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 74 of file IAlgContextSvc.h.

Constructor & Destructor Documentation

Gaudi::Utils::AlgContext::AlgContext ( IAlgorithm alg,
IAlgContextSvc svc,
const EventContext context 
)

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

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

Definition at line 11 of file AlgContext.cpp.

12  : m_svc( svc ), m_alg( alg ), m_context( context ) {
13  if ( m_svc && m_alg ) { m_svc->setCurrentAlg( m_alg.get(), m_context ).ignore(); }
14 }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
SmartIF< IAlgContextSvc > m_svc
const EventContext m_context
virtual StatusCode setCurrentAlg(IAlgorithm *a, const EventContext &context)=0
set the currently executing algorithm ("push_back")
SmartIF< IAlgorithm > m_alg
Gaudi::Utils::AlgContext::AlgContext ( IAlgorithm alg,
IAlgContextSvc svc 
)

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

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

Definition at line 16 of file AlgContext.cpp.

17  : AlgContext( alg, svc, Gaudi::Hive::currentContext() ) {}
GAUDI_API const EventContext & currentContext()
AlgContext(IAlgorithm *alg, IAlgContextSvc *svc, const EventContext &context)
constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg ...
Definition: AlgContext.cpp:11
Gaudi::Utils::AlgContext::~AlgContext ( )

destructor Internally invokes IAlgContextSvc::unSetCurrentAlg

See also
IAlgorithm
IAlgContextSvc

Definition at line 19 of file AlgContext.cpp.

19  {
20  if ( m_svc && m_alg ) { m_svc->unSetCurrentAlg( m_alg.get(), m_context ).ignore(); }
21 }
virtual StatusCode unSetCurrentAlg(IAlgorithm *a, const EventContext &context)=0
remove the algorithm ("pop_back")
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
SmartIF< IAlgContextSvc > m_svc
const EventContext m_context
SmartIF< IAlgorithm > m_alg
Gaudi::Utils::AlgContext::AlgContext ( const AlgContext right)
privatedelete

Member Function Documentation

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

Member Data Documentation

SmartIF<IAlgorithm> Gaudi::Utils::AlgContext::m_alg
private

Definition at line 111 of file IAlgContextSvc.h.

const EventContext Gaudi::Utils::AlgContext::m_context
private

Definition at line 112 of file IAlgContextSvc.h.

SmartIF<IAlgContextSvc> Gaudi::Utils::AlgContext::m_svc
private

Definition at line 110 of file IAlgContextSvc.h.


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