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 // ============================================================================
11 #include "GaudiKernel/IAlgorithm.h"
13 #include "GaudiKernel/Service.h"
14 #include <boost/thread.hpp>
15 // ============================================================================
16 // Forward declarations
17 // ============================================================================
19 // ============================================================================
28 class AlgContextSvc: public extends<Service,
29  IAlgContextSvc,
30  IIncidentListener>
31 {
32 public:
34  StatusCode setCurrentAlg ( IAlgorithm* a ) override ;
36  StatusCode unSetCurrentAlg ( IAlgorithm* a ) override ;
38  IAlgorithm* currentAlg () const override ;
40  const IAlgContextSvc::Algorithms& algorithms () const override
41  { return *m_algorithms ; }
42 public:
44  void handle ( const Incident& ) override;
45 public:
47  StatusCode initialize () override;
49  StatusCode finalize () override;
50 public:
53  ( const std::string& name ,
54  ISvcLocator* svc ) ;
56  ~AlgContextSvc() override = default;
57 private:
58  // default/copy constructor & asignment are deleted
59  AlgContextSvc () = delete ;
60  AlgContextSvc ( const AlgContextSvc& ) = delete ;
61  AlgContextSvc& operator=( const AlgContextSvc& ) = delete;
62 private:
63  // the stack of current algorithms
64  boost::thread_specific_ptr<IAlgContextSvc::Algorithms> m_algorithms;
65  // pointer to Incident Service
67  // flag to perform more checking
68  bool m_check = true ;
69 } ;
70 
71 // ============================================================================
72 // The END
73 // ============================================================================
74 #endif // GAUDISVC_ALGCONTEXTSVC_H
75 // ============================================================================
76 
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:66
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:64
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
const IAlgContextSvc::Algorithms & algorithms() const override
get the stack of executed algorithms
Definition: AlgContextSvc.h:40
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:25
~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")
IAlgorithm * currentAlg() const override
accessor to current algorithm:
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21