| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 #ifndef GAUDIKERNEL_SERVICE_H
7 #include "GaudiKernel/Service.h"
8 #endif
9 #ifndef KERNEL_STATUSCODES_H
10 #include "GaudiKernel/StatusCode.h"
11 #endif
12
13 #include "GaudiKernel/Algorithm.h"
14 #include "GaudiKernel/AlgTool.h"
15 #include "GaudiKernel/IIncidentListener.h"
16 #include "GaudiKernel/IVersHistoryObj.h"
17
18 #include <vector>
19 #include <string>
20 #include <set>
21 #include <map>
22 #include <fstream>
23 #include "GaudiKernel/ClassID.h"
24 #include "GaudiKernel/MsgStream.h"
25
26 class StoreGateSvc;
27 class IAlgContextSvc;
28 class IIncidentSvc;
29 class HistoryObj;
30 class DataHistory;
31 class AlgorithmHistory;
32 class ServiceHistory;
33 struct DHH;
34
41 class HistorySvc: public extends<Service,
42 IHistorySvc,
43 IIncidentListener> {
44 public:
45
46 virtual StatusCode initialize();
47 virtual StatusCode reinitialize();
48 virtual StatusCode finalize();
49 virtual StatusCode stop();
50
51 virtual StatusCode captureState();
52
53 virtual StatusCode registerJob();
54 virtual StatusCode listProperties() const;
55 virtual JobHistory* getJobHistory() const;
56
57 virtual StatusCode registerSvc(const IService&);
58 virtual StatusCode listProperties(const IService&) const;
59 virtual ServiceHistory* getServiceHistory(const IService&) const;
60 virtual void getServiceHistory(std::set<ServiceHistory*>&) const;
61
62 virtual StatusCode registerAlg(const Algorithm&);
63 virtual StatusCode listProperties(const Algorithm&) const;
64 virtual AlgorithmHistory* getAlgHistory(const Algorithm&) const;
65 virtual void getAlgHistory(std::set<AlgorithmHistory*>&) const;
66
67 virtual StatusCode registerAlgTool(const IAlgTool&);
68 virtual StatusCode listProperties(const IAlgTool&) const;
69 virtual AlgToolHistory* getAlgToolHistory(const IAlgTool&) const;
70 virtual void getAlgToolHistory(std::set<AlgToolHistory*>&) const;
71
72 virtual DataHistory* createDataHistoryObj(const CLID& id,
73 const std::string& key,
74 const std::string& store);
75 virtual StatusCode registerDataHistory(const CLID& id,
76 const std::string& key,
77 const std::string& store);
78 virtual DataHistory* getDataHistory(const CLID& id, const std::string& key,
79 const std::string& store) const;
80 virtual int getDataHistory(const CLID& id, const std::string& key,
81 const std::string& storeName,
82 std::list<DataHistory*>& dhlist) const;
83
84 HistorySvc( const std::string& name, ISvcLocator* svc );
85
86 virtual void handle(const Incident& inc);
87
88 // Destructor.
89 virtual ~HistorySvc() = default;
90
91 private:
92
93 // typedef std::map<const CLID, std::map<const std::string, DataHistory*> >
94 // DataHistMap;
95
96 typedef IVersHistoryObj::PropertyList PropertyList;
97
98 typedef std::multimap<DHH,DataHistory*> DataHistMap;
99 typedef DataHistMap::iterator DHMitr;
100 typedef DataHistMap::const_iterator DHMCitr;
101
102 void clearState();
103
104 bool m_isInitialized = false;
105 bool m_dump = false;
106 bool m_activate = true;
107
108 IAlgContextSvc *p_algCtxSvc = nullptr;
109
110 std::map<const Algorithm*, AlgorithmHistory*> m_algmap;
111
112 std::set<const IAlgTool*> m_ialgtools;
113 std::map<const AlgTool*, AlgToolHistory*> m_algtoolmap;
114 std::map<const IService*, ServiceHistory*> m_svcmap;
115
116 std::multimap<DHH, DataHistory*> m_datMap;
117
118 // std::set<DataHistory*, DataHistory::DataHistoryOrder> m_datMap;
119
120 std::unique_ptr<JobHistory> m_jobHistory;
121
122 std::string m_outputFile;
123
124 void dumpProperties(std::ofstream&) const;
125 void dumpProperties(const IService&, std::ofstream&) const;
126 void dumpProperties(const Algorithm&, std::ofstream&) const;
127 void dumpProperties(const IAlgTool&, std::ofstream&) const;
128
129 void dumpState(std::ofstream&) const;
130 void dumpState(const INamedInterface*, std::ofstream&) const;
131
132 std::string dumpProp(const Property*, const bool isXML=false,
133 int indent=0) const;
134
135 IAlgorithm* getCurrentIAlg() const;
136
137 IIncidentSvc *m_incidentSvc = nullptr;
138 SmartIF<IToolSvc> m_toolSvc;
139
140 mutable MsgStream m_log;
141 bool m_outputFileTypeXML = false;
142
143 };
144
145 #endif
HistorySvc::stop
virtual StatusCode stop()
Definition: HistorySvc.cpp:271
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Algorithm.h
HistorySvc::getServiceHistory
virtual ServiceHistory * getServiceHistory(const IService &) const
Definition: HistorySvc.cpp:632
SmartIF< IToolSvc >
ClassID.h
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
HistorySvc::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Definition: HistorySvc.h:138
MsgStream.h
DHH
Definition: HistorySvc.cpp:61
AlgorithmHistory
AlgorithmHistory class definition.
Definition: AlgorithmHistory.h:27
AlgTool.h
HistorySvc::registerDataHistory
virtual StatusCode registerDataHistory(const CLID &id, const std::string &key, const std::string &store)
Definition: HistorySvc.cpp:529
HistorySvc::listProperties
virtual StatusCode listProperties() const
Definition: HistorySvc.cpp:412
HistorySvc::registerJob
virtual StatusCode registerJob()
Definition: HistorySvc.cpp:401
HistorySvc
HistorySvc class definition.
Definition: HistorySvc.h:41
HistoryObj
Base class for History Objects.
Definition: HistoryObj.h:22
HistorySvc::DataHistMap
std::multimap< DHH, DataHistory * > DataHistMap
Definition: HistorySvc.h:98
HistorySvc::m_datMap
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:116
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:113
JobHistory
JobHistory class definition.
Definition: JobHistory.h:24
std::map< const Algorithm *, AlgorithmHistory * >
HistorySvc::m_outputFile
std::string m_outputFile
Definition: HistorySvc.h:122
IVersHistoryObj.h
HistorySvc::getCurrentIAlg
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:484
std::string
STL class.
Service.h
HistorySvc::getAlgToolHistory
virtual AlgToolHistory * getAlgToolHistory(const IAlgTool &) const
Definition: HistorySvc.cpp:759
HistorySvc::handle
virtual void handle(const Incident &inc)
Definition: HistorySvc.cpp:782
HistorySvc::m_activate
bool m_activate
Definition: HistorySvc.h:106
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
std::ofstream
STL class.
HistorySvc::m_isInitialized
bool m_isInitialized
Definition: HistorySvc.h:104
IService
General service interface definition.
Definition: IService.h:18
HistorySvc::registerSvc
virtual StatusCode registerSvc(const IService &)
Definition: HistorySvc.cpp:600
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
HistorySvc::HistorySvc
HistorySvc(const std::string &name, ISvcLocator *svc)
Definition: HistorySvc.cpp:76
HistorySvc::m_outputFileTypeXML
bool m_outputFileTypeXML
Definition: HistorySvc.h:141
HistorySvc::registerAlgTool
virtual StatusCode registerAlgTool(const IAlgTool &)
Definition: HistorySvc.cpp:684
DataHistory
DataHistory class definition.
Definition: DataHistory.h:23
HistorySvc::p_algCtxSvc
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:108
HistorySvc::registerAlg
virtual StatusCode registerAlg(const Algorithm &)
Definition: HistorySvc.cpp:320
HistorySvc::initialize
virtual StatusCode initialize()
Definition: HistorySvc.cpp:127
HistorySvc::getAlgHistory
virtual AlgorithmHistory * getAlgHistory(const Algorithm &) const
Definition: HistorySvc.cpp:381
IHistorySvc.h
HistorySvc::finalize
virtual StatusCode finalize()
Definition: HistorySvc.cpp:298
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
HistorySvc::DHMCitr
DataHistMap::const_iterator DHMCitr
Definition: HistorySvc.h:100
std::list
STL class.
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:25
HistorySvc::m_log
MsgStream m_log
Definition: HistorySvc.h:140
HistorySvc::dumpProp
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:797
std::multimap< DHH, DataHistory * >
AlgToolHistory
AlgToolHistory class definition.
Definition: AlgToolHistory.h:22
HistorySvc::dumpState
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:817
HistorySvc::m_incidentSvc
IIncidentSvc * m_incidentSvc
Definition: HistorySvc.h:137
HistorySvc::createDataHistoryObj
virtual DataHistory * createDataHistoryObj(const CLID &id, const std::string &key, const std::string &store)
Definition: HistorySvc.cpp:495
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
INamedInterface
IInterface compliant class extending IInterface with the name() method.
Definition: INamedInterface.h:15
std::set
STL class.
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
std::vector< Property * >
HistorySvc::getDataHistory
virtual DataHistory * getDataHistory(const CLID &id, const std::string &key, const std::string &store) const
Definition: HistorySvc.cpp:566
std::unique_ptr< JobHistory >
HistorySvc::dumpProperties
void dumpProperties(std::ofstream &) const
Definition: HistorySvc.cpp:456
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
project_manifest.indent
def indent
Definition: project_manifest.py:11
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ServiceHistory
ServiceHistory class definition.
Definition: ServiceHistory.h:22
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:110
HistorySvc::PropertyList
IVersHistoryObj::PropertyList PropertyList
Definition: HistorySvc.h:96
IAlgContextSvc
An abstract interface for Algorithm Context Service.
Definition: IAlgContextSvc.h:23
HistorySvc::m_dump
bool m_dump
Definition: HistorySvc.h:105
IIncidentListener.h
HistorySvc::~HistorySvc
virtual ~HistorySvc()=default
StatusCode.h
HistorySvc::m_ialgtools
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:112
HistorySvc::DHMitr
DataHistMap::iterator DHMitr
Definition: HistorySvc.h:99
HistorySvc::clearState
void clearState()
Definition: HistorySvc.cpp:115
HistorySvc::captureState
virtual StatusCode captureState()
Definition: HistorySvc.cpp:184
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:114
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21
HistorySvc::reinitialize
virtual StatusCode reinitialize()
Definition: HistorySvc.cpp:91
HistorySvc::getJobHistory
virtual JobHistory * getJobHistory() const
Definition: HistorySvc.cpp:476
HistorySvc::m_jobHistory
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:120