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 // ============================================================================
9 #include "GaudiKernel/StatusCode.h"
10 #include "GaudiKernel/IAlgContextSvc.h"
11 #include "GaudiKernel/IAlgorithm.h"
12 #include "GaudiKernel/IIncidentListener.h"
13 #include "GaudiKernel/Service.h"
14 #include <boost/thread.hpp>
15 // ============================================================================
16 // Forward declarations
17 // ============================================================================
19 // ============================================================================
28 class AlgContextSvc: public extends2<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
39  { return *m_algorithms ; }
40 public:
42  void handle ( const Incident& ) override;
43 public:
45  StatusCode initialize () override;
47  StatusCode finalize () override;
48 public:
51  ( const std::string& name ,
52  ISvcLocator* svc ) ;
54  ~AlgContextSvc() override = default;
55 private:
56  // default/copy constructor & asignment are deleted
57  AlgContextSvc () = delete ;
58  AlgContextSvc ( const AlgContextSvc& ) = delete ;
59  AlgContextSvc& operator=( const AlgContextSvc& ) = delete;
60 private:
61  // the stack of current algorithms
62  boost::thread_specific_ptr<IAlgContextSvc::Algorithms> m_algorithms;
63  // pointer to Incident Service
65  // flag to perform more checking
66  bool m_check = true ;
67 } ;
68 
69 // ============================================================================
70 // The END
71 // ============================================================================
72 #endif // GAUDISVC_ALGCONTEXTSVC_H
73 // ============================================================================
74 
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
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")
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62
std::vector< IAlgorithm * > Algorithms
the actual type of algorithm' stack
const IAlgContextSvc::Algorithms & algorithms() const override
get the stack of executed algorithms
Definition: AlgContextSvc.h:38
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:23
~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:16
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")
IAlgorithm * currentAlg() const override
accessor to current algorithm:
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21