| The Gaudi Framework v32r1 (f65d50dc)

AlgContext.cpp
Go to the documentation of this file.
1 #include <GaudiKernel/IAlgContextSvc.h>
2 #include <GaudiKernel/IAlgorithm.h>
3 #include <GaudiKernel/ThreadLocalContext.h>
4
11 namespace {
12 // This dummy context is needed for the AlgContect constructor for single thread cases (initialize, finalize, etc.).
13 static const EventContext s_dummyDefaultCtx;
14 } // namespace
15
16 Gaudi::Utils::AlgContext::AlgContext( IAlgorithm* alg, IAlgContextSvc* svc, const EventContext& context )
17 : m_svc( svc ), m_alg( alg ), m_context( context ) {
18 if ( m_svc && m_alg ) { m_svc->setCurrentAlg( m_alg.get(), m_context ).ignore(); }
19 }
20
21 Gaudi::Utils::AlgContext::AlgContext( IAlgorithm* alg, IAlgContextSvc* svc )
22 : AlgContext( alg, svc, s_dummyDefaultCtx ) {}
23
24 Gaudi::Utils::AlgContext::~AlgContext() {
25 if ( m_svc && m_alg ) { m_svc->unSetCurrentAlg( m_alg.get(), m_context ).ignore(); }
26 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
Gaudi::Utils::AlgContext
Helper "sentry" class to automatize the safe register/unregister the algorithm's context.
Definition: IAlgContextSvc.h:74
Gaudi::Utils::AlgContext::~AlgContext
~AlgContext()
destructor Internally invokes IAlgContextSvc::unSetCurrentAlg
Definition: AlgContext.cpp:24
IAlgorithm.h
ThreadLocalContext.h
Gaudi::Utils::AlgContext::m_context
const EventContext & m_context
Definition: IAlgContextSvc.h:115
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
IAlgContextSvc.h
Gaudi::Utils::AlgContext::m_svc
SmartIF< IAlgContextSvc > m_svc
Definition: IAlgContextSvc.h:113
IAlgContextSvc
An abstract interface for Algorithm Context Service.
Definition: IAlgContextSvc.h:23
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:16
IAlgContextSvc::setCurrentAlg
virtual StatusCode setCurrentAlg(IAlgorithm *a, const EventContext &context)=0
set the currently executing algorithm ("push_back")
Gaudi::Utils::AlgContext::m_alg
SmartIF< IAlgorithm > m_alg
Definition: IAlgContextSvc.h:114