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
24 
25 // system include files
26 #include "boost/shared_ptr.hpp"
27 
28 #include <memory>
29 #include <map>
30 #include <set>
31 #include <string>
32 #include <vector>
33 
34 
35 // forward declarations
36 namespace edm {
38  class IOVSyncValue;
39  class ParameterSet;
40 
41  namespace eventsetup {
42  struct ComponentDescription;
43  class DataKey;
44  class DataProxyProvider;
45  class EventSetupRecord;
46  class EventSetupRecordKey;
48  class EventSetupsController;
49  class ParameterSetIDHolder;
50 
52 
53  public:
57  typedef std::pair<DataType, DataLabel> DataKeyInfo;
58  typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
59  typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
60 
61  EventSetupProvider(unsigned subProcessIndex = 0U, PreferredProviderInfo const* iInfo = 0);
62  virtual ~EventSetupProvider();
63 
64  // ---------- const member functions ---------------------
65  std::set<ComponentDescription> proxyProviderDescriptions() const;
66 
67  // ---------- static member functions --------------------
68 
69  // ---------- member functions ---------------------------
71 
72  EventSetup const& eventSetup() const {return eventSetup_;}
73 
74  //called by specializations of EventSetupRecordProviders
76 
77  void add(boost::shared_ptr<DataProxyProvider>);
78  void replaceExisting(boost::shared_ptr<DataProxyProvider>);
79  void add(boost::shared_ptr<EventSetupRecordIntervalFinder>);
80 
81  void finishConfiguration();
82 
85 
87  void forceCacheClear();
88 
89  void checkESProducerSharing(EventSetupProvider & precedingESProvider,
90  std::set<ParameterSetIDHolder>& sharingCheckDone,
91  std::map<EventSetupRecordKey, std::vector<ComponentDescription const*> >& referencedESProducers,
92  EventSetupsController & esController);
93 
94  bool doRecordsMatch(EventSetupProvider & precedingESProvider,
95  EventSetupRecordKey const& eventSetupRecordKey,
96  std::map<EventSetupRecordKey, bool> & allComponentsMatch,
97  EventSetupsController const& esController);
98 
99  void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
100 
102 
104 
105  unsigned subProcessIndex() const { return subProcessIndex_; }
106 
107  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
108 
109  protected:
110 
111  template <typename T>
112  void insert(std::auto_ptr<T> iRecordProvider) {
113  std::auto_ptr<EventSetupRecordProvider> temp(iRecordProvider.release());
115  typename T::RecordType,
117  temp);
118  }
119 
120  private:
121  EventSetupProvider(EventSetupProvider const&); // stop default
122 
123  EventSetupProvider const& operator=(EventSetupProvider const&); // stop default
124 
125  void insert(EventSetupRecordKey const&, std::auto_ptr<EventSetupRecordProvider>);
126 
127  // ---------- member data --------------------------------
129  typedef std::map<EventSetupRecordKey, boost::shared_ptr<EventSetupRecordProvider> > Providers;
131  std::unique_ptr<EventSetupKnownRecordsSupplier> knownRecordsSupplier_;
134 
135  // The following are all used only during initialization and then cleared.
136 
137  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
138  std::unique_ptr<std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> > > finders_;
139  std::unique_ptr<std::vector<boost::shared_ptr<DataProxyProvider> > > dataProviders_;
140  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*> > > referencedDataKeys_;
141  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> > > > recordToFinders_;
142  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey> > > psetIDToRecordKey_;
143  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription> > > recordToPreferred_;
144  std::unique_ptr<std::set<EventSetupRecordKey> > recordsWithALooperProxy_;
145 };
146 
147  }
148 }
149 #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< EventSetupKnownRecordsSupplier > knownRecordsSupplier_
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)