The Gaudi Framework  v33r1 (b1225454)
HistorySvc.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 #ifndef GAUDISVC_FASTHISTORYSVC_H
12 #define GAUDISVC_FASTHISTORYSVC_H
13 
15 
16 #include "GaudiKernel/AlgTool.h"
19 #include "GaudiKernel/Service.h"
20 #include "GaudiKernel/StatusCode.h"
21 #include <Gaudi/Algorithm.h>
22 
23 #include "GaudiKernel/ClassID.h"
24 #include "GaudiKernel/MsgStream.h"
25 #include <fstream>
26 #include <map>
27 #include <set>
28 #include <string>
29 #include <vector>
30 
31 class StoreGateSvc;
32 class IAlgContextSvc;
33 class IIncidentSvc;
34 class HistoryObj;
35 class DataHistory;
36 class AlgorithmHistory;
37 class ServiceHistory;
38 struct DHH;
39 
46 class HistorySvc : public extends<Service, IHistorySvc, IIncidentListener> {
47 public:
48  using extends::extends;
49 
50  StatusCode initialize() override;
51  StatusCode reinitialize() override;
52  StatusCode finalize() override;
53  StatusCode stop() override;
54 
55  virtual StatusCode captureState();
56 
57  StatusCode registerJob() override;
58  StatusCode listProperties() const override;
59  JobHistory* getJobHistory() const override;
60 
61  StatusCode registerSvc( const IService& ) override;
62  StatusCode listProperties( const IService& ) const override;
63  ServiceHistory* getServiceHistory( const IService& ) const override;
64  void getServiceHistory( std::set<ServiceHistory*>& ) const override;
65 
66  StatusCode registerAlg( const Gaudi::Algorithm& ) override;
67  StatusCode listProperties( const Gaudi::Algorithm& ) const override;
68  AlgorithmHistory* getAlgHistory( const Gaudi::Algorithm& ) const override;
69  void getAlgHistory( std::set<AlgorithmHistory*>& ) const override;
70 
71  StatusCode registerAlgTool( const IAlgTool& ) override;
72  StatusCode listProperties( const IAlgTool& ) const override;
73  AlgToolHistory* getAlgToolHistory( const IAlgTool& ) const override;
74  void getAlgToolHistory( std::set<AlgToolHistory*>& ) const override;
75 
76  DataHistory* createDataHistoryObj( const CLID& id, const std::string& key, const std::string& store ) override;
77  virtual StatusCode registerDataHistory( const CLID& id, const std::string& key, const std::string& store );
78  DataHistory* getDataHistory( const CLID& id, const std::string& key, const std::string& store ) const override;
79  virtual int getDataHistory( const CLID& id, const std::string& key, const std::string& storeName,
80  std::list<DataHistory*>& dhlist ) const;
81 
82  void handle( const Incident& inc ) override;
83 
84 private:
85  // typedef std::map<const CLID, std::map<const std::string, DataHistory*> >
86  // DataHistMap;
87 
89 
91  typedef DataHistMap::iterator DHMitr;
92  typedef DataHistMap::const_iterator DHMCitr;
93 
94  Gaudi::Property<bool> m_dump{this, "Dump", false};
95  Gaudi::Property<bool> m_activate{this, "Activate", true};
97 
98  void clearState();
99 
100  bool m_isInitialized = false;
101 
103 
105 
109 
111 
113 
114  void dumpProperties( std::ofstream& ) const;
115  void dumpProperties( const IService&, std::ofstream& ) const;
116  void dumpProperties( const Gaudi::Algorithm&, std::ofstream& ) const;
117  void dumpProperties( const IAlgTool&, std::ofstream& ) const;
118 
119  void dumpState( std::ofstream& ) const;
120  void dumpState( const INamedInterface*, std::ofstream& ) const;
121 
122  std::string dumpProp( const Gaudi::Details::PropertyBase*, const bool isXML = false, int indent = 0 ) const;
123 
124  IAlgorithm* getCurrentIAlg() const;
125 
128 
129  bool m_outputFileTypeXML = false;
130 };
131 
132 #endif
StatusCode reinitialize() override
Definition: HistorySvc.cpp:87
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:683
SmartIF< IToolSvc > m_toolSvc
Definition: HistorySvc.h:127
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:408
StatusCode registerSvc(const IService &) override
Definition: HistorySvc.cpp:505
Implementation of property with value of concrete type.
Definition: Property.h:370
StatusCode registerAlgTool(const IAlgTool &) override
Definition: HistorySvc.cpp:573
AlgorithmHistory class definition.
StatusCode initialize() override
Definition: HistorySvc.cpp:121
virtual StatusCode registerDataHistory(const CLID &id, const std::string &key, const std::string &store)
Definition: HistorySvc.cpp:444
JobHistory * getJobHistory() const override
Definition: HistorySvc.cpp:405
StatusCode stop() override
Definition: HistorySvc.cpp:244
HistorySvc class definition.
Definition: HistorySvc.h:46
Base class for History Objects.
Definition: HistoryObj.h:31
AlgorithmHistory * getAlgHistory(const Gaudi::Algorithm &) const override
Definition: HistorySvc.cpp:334
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:110
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:107
JobHistory class definition.
Definition: JobHistory.h:32
void handle(const Incident &inc) override
Definition: HistorySvc.cpp:655
std::multimap< DHH, DataHistory * > DataHistMap
Definition: HistorySvc.h:90
STL class.
AlgToolHistory * getAlgToolHistory(const IAlgTool &) const override
Definition: HistorySvc.cpp:638
STL class.
void dumpProperties(std::ofstream &) const
Definition: HistorySvc.cpp:387
Gaudi::Property< bool > m_dump
Definition: HistorySvc.h:94
bool m_isInitialized
Definition: HistorySvc.h:100
General service interface definition.
Definition: IService.h:28
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool m_outputFileTypeXML
Definition: HistorySvc.h:129
DataHistory class definition.
Definition: DataHistory.h:33
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:102
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:42
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
DataHistMap::const_iterator DHMCitr
Definition: HistorySvc.h:92
STL class.
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:38
StatusCode finalize() override
Definition: HistorySvc.cpp:267
AlgToolHistory class definition.
IIncidentSvc * m_incidentSvc
Definition: HistorySvc.h:126
IInterface compliant class extending IInterface with the name() method.
STL class.
std::string dumpProp(const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:666
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
DataHistory * createDataHistoryObj(const CLID &id, const std::string &key, const std::string &store) override
Definition: HistorySvc.cpp:417
Base class for all Incidents (computing events).
Definition: Incident.h:27
StatusCode registerJob() override
Definition: HistorySvc.cpp:348
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:33
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:89
ServiceHistory * getServiceHistory(const IService &) const override
Definition: HistorySvc.cpp:532
ServiceHistory class definition.
IVersHistoryObj::PropertyList PropertyList
Definition: HistorySvc.h:88
An abstract interface for Algorithm Context Service.
std::map< const Gaudi::Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:104
Gaudi::Property< std::string > m_outputFile
Definition: HistorySvc.h:96
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:106
StatusCode registerAlg(const Gaudi::Algorithm &) override
Definition: HistorySvc.cpp:286
DataHistMap::iterator DHMitr
Definition: HistorySvc.h:91
void clearState()
Definition: HistorySvc.cpp:110
StatusCode listProperties() const override
Definition: HistorySvc.cpp:351
virtual StatusCode captureState()
Definition: HistorySvc.cpp:170
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:108
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:33
Gaudi::Property< bool > m_activate
Definition: HistorySvc.h:95
DataHistory * getDataHistory(const CLID &id, const std::string &key, const std::string &store) const override
Definition: HistorySvc.cpp:477
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:112