| The Gaudi Framework v32r1 (f65d50dc)

HistorySvc.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_FASTHISTORYSVC_H
2 #define GAUDISVC_FASTHISTORYSVC_H
3
4 #include "GaudiKernel/IHistorySvc.h"
5
6 #include "GaudiKernel/AlgTool.h"
7 #include "GaudiKernel/IIncidentListener.h"
8 #include "GaudiKernel/IVersHistoryObj.h"
9 #include "GaudiKernel/Service.h"
10 #include "GaudiKernel/StatusCode.h"
11 #include <Gaudi/Algorithm.h>
12
13 #include "GaudiKernel/ClassID.h"
14 #include "GaudiKernel/MsgStream.h"
15 #include <fstream>
16 #include <map>
17 #include <set>
18 #include <string>
19 #include <vector>
20
21 class StoreGateSvc;
22 class IAlgContextSvc;
23 class IIncidentSvc;
24 class HistoryObj;
25 class DataHistory;
26 class AlgorithmHistory;
27 class ServiceHistory;
28 struct DHH;
29
36 class HistorySvc : public extends<Service, IHistorySvc, IIncidentListener> {
37 public:
38 using extends::extends;
39
40 StatusCode initialize() override;
41 StatusCode reinitialize() override;
42 StatusCode finalize() override;
43 StatusCode stop() override;
44
45 virtual StatusCode captureState();
46
47 StatusCode registerJob() override;
48 StatusCode listProperties() const override;
49 JobHistory* getJobHistory() const override;
50
51 StatusCode registerSvc( const IService& ) override;
52 StatusCode listProperties( const IService& ) const override;
53 ServiceHistory* getServiceHistory( const IService& ) const override;
54 void getServiceHistory( std::set<ServiceHistory*>& ) const override;
55
56 StatusCode registerAlg( const Gaudi::Algorithm& ) override;
57 StatusCode listProperties( const Gaudi::Algorithm& ) const override;
58 AlgorithmHistory* getAlgHistory( const Gaudi::Algorithm& ) const override;
59 void getAlgHistory( std::set<AlgorithmHistory*>& ) const override;
60
61 StatusCode registerAlgTool( const IAlgTool& ) override;
62 StatusCode listProperties( const IAlgTool& ) const override;
63 AlgToolHistory* getAlgToolHistory( const IAlgTool& ) const override;
64 void getAlgToolHistory( std::set<AlgToolHistory*>& ) const override;
65
66 DataHistory* createDataHistoryObj( const CLID& id, const std::string& key, const std::string& store ) override;
67 virtual StatusCode registerDataHistory( const CLID& id, const std::string& key, const std::string& store );
68 DataHistory* getDataHistory( const CLID& id, const std::string& key, const std::string& store ) const override;
69 virtual int getDataHistory( const CLID& id, const std::string& key, const std::string& storeName,
70 std::list<DataHistory*>& dhlist ) const;
71
72 void handle( const Incident& inc ) override;
73
74 private:
75 // typedef std::map<const CLID, std::map<const std::string, DataHistory*> >
76 // DataHistMap;
77
78 typedef IVersHistoryObj::PropertyList PropertyList;
79
80 typedef std::multimap<DHH, DataHistory*> DataHistMap;
81 typedef DataHistMap::iterator DHMitr;
82 typedef DataHistMap::const_iterator DHMCitr;
83
84 Gaudi::Property<bool> m_dump{this, "Dump", false};
85 Gaudi::Property<bool> m_activate{this, "Activate", true};
86 Gaudi::Property<std::string> m_outputFile{this, "OutputFile"};
87
88 void clearState();
89
90 bool m_isInitialized = false;
91
92 IAlgContextSvc* p_algCtxSvc = nullptr;
93
94 std::map<const Gaudi::Algorithm*, AlgorithmHistory*> m_algmap;
95
96 std::set<const IAlgTool*> m_ialgtools;
97 std::map<const AlgTool*, AlgToolHistory*> m_algtoolmap;
98 std::map<const IService*, ServiceHistory*> m_svcmap;
99
100 std::multimap<DHH, DataHistory*> m_datMap;
101
102 std::unique_ptr<JobHistory> m_jobHistory;
103
104 void dumpProperties( std::ofstream& ) const;
105 void dumpProperties( const IService&, std::ofstream& ) const;
106 void dumpProperties( const Gaudi::Algorithm&, std::ofstream& ) const;
107 void dumpProperties( const IAlgTool&, std::ofstream& ) const;
108
109 void dumpState( std::ofstream& ) const;
110 void dumpState( const INamedInterface*, std::ofstream& ) const;
111
112 std::string dumpProp( const Gaudi::Details::PropertyBase*, const bool isXML = false, int indent = 0 ) const;
113
114 IAlgorithm* getCurrentIAlg() const;
115
116 IIncidentSvc* m_incidentSvc = nullptr;
117 SmartIF<IToolSvc> m_toolSvc;
118
119 bool m_outputFileTypeXML = false;
120 };
121
122 #endif
HistorySvc::reinitialize
StatusCode reinitialize() override
Definition: HistorySvc.cpp:77
HistorySvc::dumpState
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:673
SmartIF< IToolSvc >
ClassID.h
HistorySvc::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Definition: HistorySvc.h:117
HistorySvc::getCurrentIAlg
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:398
HistorySvc::registerSvc
StatusCode registerSvc(const IService &) override
Definition: HistorySvc.cpp:495
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
HistorySvc::registerAlgTool
StatusCode registerAlgTool(const IAlgTool &) override
Definition: HistorySvc.cpp:563
MsgStream.h
DHH
Definition: HistorySvc.cpp:60
AlgorithmHistory
AlgorithmHistory class definition.
Definition: AlgorithmHistory.h:28
HistorySvc::initialize
StatusCode initialize() override
Definition: HistorySvc.cpp:111
AlgTool.h
HistorySvc::registerDataHistory
virtual StatusCode registerDataHistory(const CLID &id, const std::string &key, const std::string &store)
Definition: HistorySvc.cpp:434
HistorySvc::getJobHistory
JobHistory * getJobHistory() const override
Definition: HistorySvc.cpp:395
HistorySvc::stop
StatusCode stop() override
Definition: HistorySvc.cpp:234
HistorySvc
HistorySvc class definition.
Definition: HistorySvc.h:36
HistoryObj
Base class for History Objects.
Definition: HistoryObj.h:21
HistorySvc::getAlgHistory
AlgorithmHistory * getAlgHistory(const Gaudi::Algorithm &) const override
Definition: HistorySvc.cpp:324
HistorySvc::m_datMap
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:100
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:97
JobHistory
JobHistory class definition.
Definition: JobHistory.h:22
std::map< const Gaudi::Algorithm *, AlgorithmHistory * >
IVersHistoryObj.h
HistorySvc::handle
void handle(const Incident &inc) override
Definition: HistorySvc.cpp:645
HistorySvc::DataHistMap
std::multimap< DHH, DataHistory * > DataHistMap
Definition: HistorySvc.h:80
std::string
STL class.
Service.h
HistorySvc::getAlgToolHistory
AlgToolHistory * getAlgToolHistory(const IAlgTool &) const override
Definition: HistorySvc.cpp:628
std::ofstream
STL class.
HistorySvc::dumpProperties
void dumpProperties(std::ofstream &) const
Definition: HistorySvc.cpp:377
HistorySvc::m_dump
Gaudi::Property< bool > m_dump
Definition: HistorySvc.h:84
HistorySvc::m_isInitialized
bool m_isInitialized
Definition: HistorySvc.h:90
Algorithm.h
IService
General service interface definition.
Definition: IService.h:18
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
HistorySvc::m_outputFileTypeXML
bool m_outputFileTypeXML
Definition: HistorySvc.h:119
DataHistory
DataHistory class definition.
Definition: DataHistory.h:23
HistorySvc::p_algCtxSvc
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:92
IHistorySvc.h
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
HistorySvc::DHMCitr
DataHistMap::const_iterator DHMCitr
Definition: HistorySvc.h:82
std::list
STL class.
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
HistorySvc::finalize
StatusCode finalize() override
Definition: HistorySvc.cpp:257
std::multimap< DHH, DataHistory * >
AlgToolHistory
AlgToolHistory class definition.
Definition: AlgToolHistory.h:22
HistorySvc::m_incidentSvc
IIncidentSvc * m_incidentSvc
Definition: HistorySvc.h:116
INamedInterface
IInterface compliant class extending IInterface with the name() method.
Definition: INamedInterface.h:15
std::set
STL class.
std::vector< Gaudi::Details::PropertyBase * >
std::unique_ptr< JobHistory >
HistorySvc::dumpProp
std::string dumpProp(const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:656
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
HistorySvc::createDataHistoryObj
DataHistory * createDataHistoryObj(const CLID &id, const std::string &key, const std::string &store) override
Definition: HistorySvc.cpp:407
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
HistorySvc::registerJob
StatusCode registerJob() override
Definition: HistorySvc.cpp:338
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
HistorySvc::getServiceHistory
ServiceHistory * getServiceHistory(const IService &) const override
Definition: HistorySvc.cpp:522
ServiceHistory
ServiceHistory class definition.
Definition: ServiceHistory.h:21
HistorySvc::PropertyList
IVersHistoryObj::PropertyList PropertyList
Definition: HistorySvc.h:78
IAlgContextSvc
An abstract interface for Algorithm Context Service.
Definition: IAlgContextSvc.h:23
IIncidentListener.h
HistorySvc::m_algmap
std::map< const Gaudi::Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:94
StatusCode.h
HistorySvc::m_outputFile
Gaudi::Property< std::string > m_outputFile
Definition: HistorySvc.h:86
HistorySvc::m_ialgtools
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:96
HistorySvc::registerAlg
StatusCode registerAlg(const Gaudi::Algorithm &) override
Definition: HistorySvc.cpp:276
HistorySvc::DHMitr
DataHistMap::iterator DHMitr
Definition: HistorySvc.h:81
HistorySvc::clearState
void clearState()
Definition: HistorySvc.cpp:100
HistorySvc::listProperties
StatusCode listProperties() const override
Definition: HistorySvc.cpp:341
HistorySvc::captureState
virtual StatusCode captureState()
Definition: HistorySvc.cpp:160
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:98
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
HistorySvc::m_activate
Gaudi::Property< bool > m_activate
Definition: HistorySvc.h:85
HistorySvc::getDataHistory
DataHistory * getDataHistory(const CLID &id, const std::string &key, const std::string &store) const override
Definition: HistorySvc.cpp:467
HistorySvc::m_jobHistory
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:102