Go to the documentation of this file.00001
00002
00003 #ifndef GAUDISVC_FASTHISTORYSVC_H
00004 #define GAUDISVC_FASTHISTORYSVC_H
00005
00006 #include "GaudiKernel/IHistorySvc.h"
00007
00008 #ifndef GAUDIKERNEL_SERVICE_H
00009 #include "GaudiKernel/Service.h"
00010 #endif
00011 #ifndef KERNEL_STATUSCODES_H
00012 #include "GaudiKernel/StatusCode.h"
00013 #endif
00014
00015 #include "GaudiKernel/Algorithm.h"
00016 #include "GaudiKernel/AlgTool.h"
00017 #include "GaudiKernel/IIncidentListener.h"
00018 #include "GaudiKernel/IVersHistoryObj.h"
00019
00020 #include <vector>
00021 #include <string>
00022 #include <set>
00023 #include <map>
00024 #include <fstream>
00025 #include "GaudiKernel/ClassID.h"
00026 #include "GaudiKernel/MsgStream.h"
00027
00028 class StoreGateSvc;
00029 class IAlgContextSvc;
00030 class IIncidentSvc;
00031 class HistoryObj;
00032 class DataHistory;
00033 class AlgorithmHistory;
00034 class ServiceHistory;
00035 struct DHH;
00036
00037
00038 template <class TYPE> class SvcFactory;
00039
00046 class HistorySvc: public extends2<Service, IHistorySvc, IIncidentListener> {
00047 public:
00048
00049 virtual StatusCode initialize();
00050 virtual StatusCode reinitialize();
00051 virtual StatusCode finalize();
00052 virtual StatusCode stop();
00053
00054 virtual StatusCode captureState();
00055
00056 virtual StatusCode registerJob();
00057 virtual StatusCode listProperties() const;
00058 virtual JobHistory* getJobHistory() const;
00059
00060 virtual StatusCode registerSvc(const IService&);
00061 virtual StatusCode listProperties(const IService&) const;
00062 virtual ServiceHistory* getServiceHistory(const IService&) const;
00063 virtual void getServiceHistory(std::set<ServiceHistory*>&) const;
00064
00065 virtual StatusCode registerAlg(const Algorithm&);
00066 virtual StatusCode listProperties(const Algorithm&) const;
00067 virtual AlgorithmHistory* getAlgHistory(const Algorithm&) const;
00068 virtual void getAlgHistory(std::set<AlgorithmHistory*>&) const;
00069
00070 virtual StatusCode registerAlgTool(const IAlgTool&);
00071 virtual StatusCode listProperties(const IAlgTool&) const;
00072 virtual AlgToolHistory* getAlgToolHistory(const IAlgTool&) const;
00073 virtual void getAlgToolHistory(std::set<AlgToolHistory*>&) const;
00074
00075 virtual DataHistory* createDataHistoryObj(const CLID& id,
00076 const std::string& key,
00077 const std::string& store);
00078 virtual StatusCode registerDataHistory(const CLID& id,
00079 const std::string& key,
00080 const std::string& store);
00081 virtual DataHistory* getDataHistory(const CLID& id, const std::string& key,
00082 const std::string& store) const;
00083 virtual int getDataHistory(const CLID& id, const std::string& key,
00084 const std::string& storeName,
00085 std::list<DataHistory*>& dhlist) const;
00086
00087 HistorySvc( const std::string& name, ISvcLocator* svc );
00088
00089 virtual void handle(const Incident& inc);
00090
00091
00092 virtual ~HistorySvc();
00093
00094 private:
00095
00096
00097
00098
00099 typedef IVersHistoryObj::PropertyList PropertyList;
00100
00101 typedef std::multimap<DHH,DataHistory*> DataHistMap;
00102 typedef DataHistMap::iterator DHMitr;
00103 typedef DataHistMap::const_iterator DHMCitr;
00104
00105 void clearState();
00106
00107
00108 friend class SvcFactory<HistorySvc>;
00109
00110 bool m_isInitialized;
00111 bool m_dump;
00112 bool m_activate;
00113
00114 IAlgContextSvc *p_algCtxSvc;
00115
00116 std::set<const Algorithm*> m_algs;
00117 std::map<const Algorithm*, AlgorithmHistory*> m_algmap;
00118
00119 std::set<const IAlgTool*> m_ialgtools;
00120 std::set<const AlgTool*> m_algtools;
00121 std::map<const AlgTool*, AlgToolHistory*> m_algtoolmap;
00122
00123 std::set<const IService*> m_svcs;
00124 std::map<const IService*, ServiceHistory*> m_svcmap;
00125
00126 std::multimap<DHH, DataHistory*> m_datMap;
00127
00128
00129
00130 JobHistory *m_jobHistory;
00131
00132 std::string m_outputFile;
00133
00134 void dumpProperties(std::ofstream&) const;
00135 void dumpProperties(const IService&, std::ofstream&) const;
00136 void dumpProperties(const Algorithm&, std::ofstream&) const;
00137 void dumpProperties(const IAlgTool&, std::ofstream&) const;
00138
00139 void dumpState(std::ofstream&) const;
00140 void dumpState(const INamedInterface*, std::ofstream&) const;
00141
00142 std::string dumpProp(const Property*, const bool isXML=false,
00143 int indent=0) const;
00144
00145 IAlgorithm* getCurrentIAlg() const;
00146
00147 IIncidentSvc *m_incidentSvc;
00148 SmartIF<IToolSvc> m_toolSvc;
00149
00150 mutable MsgStream m_log;
00151 bool m_outputFileTypeXML;
00152
00153 };
00154
00155 #endif