The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
Gaudi::Utils::AlgContext Class Referencefinal

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

#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
 
 AlgContext (IAlgorithm *alg, IAlgContextSvc *svc)
 constructor from the service and the algorithm (single thread case) Internally invokes IAlgContextSvc::setCurrentAlg
 
 AlgContext (IAlgorithm *alg, IAlgContextSvc *svc, EventContext &&context)=delete
 Prevent use of temporary EventContext as current context.
 
 ~AlgContext ()
 destructor Internally invokes IAlgContextSvc::unSetCurrentAlg
 

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:

StatusCode MyAlg::execute()
{
IAlgContextSvc* acs = ... ;
// define the context
Gaudi::Utils::AlgContext sentry ( this , acs ) ;
...
}
Helper "sentry" class to automatize the safe register/unregister the algorithm's context.
An abstract interface for Algorithm Context Service.
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99

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 76 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}
const EventContext & m_context
SmartIF< IAlgorithm > m_alg
SmartIF< IAlgContextSvc > m_svc

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

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

◆ m_context

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

Definition at line 117 of file IAlgContextSvc.h.

◆ m_svc

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

Definition at line 115 of file IAlgContextSvc.h.


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