The Gaudi Framework  v36r9p1 (5c15b2bb)
AlgContextSvc.h
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 \***********************************************************************************/
11 // ============================================================================
12 #ifndef GAUDISVC_ALGCONTEXTSVC_H
13 #define GAUDISVC_ALGCONTEXTSVC_H 1
14 // ============================================================================
15 // Include files
16 // ============================================================================
17 #include <vector>
18 // ============================================================================
19 // GaudiKernel
20 // ============================================================================
22 #include "GaudiKernel/IAlgorithm.h"
24 #include "GaudiKernel/Service.h"
25 #include "GaudiKernel/StatusCode.h"
26 #include <boost/thread.hpp>
27 
28 // ============================================================================
29 // Forward declarations
30 // ============================================================================
31 class IIncidentSvc;
32 // ============================================================================
43 class AlgContextSvc : public extends<Service, IAlgContextSvc, IIncidentListener> {
44 public:
46  StatusCode setCurrentAlg( IAlgorithm* a, const EventContext& context ) override;
48  StatusCode unSetCurrentAlg( IAlgorithm* a, const EventContext& context ) override;
50  IAlgorithm* currentAlg() const override;
52  const IAlgContextSvc::Algorithms& algorithms() const override { return *m_algorithms; }
53 
54 public:
56  void handle( const Incident& ) override;
57 
58 public:
60  StatusCode initialize() override;
61  StatusCode start() override;
63  StatusCode finalize() override;
64 
65 public:
66  using extends::extends;
67 
68 private:
69  // default/copy constructor & asignment are deleted
70  AlgContextSvc() = delete;
71  AlgContextSvc( const AlgContextSvc& ) = delete;
72  AlgContextSvc& operator=( const AlgContextSvc& ) = delete;
73 
74 private:
75  // the stack of current algorithms
76  boost::thread_specific_ptr<IAlgContextSvc::Algorithms> m_algorithms;
77  // pointer to Incident Service
79 
80  Gaudi::Property<bool> m_check{ this, "Check", true, "Flag to perform more checks" };
81  Gaudi::Property<bool> m_bypassInc{ this, "BypassIncidents", false,
82  "Flag to bypass begin/endevent incident requirement" };
84 };
85 
86 // ============================================================================
87 // The END
88 // ============================================================================
89 #endif // GAUDISVC_ALGCONTEXTSVC_H
AlgContextSvc::currentAlg
IAlgorithm * currentAlg() const override
accessor to current algorithm:
Definition: AlgContextSvc.cpp:156
AlgContextSvc::m_check
Gaudi::Property< bool > m_check
Definition: AlgContextSvc.h:80
AlgContextSvc::m_inc
SmartIF< IIncidentSvc > m_inc
pointer to Incident Service
Definition: AlgContextSvc.h:78
AlgContextSvc::handle
void handle(const Incident &) override
handle incident
Definition: AlgContextSvc.cpp:162
AlgContextSvc::AlgContextSvc
AlgContextSvc()=delete
AlgContextSvc::m_inEvtLoop
std::vector< int > m_inEvtLoop
Definition: AlgContextSvc.h:83
AlgContextSvc::start
StatusCode start() override
Definition: AlgContextSvc.cpp:79
std::vector< IAlgorithm * >
AlgContextSvc::setCurrentAlg
StatusCode setCurrentAlg(IAlgorithm *a, const EventContext &context) override
set the currently executing algorithm ("push_back")
Definition: AlgContextSvc.cpp:110
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:76
StatusCode.h
AlgContextSvc::m_bypassInc
Gaudi::Property< bool > m_bypassInc
Definition: AlgContextSvc.h:81
StatusCode
Definition: StatusCode.h:65
IAlgorithm
Definition: IAlgorithm.h:38
AlgContextSvc::algorithms
const IAlgContextSvc::Algorithms & algorithms() const override
get the stack of executed algorithms
Definition: AlgContextSvc.h:52
AlgContextSvc::unSetCurrentAlg
StatusCode unSetCurrentAlg(IAlgorithm *a, const EventContext &context) override
remove the algorithm ("pop_back")
Definition: AlgContextSvc.cpp:128
SmartIF< IIncidentSvc >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Service.h
AlgContextSvc::finalize
StatusCode finalize() override
standard finalization of the service
Definition: AlgContextSvc.cpp:95
AlgContextSvc::operator=
AlgContextSvc & operator=(const AlgContextSvc &)=delete
AlgContextSvc::AlgContextSvc
AlgContextSvc(const AlgContextSvc &)=delete
IAlgContextSvc.h
AlgContextSvc
Definition: AlgContextSvc.h:43
IIncidentListener.h
EventContext
Definition: EventContext.h:34
IAlgorithm.h
IIncidentSvc
Definition: IIncidentSvc.h:33
Incident
Definition: Incident.h:27
Gaudi::Property< bool >
AlgContextSvc::initialize
StatusCode initialize() override
standard initialization of the service
Definition: AlgContextSvc.cpp:41