| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# HistorySvc.h

Go to the documentation of this file.

    00001 // $Id: HistorySvc.h,v 1.8 2008/06/04 12:35:15 marcocle Exp $
    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
    00019 #include <vector>
    00020 #include <string>
    00021 #include <set>
    00022 #include <map>
    00023 #include <fstream>
    00024 #include "GaudiKernel/ClassID.h"
    00025 #include "GaudiKernel/MsgStream.h"
    00026
    00027 class StoreGateSvc;
    00028 class IAlgContextSvc;
    00029 class IIncidentSvc;
    00030 class HistoryObj;
    00031 class DataHistory;
    00032 class AlgorithmHistory;
    00033 class ServiceHistory;
    00034 struct DHH;
    00035
    00036 // Forward declarations
    00037 template <class TYPE> class SvcFactory;
    00038
    00045 class HistorySvc: public extends2<Service, IHistorySvc, IIncidentListener> {
    00046 public:
    00047
    00048   virtual StatusCode initialize();
    00049   virtual StatusCode reinitialize();
    00050   virtual StatusCode finalize();
    00051
    00052   virtual StatusCode captureState();
    00053
    00054   virtual StatusCode registerJob();
    00055   virtual StatusCode listProperties() const;
    00056   virtual JobHistory* getJobHistory() const;
    00057
    00058   virtual StatusCode registerSvc(const IService&);
    00059   virtual StatusCode listProperties(const IService&) const;
    00060   virtual ServiceHistory* getServiceHistory(const IService&) const;
    00061   virtual void getServiceHistory(std::set<ServiceHistory*>&) const;
    00062
    00063   virtual StatusCode registerAlg(const Algorithm&);
    00064   virtual StatusCode listProperties(const Algorithm&) const;
    00065   virtual AlgorithmHistory* getAlgHistory(const Algorithm&) const;
    00066   virtual void getAlgHistory(std::set<AlgorithmHistory*>&) const;
    00067
    00068   virtual StatusCode registerAlgTool(const IAlgTool&);
    00069   virtual StatusCode listProperties(const IAlgTool&) const;
    00070   virtual AlgToolHistory* getAlgToolHistory(const IAlgTool&) const;
    00071   virtual void getAlgToolHistory(std::set<AlgToolHistory*>&) const;
    00072
    00073   virtual DataHistory* createDataHistoryObj(const CLID& id,
    00074                                             const std::string& key,
    00075                                             const std::string& store);
    00076   virtual StatusCode registerDataHistory(const CLID& id,
    00077                                          const std::string& key,
    00078                                          const std::string& store);
    00079   virtual DataHistory* getDataHistory(const CLID& id, const std::string& key,
    00080                                       const std::string& store) const;
    00081   virtual int getDataHistory(const CLID& id, const std::string& key,
    00082                              const std::string& storeName,
    00083                              std::list<DataHistory*>& dhlist) const;
    00084
    00085   HistorySvc( const std::string& name, ISvcLocator* svc );
    00086
    00087   virtual void handle(const Incident& inc);
    00088
    00089   // Destructor.
    00090   virtual ~HistorySvc();
    00091
    00092 private:
    00093
    00094 //   typedef std::map<const CLID, std::map<const std::string, DataHistory*> >
    00095 //           DataHistMap;
    00096
    00097   typedef std::multimap<DHH,DataHistory*> DataHistMap;
    00098   typedef DataHistMap::iterator DHMitr;
    00099   typedef DataHistMap::const_iterator DHMCitr;
    00100
    00101   void clearState();
    00102
    00103   // Allow SvcFactory to instantiate the service.
    00104   friend class SvcFactory<HistorySvc>;
    00105
    00106   bool m_isInitialized;
    00107   bool m_dump;
    00108   bool m_activate;
    00109
    00110   IAlgContextSvc *p_algCtxSvc;
    00111
    00112   std::set<const Algorithm*> m_algs;
    00113   std::map<const Algorithm*, AlgorithmHistory*> m_algmap;
    00114
    00115   std::set<const IAlgTool*> m_ialgtools;
    00116   std::set<const AlgTool*> m_algtools;
    00117   std::map<const AlgTool*, AlgToolHistory*> m_algtoolmap;
    00118
    00119   std::set<const IService*> m_svcs;
    00120   std::map<const IService*, ServiceHistory*> m_svcmap;
    00121
    00122   std::multimap<DHH, DataHistory*> m_datMap;
    00123
    00124 //   std::set<DataHistory*, DataHistory::DataHistoryOrder> m_datMap;
    00125
    00126   JobHistory *m_jobHistory;
    00127
    00128   std::string m_outputFile;
    00129
    00130   void dumpProperties(std::ofstream&) const;
    00131   void dumpProperties(const IService&,  std::ofstream&) const;
    00132   void dumpProperties(const Algorithm&, std::ofstream&) const;
    00133   void dumpProperties(const IAlgTool&,  std::ofstream&) const;
    00134
    00135   void dumpState(std::ofstream&) const;
    00136   void dumpState(const IService&,  std::ofstream&) const;
    00137   void dumpState(const Algorithm&, std::ofstream&) const;
    00138   void dumpState(const IAlgTool&,  std::ofstream&) const;
    00139
    00140   std::string dumpProp(const Property*) const;
    00141
    00142   IAlgorithm* getCurrentIAlg() const;
    00143
    00144   IIncidentSvc *m_incidentSvc;
    00145
    00146   mutable MsgStream m_log;
    00147
    00148 };
    00149
    00150 #endif