CMS 3D CMS Logo

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 
26 #include <map>
27 #include <memory>
28 #include <set>
29 #include <string>
30 #include <vector>
31 
32 // forward declarations
33 namespace edm {
34  class ActivityRegistry;
36  class IOVSyncValue;
37  class ParameterSet;
38 
39  namespace eventsetup {
40  struct ComponentDescription;
41  class DataKey;
42  class DataProxyProvider;
44  class EventSetupRecordKey;
46  class EventSetupsController;
47  class ParameterSetIDHolder;
49 
51  public:
55  typedef std::pair<DataType, DataLabel> DataKeyInfo;
56  typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
57  typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
58 
60  unsigned subProcessIndex = 0U,
61  PreferredProviderInfo const* iInfo = nullptr);
62  virtual ~EventSetupProvider();
63 
64  // ---------- const member functions ---------------------
65  std::set<ComponentDescription> proxyProviderDescriptions() const;
66  bool isWithinValidityInterval(IOVSyncValue const&) const;
67 
69  // ---------- static member functions --------------------
70 
71  // ---------- member functions ---------------------------
73 
74  EventSetupImpl const& eventSetup() const { return eventSetup_; }
75 
76  //called by specializations of EventSetupRecordProviders
78 
79  void add(std::shared_ptr<DataProxyProvider>);
80  void replaceExisting(std::shared_ptr<DataProxyProvider>);
81  void add(std::shared_ptr<EventSetupRecordIntervalFinder>);
82 
83  void finishConfiguration();
84 
87 
89  void forceCacheClear();
90 
92  EventSetupProvider& precedingESProvider,
93  std::set<ParameterSetIDHolder>& sharingCheckDone,
94  std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>>& referencedESProducers,
95  EventSetupsController& esController);
96 
97  bool doRecordsMatch(EventSetupProvider& precedingESProvider,
98  EventSetupRecordKey const& eventSetupRecordKey,
99  std::map<EventSetupRecordKey, bool>& allComponentsMatch,
100  EventSetupsController const& esController);
101 
102  void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
103 
105 
107 
108  unsigned subProcessIndex() const { return subProcessIndex_; }
109 
110  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
111 
113  void addRecord(const EventSetupRecordKey& iKey);
114 
115  protected:
116  void insert(std::unique_ptr<EventSetupRecordProvider> iRecordProvider);
117 
118  private:
119  EventSetupProvider(EventSetupProvider const&) = delete; // stop default
120 
121  EventSetupProvider const& operator=(EventSetupProvider const&) = delete; // stop default
122 
123  std::shared_ptr<EventSetupRecordProvider>& recordProvider(const EventSetupRecordKey& iKey);
125  void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
126 
127  void determinePreferred();
128 
129  // ---------- member data --------------------------------
131 
132  using RecordKeys = std::vector<EventSetupRecordKey>;
134 
135  using RecordProviders = std::vector<std::shared_ptr<EventSetupRecordProvider>>;
137 
140 
141  // The following are all used only during initialization and then cleared.
142 
143  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
144  std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>> finders_;
145  std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider>>> dataProviders_;
146  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*>>> referencedDataKeys_;
147  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>>>
149  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey>>> psetIDToRecordKey_;
150  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription>>> recordToPreferred_;
151  std::unique_ptr<std::set<EventSetupRecordKey>> recordsWithALooperProxy_;
152  };
153 
154  } // namespace eventsetup
155 } // namespace edm
156 #endif
EventSetupRecordProvider * tryToGetRecordProvider(const EventSetupRecordKey &iKey)
std::shared_ptr< EventSetupRecordProvider > & recordProvider(const EventSetupRecordKey &iKey)
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
EventSetupImpl const & eventSetupForInstance(IOVSyncValue const &)
void forceCacheClear()
Used when testing that all code properly updates on IOV changes of all Records.
EventSetupProvider(ActivityRegistry *, unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=0)
std::vector< EventSetupRecordKey > RecordKeys
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 fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
std::vector< std::shared_ptr< EventSetupRecordProvider >> RecordProviders
void insert(std::unique_ptr< EventSetupRecordProvider > iRecordProvider)
void add(std::shared_ptr< DataProxyProvider >)
EventSetupProvider const & operator=(EventSetupProvider const &)=delete
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
std::pair< DataType, DataLabel > DataKeyInfo
void addRecord(const EventSetupRecordKey &iKey)
Intended for use only in tests.
ESRecordsToProxyIndices recordsToProxyIndices() const
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
EventSetupImpl const & eventSetup() const
void checkESProducerSharing(EventSetupProvider &precedingESProvider, std::set< ParameterSetIDHolder > &sharingCheckDone, std::map< EventSetupRecordKey, std::vector< ComponentDescription const * >> &referencedESProducers, EventSetupsController &esController)
HLT enums.
void addRecordToEventSetup(EventSetupRecordImpl &iRecord)
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
void replaceExisting(std::shared_ptr< DataProxyProvider >)
std::set< ComponentDescription > proxyProviderDescriptions() const
bool isWithinValidityInterval(IOVSyncValue const &) const
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)