CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/FWCore/Framework/interface/EventSetupProvider.h

Go to the documentation of this file.
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    class ParameterSet;
00039 
00040    namespace eventsetup {
00041       struct ComponentDescription;
00042       class DataKey;
00043       class DataProxyProvider;
00044       class EventSetupRecord;
00045       class EventSetupRecordKey;
00046       class EventSetupRecordProvider;
00047       class EventSetupsController;
00048       class ParameterSetIDHolder;
00049 
00050 class EventSetupProvider {
00051 
00052    public:
00053       typedef std::string RecordName;
00054       typedef std::string DataType;
00055       typedef std::string DataLabel;
00056       typedef std::pair<DataType, DataLabel> DataKeyInfo;
00057       typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
00058       typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
00059 
00060       EventSetupProvider(unsigned subProcessIndex = 0U, PreferredProviderInfo const* iInfo = 0);
00061       virtual ~EventSetupProvider();
00062 
00063       // ---------- const member functions ---------------------
00064       std::set<ComponentDescription> proxyProviderDescriptions() const;
00065 
00066       // ---------- static member functions --------------------
00067 
00068       // ---------- member functions ---------------------------
00069       EventSetup const& eventSetupForInstance(IOVSyncValue const&);
00070 
00071       EventSetup const& eventSetup() const {return eventSetup_;}
00072 
00073       //called by specializations of EventSetupRecordProviders
00074       void addRecordToEventSetup(EventSetupRecord& iRecord);
00075 
00076       void add(boost::shared_ptr<DataProxyProvider>);
00077       void replaceExisting(boost::shared_ptr<DataProxyProvider>);
00078       void add(boost::shared_ptr<EventSetupRecordIntervalFinder>);
00079 
00080       void finishConfiguration();
00081 
00083       void resetRecordPlusDependentRecords(EventSetupRecordKey const&);
00084 
00086       void forceCacheClear();
00087 
00088       void checkESProducerSharing(EventSetupProvider & precedingESProvider,
00089                                   std::set<ParameterSetIDHolder>& sharingCheckDone,
00090                                   std::map<EventSetupRecordKey, std::vector<ComponentDescription const*> >& referencedESProducers,
00091                                   EventSetupsController & esController);
00092 
00093       bool doRecordsMatch(EventSetupProvider & precedingESProvider,
00094                           EventSetupRecordKey const& eventSetupRecordKey,
00095                           std::map<EventSetupRecordKey, bool> & allComponentsMatch,
00096                           EventSetupsController const& esController);
00097 
00098       void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
00099 
00100       void resetRecordToProxyPointers();
00101 
00102       void clearInitializationData();
00103 
00104       unsigned subProcessIndex() const { return subProcessIndex_; }
00105 
00106       static void logInfoWhenSharing(ParameterSet const& iConfiguration);
00107 
00108    protected:
00109 
00110       template <typename T>
00111          void insert(std::auto_ptr<T> iRecordProvider) {
00112             std::auto_ptr<EventSetupRecordProvider> temp(iRecordProvider.release());
00113             insert(eventsetup::heterocontainer::makeKey<
00114                     typename T::RecordType,
00115                        eventsetup::EventSetupRecordKey>(),
00116                     temp);
00117          }
00118 
00119    private:
00120       EventSetupProvider(EventSetupProvider const&); // stop default
00121 
00122       EventSetupProvider const& operator=(EventSetupProvider const&); // stop default
00123 
00124       void insert(EventSetupRecordKey const&, std::auto_ptr<EventSetupRecordProvider>);
00125 
00126       // ---------- member data --------------------------------
00127       EventSetup eventSetup_;
00128       typedef std::map<EventSetupRecordKey, boost::shared_ptr<EventSetupRecordProvider> > Providers;
00129       Providers providers_;
00130       bool mustFinishConfiguration_;
00131       unsigned subProcessIndex_;
00132 
00133       // The following are all used only during initialization and then cleared.
00134 
00135       std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
00136       std::unique_ptr<std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> > > finders_;
00137       std::unique_ptr<std::vector<boost::shared_ptr<DataProxyProvider> > > dataProviders_;
00138       std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*> > > referencedDataKeys_;
00139       std::unique_ptr<std::map<EventSetupRecordKey, std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> > > > recordToFinders_;
00140       std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey> > > psetIDToRecordKey_;
00141       std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription> > > recordToPreferred_;
00142       std::unique_ptr<std::set<EventSetupRecordKey> > recordsWithALooperProxy_;
00143 };
00144 
00145    }
00146 }
00147 #endif