00001 #ifndef Framework_EventSetupProvider_h 00002 #define Framework_EventSetupProvider_h 00003 // -*- C++ -*- 00004 // 00005 // Package: Framework 00006 // Class: EventSetupProvider 00007 // 00016 // 00017 // Author: Chris Jones 00018 // Created: Thu Mar 24 14:10:07 EST 2005 00019 // 00020 00021 // system include files 00022 #include <memory> 00023 #include <map> 00024 #include <set> 00025 #include <string> 00026 #include <vector> 00027 00028 #include "boost/shared_ptr.hpp" 00029 00030 // user include files 00031 #include "FWCore/Framework/interface/EventSetup.h" 00032 00033 // forward declarations 00034 namespace edm { 00035 class IOVSyncValue; 00036 class EventSetupRecordIntervalFinder; 00037 00038 namespace eventsetup { 00039 class EventSetupRecordProvider; 00040 class DataProxyProvider; 00041 class ComponentDescription; 00042 00043 class EventSetupProvider 00044 { 00045 00046 public: 00047 typedef std::string RecordName; 00048 typedef std::string DataType; 00049 typedef std::string DataLabel; 00050 typedef std::pair<DataType,DataLabel> DataKeyInfo; 00051 typedef std::multimap<RecordName,DataKeyInfo> RecordToDataMap; 00052 typedef std::map<ComponentDescription,RecordToDataMap > PreferredProviderInfo; 00053 EventSetupProvider(const PreferredProviderInfo* iInfo=0); 00054 virtual ~EventSetupProvider(); 00055 00056 // ---------- const member functions --------------------- 00057 std::set<ComponentDescription> proxyProviderDescriptions() const; 00058 00059 // ---------- static member functions -------------------- 00060 00061 // ---------- member functions --------------------------- 00062 EventSetup const& eventSetupForInstance(const IOVSyncValue&); 00063 00064 EventSetup const& eventSetup() const {return eventSetup_;} 00065 00066 //called by specializations of EventSetupRecordProviders 00067 template<class T> 00068 void addRecordToEventSetup(T& iRecord) { 00069 iRecord.setEventSetup(&eventSetup_); 00070 eventSetup_.add(iRecord); 00071 } 00072 00073 void add(boost::shared_ptr<DataProxyProvider>); 00074 void add(boost::shared_ptr<EventSetupRecordIntervalFinder>); 00075 00076 void finishConfiguration(); 00077 00079 void resetRecordPlusDependentRecords(const EventSetupRecordKey& ); 00080 00082 void forceCacheClear(); 00083 00084 protected: 00085 00086 template <class T> 00087 void insert(std::auto_ptr<T> iRecordProvider) { 00088 std::auto_ptr<EventSetupRecordProvider> temp(iRecordProvider.release()); 00089 insert(eventsetup::heterocontainer::makeKey< 00090 typename T::RecordType, 00091 eventsetup::EventSetupRecordKey>(), 00092 temp); 00093 } 00094 00095 private: 00096 EventSetupProvider(const EventSetupProvider&); // stop default 00097 00098 const EventSetupProvider& operator=(const EventSetupProvider&); // stop default 00099 00100 00101 void insert(const EventSetupRecordKey&, std::auto_ptr<EventSetupRecordProvider>); 00102 00103 // ---------- member data -------------------------------- 00104 EventSetup eventSetup_; 00105 typedef std::map<EventSetupRecordKey, boost::shared_ptr<EventSetupRecordProvider> > Providers; 00106 Providers providers_; 00107 bool mustFinishConfiguration_; 00108 00109 std::auto_ptr<PreferredProviderInfo> preferredProviderInfo_; 00110 std::auto_ptr<std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> > > finders_; 00111 std::auto_ptr<std::vector<boost::shared_ptr<DataProxyProvider> > > dataProviders_; 00112 }; 00113 00114 } 00115 } 00116 #endif