test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventSetupProvider.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EventSetupProvider_h
2 #define FWCore_Framework_EventSetupProvider_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class: EventSetupProvider
7 //
16 //
17 // Author: Chris Jones
18 // Created: Thu Mar 24 14:10:07 EST 2005
19 //
20 
21 // user include files
23 
24 // system include files
25 #include "boost/shared_ptr.hpp"
26 
27 #include <memory>
28 #include <map>
29 #include <set>
30 #include <string>
31 #include <vector>
32 
33 
34 // forward declarations
35 namespace edm {
37  class IOVSyncValue;
38  class ParameterSet;
39 
40  namespace eventsetup {
41  struct ComponentDescription;
42  class DataKey;
43  class DataProxyProvider;
44  class EventSetupRecord;
45  class EventSetupRecordKey;
47  class EventSetupsController;
48  class ParameterSetIDHolder;
49 
51 
52  public:
56  typedef std::pair<DataType, DataLabel> DataKeyInfo;
57  typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
58  typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
59 
60  EventSetupProvider(unsigned subProcessIndex = 0U, PreferredProviderInfo const* iInfo = 0);
61  virtual ~EventSetupProvider();
62 
63  // ---------- const member functions ---------------------
64  std::set<ComponentDescription> proxyProviderDescriptions() const;
65 
66  // ---------- static member functions --------------------
67 
68  // ---------- member functions ---------------------------
70 
71  EventSetup const& eventSetup() const {return eventSetup_;}
72 
73  //called by specializations of EventSetupRecordProviders
75 
76  void add(boost::shared_ptr<DataProxyProvider>);
77  void replaceExisting(boost::shared_ptr<DataProxyProvider>);
78  void add(boost::shared_ptr<EventSetupRecordIntervalFinder>);
79 
80  void finishConfiguration();
81 
84 
86  void forceCacheClear();
87 
88  void checkESProducerSharing(EventSetupProvider & precedingESProvider,
89  std::set<ParameterSetIDHolder>& sharingCheckDone,
90  std::map<EventSetupRecordKey, std::vector<ComponentDescription const*> >& referencedESProducers,
91  EventSetupsController & esController);
92 
93  bool doRecordsMatch(EventSetupProvider & precedingESProvider,
94  EventSetupRecordKey const& eventSetupRecordKey,
95  std::map<EventSetupRecordKey, bool> & allComponentsMatch,
96  EventSetupsController const& esController);
97 
98  void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
99 
101 
103 
104  unsigned subProcessIndex() const { return subProcessIndex_; }
105 
106  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
107 
108  protected:
109 
110  template <typename T>
111  void insert(std::auto_ptr<T> iRecordProvider) {
112  std::auto_ptr<EventSetupRecordProvider> temp(iRecordProvider.release());
114  typename T::RecordType,
116  temp);
117  }
118 
119  private:
120  EventSetupProvider(EventSetupProvider const&); // stop default
121 
122  EventSetupProvider const& operator=(EventSetupProvider const&); // stop default
123 
124  void insert(EventSetupRecordKey const&, std::auto_ptr<EventSetupRecordProvider>);
125 
126  // ---------- member data --------------------------------
128  typedef std::map<EventSetupRecordKey, boost::shared_ptr<EventSetupRecordProvider> > Providers;
132 
133  // The following are all used only during initialization and then cleared.
134 
135  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
136  std::unique_ptr<std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> > > finders_;
137  std::unique_ptr<std::vector<boost::shared_ptr<DataProxyProvider> > > dataProviders_;
138  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*> > > referencedDataKeys_;
139  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> > > > recordToFinders_;
140  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey> > > psetIDToRecordKey_;
141  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription> > > recordToPreferred_;
142  std::unique_ptr<std::set<EventSetupRecordKey> > recordsWithALooperProxy_;
143 };
144 
145  }
146 }
147 #endif
EventSetup const & eventSetupForInstance(IOVSyncValue const &)
Key makeKey(const IdTag &iIdTag)
Definition: HCMethods.h:28
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
EventSetupProvider const & operator=(EventSetupProvider const &)
void forceCacheClear()
Used when testing that all code properly updates on IOV changes of all Records.
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
std::multimap< RecordName, DataKeyInfo > RecordToDataMap
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
void resetRecordPlusDependentRecords(EventSetupRecordKey const &)
Used when we need to force a Record to reset all its proxies.
void insert(std::auto_ptr< T > iRecordProvider)
void fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
void addRecordToEventSetup(EventSetupRecord &iRecord)
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
void add(boost::shared_ptr< DataProxyProvider >)
EventSetup const & eventSetup() const
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
std::map< EventSetupRecordKey, boost::shared_ptr< EventSetupRecordProvider > > Providers
std::pair< DataType, DataLabel > DataKeyInfo
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
void replaceExisting(boost::shared_ptr< DataProxyProvider >)
void checkESProducerSharing(EventSetupProvider &precedingESProvider, std::set< ParameterSetIDHolder > &sharingCheckDone, std::map< EventSetupRecordKey, std::vector< ComponentDescription const * > > &referencedESProducers, EventSetupsController &esController)
EventSetupProvider(unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=0)
std::unique_ptr< std::vector< boost::shared_ptr< DataProxyProvider > > > dataProviders_
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< boost::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
std::set< ComponentDescription > proxyProviderDescriptions() const
std::unique_ptr< std::vector< boost::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)