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