Gaudi Framework, version v20r2

Generated: 18 Jul 2008

DataOnDemandSvc.h

Go to the documentation of this file.
00001 // $Id: DataOnDemandSvc.h,v 1.9 2008/05/14 17:21:25 marcocle Exp $ 
00002 // ============================================================================
00003 // CVS tag $Name: v17r1 $ 
00004 // ============================================================================
00005 #ifndef GAUDISVC_DATAONDEMANDSVC_H
00006 #define GAUDISVC_DATAONDEMANDSVC_H
00007 // ============================================================================
00008 // Include Files
00009 // ============================================================================
00010 // STD & STL 
00011 // ============================================================================
00012 #include <map>
00013 #include <vector>
00014 // ============================================================================
00015 // GaudiKernel
00016 // ============================================================================
00017 #include "GaudiKernel/Service.h"
00018 #include "GaudiKernel/SvcFactory.h"
00019 #include "GaudiKernel/IIncidentListener.h"
00020 #include "GaudiKernel/ChronoEntity.h"
00021 #include "GaudiKernel/StatEntity.h"
00022 // ============================================================================
00023 // Reflex
00024 // ============================================================================
00025 #include "Reflex/Reflex.h"
00026 // ============================================================================
00027 // Forward declarations
00028 // ============================================================================
00029 class IAlgTool;
00030 class IAlgorithm;
00031 class IAlgManager;
00032 class IIncidentSvc;
00033 class IDataProviderSvc;
00034 // ============================================================================
00092 class DataOnDemandSvc 
00093   :         public Service
00094   , virtual public IIncidentListener 
00095 {
00096 public: 
00097   // Typedefs
00098   typedef std::vector<std::string> Setup;
00099   typedef ROOT::Reflex::Type       ClassH;
00104   struct Protection 
00105   {
00106     bool& m_bool;
00107     Protection(bool& b) : m_bool(b) { m_bool = true;  }
00108     ~Protection()                   { m_bool = false; }
00109   };
00115   struct Node  
00116   {
00117     ClassH      clazz;
00118     bool        executing;
00119     std::string name;
00120     Node() : clazz() , executing(false) , name () {}
00121     Node(ClassH c, bool e, const std::string& n)
00122       : clazz(c), executing(e), name(n) {}
00123     Node(const Node& c)
00124       : clazz(c.clazz), executing(c.executing), name(c.name){}
00125   };
00127   struct Leaf  
00128   {
00129     IAlgorithm* algorithm;
00130     bool        executing;
00131     std::string name;
00132     std::string type;
00133     Leaf() : algorithm ( 0 ) , executing (false ) , name() , type() {}
00134     Leaf(const Leaf& l) 
00135       : algorithm(l.algorithm), 
00136         executing(l.executing), name(l.name), type(l.type) {}
00137     Leaf(const std::string& t, const std::string& n)
00138       : algorithm(0), executing(false), name(n), type(t) {}
00139   };
00141   struct Timer 
00142   {
00143   public:
00144     Timer  ( ChronoEntity& c ) 
00145       : m_timer ( c ) { m_timer.start () ; }
00146     ~Timer ( )        { m_timer.stop  () ; }
00147   private:
00148     Timer() ;
00149   private:
00150     ChronoEntity& m_timer ;
00151   } ;
00153   typedef std::map<std::string, Node>  NodeMap;
00154   typedef std::map<std::string, Leaf>  AlgMap;
00156   virtual StatusCode initialize();
00158   virtual StatusCode finalize();
00160   virtual StatusCode reinitialize();
00162   virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
00164   virtual void handle(const Incident& incident);
00170   DataOnDemandSvc( const std::string& name, ISvcLocator* svc );
00172   virtual ~DataOnDemandSvc();
00173 protected:
00178    StatusCode configureHandler(Leaf& leaf);
00184   StatusCode execHandler(const std::string& tag, Leaf& leaf);
00190   StatusCode execHandler(const std::string& tag, Node& node);
00192   StatusCode setupNodeHandlers();
00194   StatusCode setupAlgHandlers();
00196   StatusCode setup();
00197 public:
00198   void update_1 ( Property& p ) ;
00199   void update_2 ( Property& p ) ;
00200   void update_3 ( Property& p ) ;
00201 protected:
00203   StatusCode update() ;
00205   inline MsgStream& stream () const 
00206   {
00207     if ( 0 == m_log ) { m_log = new MsgStream( msgSvc() , name() ) ; }
00208     return *m_log;
00209   }
00211   StatusCode dump( MSG::Level level = MSG::DEBUG ) const ;
00212 private:
00214   IIncidentSvc*     m_incSvc;
00216   IAlgManager*      m_algMgr;
00218   IDataProviderSvc* m_dataSvc;
00220   std::string       m_trapType;
00222   std::string       m_dataSvcName;
00224   bool              m_partialPath;
00226   SimpleProperty<Setup> m_algMapping;
00228   SimpleProperty<Setup> m_nodeMapping;
00230   AlgMap            m_algs;
00232   NodeMap           m_nodes;
00233   //
00234   typedef std::map<std::string,std::string> Map ;
00235   typedef SimplePropertyRef<Map>  MapRef   ;
00236   Map                m_algMap          ;
00237   Map                m_nodeMap         ;
00238   MapRef*            m_algMap_         ;
00239   MapRef*            m_nodeMap_        ;
00240   bool               m_updateRequired  ;
00241   std::string        m_prefix          ;
00242   mutable MsgStream* m_log             ;
00243   ChronoEntity       m_total           ;
00244   ulonglong          m_statAlg         ;  
00245   ulonglong          m_statNode        ;  
00246   ulonglong          m_stat            ;  
00247 } ; 
00248 // ============================================================================
00249 
00250 // ============================================================================
00251 // The END 
00252 // ============================================================================
00253 #endif // GAUDISVC_DATAONDEMANDSVC_H
00254 // ============================================================================
00255 

Generated at Fri Jul 18 11:59:24 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004