The Gaudi Framework  master (594c33fa)
Gaudi::Utils::AlgContext Class Referencefinal

#include </builds/gaudi/Gaudi/GaudiKernel/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 (single thread case) Internally invokes IAlgContextSvc::setCurrentAlg More...
 
 AlgContext (IAlgorithm *alg, IAlgContextSvc *svc, EventContext &&context)=delete
 Prevent use of temporary EventContext as current context. 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 EventContextm_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 84 of file IAlgContextSvc.h.

Constructor & Destructor Documentation

◆ AlgContext() [1/4]

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 26 of file AlgContext.cpp.

27  : m_svc( svc ), m_alg( alg ), m_context( context ) {
28  if ( m_svc && m_alg ) { m_svc->setCurrentAlg( m_alg.get(), m_context ).ignore(); }
29 }

◆ AlgContext() [2/4]

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

constructor from the service and the algorithm (single thread case) Internally invokes IAlgContextSvc::setCurrentAlg

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

Definition at line 31 of file AlgContext.cpp.

32  : AlgContext( alg, svc, s_dummyDefaultCtx ) {}

◆ AlgContext() [3/4]

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

Prevent use of temporary EventContext as current context.

See also
gaudi/Gaudi#73

◆ ~AlgContext()

Gaudi::Utils::AlgContext::~AlgContext ( )

destructor Internally invokes IAlgContextSvc::unSetCurrentAlg

See also
IAlgorithm
IAlgContextSvc

Definition at line 34 of file AlgContext.cpp.

34  {
35  if ( m_svc && m_alg ) { m_svc->unSetCurrentAlg( m_alg.get(), m_context ).ignore(); }
36 }

◆ AlgContext() [4/4]

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

Member Function Documentation

◆ operator=()

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

Member Data Documentation

◆ m_alg

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

Definition at line 124 of file IAlgContextSvc.h.

◆ m_context

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

Definition at line 125 of file IAlgContextSvc.h.

◆ m_svc

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

Definition at line 123 of file IAlgContextSvc.h.


The documentation for this class was generated from the following files:
Gaudi::Utils::AlgContext::m_alg
SmartIF< IAlgorithm > m_alg
Definition: IAlgContextSvc.h:124
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
StatusCode
Definition: StatusCode.h:65
GaudiPython.Pythonizations.execute
execute
Definition: Pythonizations.py:578
Gaudi::Utils::AlgContext::AlgContext
AlgContext(IAlgorithm *alg, IAlgContextSvc *svc, const EventContext &context)
constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg
Definition: AlgContext.cpp:26
Gaudi::Utils::AlgContext
Definition: IAlgContextSvc.h:84
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
Gaudi::Utils::AlgContext::m_svc
SmartIF< IAlgContextSvc > m_svc
Definition: IAlgContextSvc.h:123
IAlgContextSvc
Definition: IAlgContextSvc.h:33
Gaudi::Utils::AlgContext::m_context
const EventContext & m_context
Definition: IAlgContextSvc.h:125