CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/FWCore/Framework/interface/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 //
00052 
00053 // system include files
00054 #include <map>
00055 #include <memory>
00056 #include <string>
00057 #include "boost/shared_ptr.hpp"
00058 
00059 // user include files
00060 
00061 // forward declarations
00062 #include "FWCore/Framework/interface/DataProxyProvider.h"
00063 
00064 namespace edm {
00065    namespace eventsetup {
00066       class ProxyFactoryBase;
00067       
00068       struct FactoryInfo {
00069          FactoryInfo() : key_(), factory_() {}
00070          FactoryInfo(const DataKey& iKey, 
00071                       boost::shared_ptr<ProxyFactoryBase> iFactory)
00072          : key_(iKey), 
00073          factory_(iFactory) {} 
00074          DataKey key_;
00075          boost::shared_ptr<ProxyFactoryBase> factory_;
00076       };
00077    }      
00078    
00079 class ESProxyFactoryProducer : public eventsetup::DataProxyProvider
00080 {
00081 
00082    public:
00083       ESProxyFactoryProducer();
00084       virtual ~ESProxyFactoryProducer();
00085 
00086       // ---------- const member functions ---------------------
00087 
00088       // ---------- static member functions --------------------
00089 
00090       // ---------- member functions ---------------------------
00092       virtual void newInterval(const eventsetup::EventSetupRecordKey& iRecordType,
00093                                 const ValidityInterval& iInterval) ;
00094 
00095    protected:
00097       virtual void registerProxies(const eventsetup::EventSetupRecordKey& iRecord ,
00098                                     KeyedProxies& aProxyList) ;
00099 
00106       template< class TFactory>
00107          void registerFactory(std::auto_ptr<TFactory> iFactory,
00108                               const std::string& iLabel = std::string()) {
00109             std::auto_ptr<eventsetup::ProxyFactoryBase> temp(iFactory.release());
00110             registerFactoryWithKey(
00111                                    eventsetup::EventSetupRecordKey::makeKey<typename TFactory::record_type>(),
00112                                    temp,
00113                                    iLabel);
00114          }
00115       
00116       virtual void registerFactoryWithKey(const eventsetup::EventSetupRecordKey& iRecord ,
00117                                           std::auto_ptr<eventsetup::ProxyFactoryBase>& iFactory,
00118                                           const std::string& iLabel= std::string() );
00119 
00120    private:
00121       ESProxyFactoryProducer(const ESProxyFactoryProducer&); // stop default
00122 
00123       const ESProxyFactoryProducer& operator=(const ESProxyFactoryProducer&); // stop default
00124 
00125       
00126       // ---------- member data --------------------------------
00127       std::multimap< eventsetup::EventSetupRecordKey, eventsetup::FactoryInfo > record2Factories_;
00128 
00129 };
00130 
00131 }
00132 
00133 #endif