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 // GaudiKernel
8 // ============================================================================
10 #include "GaudiKernel/IAlgorithm.h"
12 #include "GaudiKernel/Service.h"
13 #include "GaudiKernel/StatusCode.h"
14 #include <boost/thread.hpp>
15 // ============================================================================
16 // Forward declarations
17 // ============================================================================
19 // ============================================================================
28 class AlgContextSvc : public extends<Service, IAlgContextSvc, IIncidentListener>
29 {
30 public:
32  StatusCode setCurrentAlg( IAlgorithm* a ) override;
34  StatusCode unSetCurrentAlg( IAlgorithm* a ) override;
36  IAlgorithm* currentAlg() const override;
38  const IAlgContextSvc::Algorithms& algorithms() const override { return *m_algorithms; }
39 public:
41  void handle( const Incident& ) override;
42 
43 public:
45  StatusCode initialize() override;
47  StatusCode finalize() override;
48 
49 public:
50  using extends::extends;
52  ~AlgContextSvc() override = default;
53 
54 private:
55  // default/copy constructor & asignment are deleted
56  AlgContextSvc() = delete;
57  AlgContextSvc( const AlgContextSvc& ) = delete;
58  AlgContextSvc& operator=( const AlgContextSvc& ) = delete;
59 
60 private:
61  // the stack of current algorithms
62  boost::thread_specific_ptr<IAlgContextSvc::Algorithms> m_algorithms;
63  // pointer to Incident Service
65 
66  Gaudi::Property<bool> m_check{this, "Check", true, "Flag to perform more checks"};
67 };
68 
69 // ============================================================================
70 // The END
71 // ============================================================================
72 #endif // GAUDISVC_ALGCONTEXTSVC_H
73 // ============================================================================
Implementation of property with value of concrete type.
Definition: Property.h:314
void handle(const Incident &) override
handle incident
SmartIF< IIncidentSvc > m_inc
pointer to Incident Service
Definition: AlgContextSvc.h:64
AlgContextSvc()=delete
StatusCode unSetCurrentAlg(IAlgorithm *a) override
remove the algorithm ("pop_back")
const IAlgContextSvc::Algorithms & algorithms() const override
get the stack of executed algorithms
Definition: AlgContextSvc.h:38
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62
IAlgorithm * currentAlg() const override
accessor to current algorithm:
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:27
~AlgContextSvc() override=default
Standard Destructor.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Base class for all Incidents (computing events).
Definition: Incident.h:17
StatusCode initialize() override
standard initialization of the service
StatusCode finalize() override
standard finalization of the service
AlgContextSvc & operator=(const AlgContextSvc &)=delete
StatusCode setCurrentAlg(IAlgorithm *a) override
set the currently executing algorithm ("push_back")
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
Gaudi::Property< bool > m_check
Definition: AlgContextSvc.h:66