| The Gaudi Framework v32r1 (f65d50dc)

AlgContextSvc.h
Go to the documentation of this file.
1 // ============================================================================
2 #ifndef GAUDISVC_ALGCONTEXTSVC_H
3 #define GAUDISVC_ALGCONTEXTSVC_H 1
4 // ============================================================================
5 // Include files
6 // ============================================================================
7 #include <vector>
8 // ============================================================================
9 // GaudiKernel
10 // ============================================================================
11 #include "GaudiKernel/IAlgContextSvc.h"
12 #include "GaudiKernel/IAlgorithm.h"
13 #include "GaudiKernel/IIncidentListener.h"
14 #include "GaudiKernel/Service.h"
15 #include "GaudiKernel/StatusCode.h"
16 #include <boost/thread.hpp>
17
18 // ============================================================================
19 // Forward declarations
20 // ============================================================================
21 class IIncidentSvc;
22 // ============================================================================
33 class AlgContextSvc : public extends<Service, IAlgContextSvc, IIncidentListener> {
34 public:
36 StatusCode setCurrentAlg( IAlgorithm* a, const EventContext& context ) override;
38 StatusCode unSetCurrentAlg( IAlgorithm* a, const EventContext& context ) override;
40 IAlgorithm* currentAlg() const override;
42 const IAlgContextSvc::Algorithms& algorithms() const override { return *m_algorithms; }
43
44 public:
46 void handle( const Incident& ) override;
47
48 public:
50 StatusCode initialize() override;
51 StatusCode start() override;
53 StatusCode finalize() override;
54
55 public:
56 using extends::extends;
57
58 private:
59 // default/copy constructor & asignment are deleted
60 AlgContextSvc() = delete;
61 AlgContextSvc( const AlgContextSvc& ) = delete;
62 AlgContextSvc& operator=( const AlgContextSvc& ) = delete;
63
64 private:
65 // the stack of current algorithms
66 boost::thread_specific_ptr<IAlgContextSvc::Algorithms> m_algorithms;
67 // pointer to Incident Service
68 SmartIF<IIncidentSvc> m_inc = nullptr;
69
70 Gaudi::Property<bool> m_check{this, "Check", true, "Flag to perform more checks"};
71 Gaudi::Property<bool> m_bypassInc{this, "BypassIncidents", false,
72 "Flag to bypass begin/endevent incident requirement"};
73 std::vector<int> m_inEvtLoop;
74 };
75
76 // ============================================================================
77 // The END
78 // ============================================================================
79 #endif // GAUDISVC_ALGCONTEXTSVC_H
SmartIF< IIncidentSvc >
AlgContextSvc::m_inEvtLoop
std::vector< int > m_inEvtLoop
Definition: AlgContextSvc.h:73
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
AlgContextSvc::m_bypassInc
Gaudi::Property< bool > m_bypassInc
Definition: AlgContextSvc.h:71
AlgContextSvc::handle
void handle(const Incident &) override
handle incident
Definition: AlgContextSvc.cpp:152
IAlgorithm.h
AlgContextSvc::start
StatusCode start() override
Definition: AlgContextSvc.cpp:69
AlgContextSvc::m_inc
SmartIF< IIncidentSvc > m_inc
pointer to Incident Service
Definition: AlgContextSvc.h:68
AlgContextSvc::AlgContextSvc
AlgContextSvc()=delete
AlgContextSvc::setCurrentAlg
StatusCode setCurrentAlg(IAlgorithm *a, const EventContext &context) override
set the currently executing algorithm ("push_back")
Definition: AlgContextSvc.cpp:100
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
AlgContextSvc
Definition: AlgContextSvc.h:33
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:66
Service.h
AlgContextSvc::algorithms
const IAlgContextSvc::Algorithms & algorithms() const override
get the stack of executed algorithms
Definition: AlgContextSvc.h:42
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
IAlgContextSvc.h
std::vector< IAlgorithm * >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
AlgContextSvc::unSetCurrentAlg
StatusCode unSetCurrentAlg(IAlgorithm *a, const EventContext &context) override
remove the algorithm ("pop_back")
Definition: AlgContextSvc.cpp:118
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
IIncidentListener.h
AlgContextSvc::initialize
StatusCode initialize() override
standard initialization of the service
Definition: AlgContextSvc.cpp:31
AlgContextSvc::finalize
StatusCode finalize() override
standard finalization of the service
Definition: AlgContextSvc.cpp:85
AlgContextSvc::operator=
AlgContextSvc & operator=(const AlgContextSvc &)=delete
StatusCode.h
AlgContextSvc::currentAlg
IAlgorithm * currentAlg() const override
accessor to current algorithm:
Definition: AlgContextSvc.cpp:146
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
AlgContextSvc::m_check
Gaudi::Property< bool > m_check
Definition: AlgContextSvc.h:70