The Gaudi Framework  v33r1 (b1225454)
AlgExecStateSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2020 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 #ifndef GAUDICORESVC_ALGEXECSTATESVC_H
12 #define GAUDICORESVC_ALGEXECSTATESVC_H 1
13 
15 #include "GaudiKernel/IAlgorithm.h"
16 #include "GaudiKernel/Service.h"
17 
18 #include <mutex>
19 #include <unordered_map>
20 #include <vector>
21 
26 class AlgExecStateSvc : public extends<Service, IAlgExecStateSvc> {
27 public:
28  using extends::extends;
29 
31 
33  const AlgExecState& algExecState( const Gaudi::StringKey& algName, const EventContext& ctx ) const override;
34  AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) override;
35  const AlgStateMap_t& algExecStates( const EventContext& ctx ) const override;
36 
37  void reset( const EventContext& ctx ) override;
38 
40  void addAlg( const Gaudi::StringKey& algName ) override;
41 
42  const EventStatus::Status& eventStatus( const EventContext& ctx ) const override;
43 
44  void setEventStatus( const EventStatus::Status& sc, const EventContext& ctx ) override;
45 
46  void updateEventStatus( const bool& b, const EventContext& ctx ) override;
47 
48  unsigned int algErrorCount( const IAlgorithm* iAlg ) const override;
49  void resetErrorCount( const IAlgorithm* iAlg ) override;
50  unsigned int incrementErrorCount( const IAlgorithm* iAlg ) override;
51 
52  void dump( std::ostringstream& ost, const EventContext& ctx ) const override;
53 
54 private:
55  // one vector entry per event slot
57 
60 
62 
63  void init();
64  void checkInit() const;
66  bool m_isInit{false};
67 
69 };
70 
71 #endif
void resetErrorCount(const IAlgorithm *iAlg) override
A service that keeps track of the execution state of Algorithm.
IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t
std::vector< AlgStateMap_t > m_algStates
std::unordered_map< Gaudi::StringKey, std::atomic< unsigned int > > m_errorCount
unsigned int algErrorCount(const IAlgorithm *iAlg) const override
void addAlg(const Gaudi::StringKey &algName) override
void updateEventStatus(const bool &b, const EventContext &ctx) override
std::once_flag m_initFlag
void dump(std::ostringstream &ost, const EventContext &ctx) const override
This class represents an entry point to all the event specific data.
Definition: EventContext.h:34
STL class.
void checkInit() const
The helper class to represent the efficient "key" for access.
Definition: StringKey.h:44
virtual const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const =0
const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const override
const AlgStateMap_t & algExecStates(const EventContext &ctx) const override
unsigned int incrementErrorCount(const IAlgorithm *iAlg) override
std::vector< Gaudi::StringKey > m_preInitAlgs
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:38
std::mutex m_mut
void reset(const EventContext &ctx) override
STL class.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
const EventStatus::Status & eventStatus(const EventContext &ctx) const override
std::vector< EventStatus::Status > m_eventStatus
void setEventStatus(const EventStatus::Status &sc, const EventContext &ctx) override
virtual void addAlg(const Gaudi::StringKey &algName)=0