The Gaudi Framework  v33r0 (d5ea422b)
AlgContext.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
12 #include <GaudiKernel/IAlgorithm.h>
14 
21 namespace {
22  // This dummy context is needed for the AlgContect constructor for single thread cases (initialize, finalize, etc.).
23  static const EventContext s_dummyDefaultCtx;
24 } // namespace
25 
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 }
30 
32  : AlgContext( alg, svc, s_dummyDefaultCtx ) {}
33 
35  if ( m_svc && m_alg ) { m_svc->unSetCurrentAlg( m_alg.get(), m_context ).ignore(); }
36 }
Helper "sentry" class to automatize the safe register/unregister the algorithm's context.
~AlgContext()
destructor Internally invokes IAlgContextSvc::unSetCurrentAlg
Definition: AlgContext.cpp:34
const EventContext & m_context
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
This class represents an entry point to all the event specific data.
Definition: EventContext.h:34
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:38
SmartIF< IAlgContextSvc > m_svc
An abstract interface for Algorithm Context Service.
AlgContext(IAlgorithm *alg, IAlgContextSvc *svc, const EventContext &context)
constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg
Definition: AlgContext.cpp:26
virtual StatusCode setCurrentAlg(IAlgorithm *a, const EventContext &context)=0
set the currently executing algorithm ("push_back")
SmartIF< IAlgorithm > m_alg