All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HistorySvc.h
Go to the documentation of this file.
1 // $Id: HistorySvc.h,v 1.8 2008/06/04 12:35:15 marcocle Exp $
2 
3 #ifndef GAUDISVC_FASTHISTORYSVC_H
4 #define GAUDISVC_FASTHISTORYSVC_H
5 
7 
8 #ifndef GAUDIKERNEL_SERVICE_H
9  #include "GaudiKernel/Service.h"
10 #endif
11 #ifndef KERNEL_STATUSCODES_H
12  #include "GaudiKernel/StatusCode.h"
13 #endif
14 
15 #include "GaudiKernel/Algorithm.h"
16 #include "GaudiKernel/AlgTool.h"
19 
20 #include <vector>
21 #include <string>
22 #include <set>
23 #include <map>
24 #include <fstream>
25 #include "GaudiKernel/ClassID.h"
26 #include "GaudiKernel/MsgStream.h"
27 
28 class StoreGateSvc;
29 class IAlgContextSvc;
30 class IIncidentSvc;
31 class HistoryObj;
32 class DataHistory;
33 class AlgorithmHistory;
34 class ServiceHistory;
35 struct DHH;
36 
43 class HistorySvc: public extends2<Service, IHistorySvc, 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();
90 
91 private:
92 
93 // typedef std::map<const CLID, std::map<const std::string, DataHistory*> >
94 // DataHistMap;
95 
97 
98  typedef std::multimap<DHH,DataHistory*> DataHistMap;
99  typedef DataHistMap::iterator DHMitr;
100  typedef DataHistMap::const_iterator DHMCitr;
101 
102  void clearState();
103 
105  bool m_dump;
107 
109 
110  std::set<const Algorithm*> m_algs;
111  std::map<const Algorithm*, AlgorithmHistory*> m_algmap;
112 
113  std::set<const IAlgTool*> m_ialgtools;
114  std::set<const AlgTool*> m_algtools;
115  std::map<const AlgTool*, AlgToolHistory*> m_algtoolmap;
116 
117  std::set<const IService*> m_svcs;
118  std::map<const IService*, ServiceHistory*> m_svcmap;
119 
120  std::multimap<DHH, DataHistory*> m_datMap;
121 
122 // std::set<DataHistory*, DataHistory::DataHistoryOrder> m_datMap;
123 
125 
126  std::string m_outputFile;
127 
128  void dumpProperties(std::ofstream&) const;
129  void dumpProperties(const IService&, std::ofstream&) const;
130  void dumpProperties(const Algorithm&, std::ofstream&) const;
131  void dumpProperties(const IAlgTool&, std::ofstream&) const;
132 
133  void dumpState(std::ofstream&) const;
134  void dumpState(const INamedInterface*, std::ofstream&) const;
135 
136  std::string dumpProp(const Property*, const bool isXML=false,
137  int indent=0) const;
138 
139  IAlgorithm* getCurrentIAlg() const;
140 
143 
144  mutable MsgStream m_log;
146 
147 };
148 
149 #endif
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
Definition: HistorySvc.cpp:299
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual ServiceHistory * getServiceHistory(const IService &) const
Definition: HistorySvc.cpp:751
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
SmartIF< IToolSvc > m_toolSvc
Definition: HistorySvc.h:142
AlgorithmHistory class definition.
virtual StatusCode registerDataHistory(const CLID &id, const std::string &key, const std::string &store)
Definition: HistorySvc.cpp:631
virtual StatusCode listProperties() const
Definition: HistorySvc.cpp:466
virtual StatusCode registerJob()
Definition: HistorySvc.cpp:455
std::vector< Property * > PropertyList
HistorySvc class definition.
Definition: HistorySvc.h:43
Base class for History Objects.
Definition: HistoryObj.h:24
std::multimap< DHH, DataHistory * > DataHistMap
Definition: HistorySvc.h:98
Base class used to extend a class implementing other interfaces.
Definition: extends.h:75
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:120
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:115
JobHistory class definition.
Definition: JobHistory.h:25
std::string m_outputFile
Definition: HistorySvc.h:126
virtual ~HistorySvc()
Definition: HistorySvc.cpp:87
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:578
virtual AlgToolHistory * getAlgToolHistory(const IAlgTool &) const
Definition: HistorySvc.cpp:915
virtual void handle(const Incident &inc)
Inform that a new incident has occurred.
Definition: HistorySvc.cpp:949
bool m_activate
Definition: HistorySvc.h:106
std::set< const Algorithm * > m_algs
Definition: HistorySvc.h:110
bool m_isInitialized
Definition: HistorySvc.h:104
General service interface definition.
Definition: IService.h:19
virtual StatusCode registerSvc(const IService &)
Definition: HistorySvc.cpp:715
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
HistorySvc(const std::string &name, ISvcLocator *svc)
Definition: HistorySvc.cpp:64
bool m_outputFileTypeXML
Definition: HistorySvc.h:145
virtual StatusCode registerAlgTool(const IAlgTool &)
Definition: HistorySvc.cpp:826
DataHistory class definition.
Definition: DataHistory.h:25
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:108
JobHistory * m_jobHistory
Definition: HistorySvc.h:124
virtual StatusCode registerAlg(const Algorithm &)
Definition: HistorySvc.cpp:353
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: HistorySvc.cpp:136
virtual AlgorithmHistory * getAlgHistory(const Algorithm &) const
Definition: HistorySvc.cpp:422
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: HistorySvc.cpp:330
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
DataHistMap::const_iterator DHMCitr
Definition: HistorySvc.h:100
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
MsgStream m_log
Definition: HistorySvc.h:144
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:964
AlgToolHistory class definition.
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:984
IIncidentSvc * m_incidentSvc
Definition: HistorySvc.h:141
virtual DataHistory * createDataHistoryObj(const CLID &id, const std::string &key, const std::string &store)
Definition: HistorySvc.cpp:593
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
IInterface compliant class extending IInterface with the name() method.
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
virtual DataHistory * getDataHistory(const CLID &id, const std::string &key, const std::string &store) const
Definition: HistorySvc.cpp:675
void dumpProperties(std::ofstream &) const
Definition: HistorySvc.cpp:526
Base class for all Incidents (computing events).
Definition: Incident.h:16
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ServiceHistory class definition.
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:111
IVersHistoryObj::PropertyList PropertyList
Definition: HistorySvc.h:96
An abstract interface for Algorithm Context Service.
bool m_dump
Definition: HistorySvc.h:105
std::set< const IService * > m_svcs
Definition: HistorySvc.h:117
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:113
DataHistMap::iterator DHMitr
Definition: HistorySvc.h:99
void clearState()
Definition: HistorySvc.cpp:105
virtual StatusCode captureState()
Definition: HistorySvc.cpp:195
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:118
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:22
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition: HistorySvc.cpp:93
std::set< const AlgTool * > m_algtools
Definition: HistorySvc.h:114
virtual JobHistory * getJobHistory() const
Definition: HistorySvc.cpp:570