00001 #ifndef Framework_ESProxyFactoryProducer_h
00002 #define Framework_ESProxyFactoryProducer_h
00003
00004
00005
00006
00007
00048
00049
00050
00051
00052
00053
00054
00055 #include <map>
00056 #include "boost/shared_ptr.hpp"
00057
00058
00059
00060
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
00086
00087
00088
00089
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&);
00133
00134 const ESProxyFactoryProducer& operator=(const ESProxyFactoryProducer&);
00135
00136
00137
00138 std::multimap< eventsetup::EventSetupRecordKey, eventsetup::FactoryInfo > record2Factories_;
00139
00140 };
00141
00142 }
00143
00144 #endif