Gaudi Framework, version v22r1

Home   Generated: Mon Feb 28 2011

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   virtual StatusCode stop();
00052 
00053   virtual StatusCode captureState();
00054 
00055   virtual StatusCode registerJob();
00056   virtual StatusCode listProperties() const;
00057   virtual JobHistory* getJobHistory() const;
00058 
00059   virtual StatusCode registerSvc(const IService&);
00060   virtual StatusCode listProperties(const IService&) const;
00061   virtual ServiceHistory* getServiceHistory(const IService&) const;
00062   virtual void getServiceHistory(std::set<ServiceHistory*>&) const;
00063 
00064   virtual StatusCode registerAlg(const Algorithm&);
00065   virtual StatusCode listProperties(const Algorithm&) const;
00066   virtual AlgorithmHistory* getAlgHistory(const Algorithm&) const;
00067   virtual void getAlgHistory(std::set<AlgorithmHistory*>&) const;
00068 
00069   virtual StatusCode registerAlgTool(const IAlgTool&);
00070   virtual StatusCode listProperties(const IAlgTool&) const;
00071   virtual AlgToolHistory* getAlgToolHistory(const IAlgTool&) const;
00072   virtual void getAlgToolHistory(std::set<AlgToolHistory*>&) const;
00073 
00074   virtual DataHistory* createDataHistoryObj(const CLID& id,
00075                                             const std::string& key,
00076                                             const std::string& store);
00077   virtual StatusCode registerDataHistory(const CLID& id,
00078                                          const std::string& key,
00079                                          const std::string& store);
00080   virtual DataHistory* getDataHistory(const CLID& id, const std::string& key,
00081                                       const std::string& store) const;
00082   virtual int getDataHistory(const CLID& id, const std::string& key,
00083                              const std::string& storeName,
00084                              std::list<DataHistory*>& dhlist) const;
00085 
00086   HistorySvc( const std::string& name, ISvcLocator* svc );
00087 
00088   virtual void handle(const Incident& inc);
00089 
00090   // Destructor.
00091   virtual ~HistorySvc();
00092 
00093 private:
00094 
00095 //   typedef std::map<const CLID, std::map<const std::string, DataHistory*> >
00096 //           DataHistMap;
00097 
00098   typedef std::multimap<DHH,DataHistory*> DataHistMap;
00099   typedef DataHistMap::iterator DHMitr;
00100   typedef DataHistMap::const_iterator DHMCitr;
00101 
00102   void clearState();
00103 
00104   // Allow SvcFactory to instantiate the service.
00105   friend class SvcFactory<HistorySvc>;
00106 
00107   bool m_isInitialized;
00108   bool m_dump;
00109   bool m_activate;
00110 
00111   IAlgContextSvc *p_algCtxSvc;
00112 
00113   std::set<const Algorithm*> m_algs;
00114   std::map<const Algorithm*, AlgorithmHistory*> m_algmap;
00115 
00116   std::set<const IAlgTool*> m_ialgtools;
00117   std::set<const AlgTool*> m_algtools;
00118   std::map<const AlgTool*, AlgToolHistory*> m_algtoolmap;
00119 
00120   std::set<const IService*> m_svcs;
00121   std::map<const IService*, ServiceHistory*> m_svcmap;
00122 
00123   std::multimap<DHH, DataHistory*> m_datMap;
00124 
00125 //   std::set<DataHistory*, DataHistory::DataHistoryOrder> m_datMap;
00126 
00127   JobHistory *m_jobHistory;
00128 
00129   std::string m_outputFile;
00130 
00131   void dumpProperties(std::ofstream&) const;
00132   void dumpProperties(const IService&,  std::ofstream&) const;
00133   void dumpProperties(const Algorithm&, std::ofstream&) const;
00134   void dumpProperties(const IAlgTool&,  std::ofstream&) const;
00135 
00136   void dumpState(std::ofstream&) const;
00137   void dumpState(const IService&,  std::ofstream&) const;
00138   void dumpState(const Algorithm&, std::ofstream&) const;
00139   void dumpState(const IAlgTool&,  std::ofstream&) const;
00140 
00141   std::string dumpProp(const Property*) const;
00142 
00143   IAlgorithm* getCurrentIAlg() const;
00144 
00145   IIncidentSvc *m_incidentSvc;
00146   SmartIF<IToolSvc> m_toolSvc;
00147 
00148   mutable MsgStream m_log;
00149 
00150 };
00151 
00152 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Feb 28 2011 18:27:20 for Gaudi Framework, version v22r1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004