The Gaudi Framework  v33r1 (b1225454)
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 // ============================================================================
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
std::vector< int > m_inEvtLoop
Definition: AlgContextSvc.h:83
Implementation of property with value of concrete type.
Definition: Property.h:370
Gaudi::Property< bool > m_bypassInc
Definition: AlgContextSvc.h:81
void handle(const Incident &) override
handle incident
StatusCode start() override
SmartIF< IIncidentSvc > m_inc
pointer to Incident Service
Definition: AlgContextSvc.h:78
AlgContextSvc()=delete
StatusCode setCurrentAlg(IAlgorithm *a, const EventContext &context) override
set the currently executing algorithm ("push_back")
This class represents an entry point to all the event specific data.
Definition: EventContext.h:34
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:76
const IAlgContextSvc::Algorithms & algorithms() const override
get the stack of executed algorithms
Definition: AlgContextSvc.h:52
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:38
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
StatusCode unSetCurrentAlg(IAlgorithm *a, const EventContext &context) override
remove the algorithm ("pop_back")
Base class for all Incidents (computing events).
Definition: Incident.h:27
StatusCode initialize() override
standard initialization of the service
StatusCode finalize() override
standard finalization of the service
AlgContextSvc & operator=(const AlgContextSvc &)=delete
IAlgorithm * currentAlg() const override
accessor to current algorithm:
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:33
Gaudi::Property< bool > m_check
Definition: AlgContextSvc.h:80