The Gaudi Framework  master (37c0b60a)
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 }
Gaudi::Utils::AlgContext::m_alg
SmartIF< IAlgorithm > m_alg
Definition: IAlgContextSvc.h:124
Gaudi::Utils::AlgContext::~AlgContext
~AlgContext()
destructor Internally invokes IAlgContextSvc::unSetCurrentAlg
Definition: AlgContext.cpp:34
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
IAlgorithm
Definition: IAlgorithm.h:38
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
ThreadLocalContext.h
IAlgContextSvc.h
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
EventContext
Definition: EventContext.h:34
IAlgContextSvc
Definition: IAlgContextSvc.h:33
IAlgorithm.h
Gaudi::Utils::AlgContext::m_context
const EventContext & m_context
Definition: IAlgContextSvc.h:125