CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DataProxyProvider.h
Go to the documentation of this file.
1 #ifndef Framework_DataProxyProvider_h
2 #define Framework_DataProxyProvider_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : DataProxyProvider
7 //
16 //
17 // Author: Chris Jones
18 // Created: Mon Mar 28 14:21:58 EST 2005
19 //
20 
21 // system include files
22 #include <map>
23 #include <set>
24 #include <string>
25 #include <vector>
26 #include "boost/shared_ptr.hpp"
27 
28 // user include files
32 
33 // forward declarations
34 namespace edm {
35  class ValidityInterval;
36  class ParameterSet;
37  namespace eventsetup {
38  class DataProxy;
39 
40 
42 {
43 
44  public:
45  typedef std::vector< EventSetupRecordKey> Keys;
46  typedef std::vector<std::pair<DataKey,
47  boost::shared_ptr<DataProxy> > > KeyedProxies ;
48  typedef std::map<EventSetupRecordKey, KeyedProxies> RecordProxies;
49 
51  virtual ~DataProxyProvider();
52 
53  // ---------- const member functions ---------------------
54  bool isUsingRecord(const EventSetupRecordKey&) const;
55 
56  std::set<EventSetupRecordKey> usingRecords() const;
57 
58  const KeyedProxies& keyedProxies(const EventSetupRecordKey& iRecordKey) const ;
59 
60  const ComponentDescription& description() const { return description_;}
61  // ---------- static member functions --------------------
62 
63  // ---------- member functions ---------------------------
64 
66  virtual void newInterval(const EventSetupRecordKey& iRecordType,
67  const ValidityInterval& iInterval) = 0;
68 
69  void setDescription(const ComponentDescription& iDescription) {
70  description_ = iDescription;
71  }
72 
77 
78  void resetProxies(const EventSetupRecordKey& iRecordType);
79  void resetProxiesIfTransient(const EventSetupRecordKey& iRecordType);
80 
81  protected:
82  template< class T>
83  void usingRecord() {
84  usingRecordWithKey(EventSetupRecordKey::makeKey<T>());
85  }
86 
88 
89  void invalidateProxies(const EventSetupRecordKey& iRecordKey) ;
90 
91  virtual void registerProxies(const EventSetupRecordKey& iRecordKey ,
92  KeyedProxies& aProxyList) = 0 ;
93 
95  void eraseAll(const EventSetupRecordKey& iRecordKey) ;
96 
97  private:
98  DataProxyProvider(const DataProxyProvider&); // stop default
99 
100  const DataProxyProvider& operator=(const DataProxyProvider&); // stop default
101 
102  // ---------- member data --------------------------------
105  std::string appendToDataLabel_;
106 };
107 
108 template<class ProxyT>
110  boost::shared_ptr<ProxyT> iProxy,
111  const char* iName="") {
113  DataKey(DataKey::makeTypeTag<typename ProxyT::value_type>(),
114  iName),
115  iProxy));
116 
117 }
118 
119  }
120 }
121 #endif
void resetProxiesIfTransient(const EventSetupRecordKey &iRecordType)
const KeyedProxies & keyedProxies(const EventSetupRecordKey &iRecordKey) const
void setDescription(const ComponentDescription &iDescription)
std::vector< EventSetupRecordKey > Keys
bool isUsingRecord(const EventSetupRecordKey &) const
virtual void registerProxies(const EventSetupRecordKey &iRecordKey, KeyedProxies &aProxyList)=0
std::map< EventSetupRecordKey, KeyedProxies > RecordProxies
void eraseAll(const EventSetupRecordKey &iRecordKey)
deletes all the Proxies in aStream
void usingRecordWithKey(const EventSetupRecordKey &)
void invalidateProxies(const EventSetupRecordKey &iRecordKey)
std::vector< std::pair< DataKey, boost::shared_ptr< DataProxy > > > KeyedProxies
void insertProxy(DataProxyProvider::KeyedProxies &iList, boost::shared_ptr< ProxyT > iProxy, const char *iName="")
void resetProxies(const EventSetupRecordKey &iRecordType)
const ComponentDescription & description() const
Container::value_type value_type
std::set< EventSetupRecordKey > usingRecords() const
virtual void newInterval(const EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)=0
called when a new interval of validity occurs for iRecordType
void setAppendToDataLabel(const edm::ParameterSet &)
const DataProxyProvider & operator=(const DataProxyProvider &)