CMS 3D CMS Logo

ESProxyFactoryProducer.h

Go to the documentation of this file.
00001 #ifndef Framework_ESProxyFactoryProducer_h
00002 #define Framework_ESProxyFactoryProducer_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Framework
00006 // Class  :     ESProxyFactoryProducer
00007 // 
00048 //
00049 // Author:      Chris Jones
00050 // Created:     Thu Apr  7 17:14:58 CDT 2005
00051 // $Id: ESProxyFactoryProducer.h,v 1.3 2006/08/31 23:26:24 wmtan Exp $
00052 //
00053 
00054 // system include files
00055 #include <map>
00056 #include "boost/shared_ptr.hpp"
00057 
00058 // user include files
00059 
00060 // forward declarations
00061 #include "FWCore/Framework/interface/DataProxyProvider.h"
00062 
00063 namespace edm {
00064    namespace eventsetup {
00065       class ProxyFactoryBase;
00066       
00067       struct FactoryInfo {
00068          FactoryInfo() : key_(), factory_() {}
00069          FactoryInfo(const DataKey& iKey, 
00070                       boost::shared_ptr<ProxyFactoryBase> iFactory)
00071          : key_(iKey), 
00072          factory_(iFactory) {} 
00073          DataKey key_;
00074          boost::shared_ptr<ProxyFactoryBase> factory_;
00075       };
00076    }      
00077    
00078 class ESProxyFactoryProducer : public eventsetup::DataProxyProvider
00079 {
00080 
00081    public:
00082       ESProxyFactoryProducer();
00083       virtual ~ESProxyFactoryProducer();
00084 
00085       // ---------- const member functions ---------------------
00086 
00087       // ---------- static member functions --------------------
00088 
00089       // ---------- member functions ---------------------------
00091       virtual void newInterval(const eventsetup::EventSetupRecordKey& iRecordType,
00092                                 const ValidityInterval& iInterval) ;
00093 
00094    protected:
00096       virtual void registerProxies(const eventsetup::EventSetupRecordKey& iRecord ,
00097                                     KeyedProxies& aProxyList) ;
00098 
00105       template< class TFactory>
00106          void registerFactory(std::auto_ptr<TFactory> iFactory,
00107                               const std::string& iLabel = std::string()) {
00108             std::auto_ptr<eventsetup::ProxyFactoryBase> temp(iFactory.release());
00109             registerFactoryWithKey(
00110                                    eventsetup::EventSetupRecordKey::makeKey<typename TFactory::record_type>(),
00111                                    temp,
00112                                    iLabel);
00113          }
00120       template< class TFactory>
00121          void registerFactory(TFactory* iFactory,
00122                               const std::string& iLabel = std::string()) {
00123             std::auto_ptr<TFactory> temp(iFactory);
00124             registerFactory(temp,iLabel);
00125          }
00126       
00127       virtual void registerFactoryWithKey(const eventsetup::EventSetupRecordKey& iRecord ,
00128                                           std::auto_ptr<eventsetup::ProxyFactoryBase>& iFactory,
00129                                           const std::string& iLabel= std::string() );
00130 
00131    private:
00132       ESProxyFactoryProducer(const ESProxyFactoryProducer&); // stop default
00133 
00134       const ESProxyFactoryProducer& operator=(const ESProxyFactoryProducer&); // stop default
00135 
00136       
00137       // ---------- member data --------------------------------
00138       std::multimap< eventsetup::EventSetupRecordKey, eventsetup::FactoryInfo > record2Factories_;
00139 
00140 };
00141 
00142 }
00143 
00144 #endif

Generated on Tue Jun 9 17:35:29 2009 for CMSSW by  doxygen 1.5.4