CMS 3D CMS Logo

DataProxy.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_DataProxy_h
2 #define FWCore_Framework_DataProxy_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : DataProxy
7 //
17 //
18 // Author: Chris Jones
19 // Created: Thu Mar 31 12:43:01 EST 2005
20 //
21 
22 // system include files
23 #include <atomic>
24 
25 // user include files
27 
28 // forward declarations
29 namespace edm {
30  class ActivityRegistry;
31 
32  namespace eventsetup {
33  struct ComponentDescription;
34  class DataKey;
36 
37  class DataProxy {
38  public:
39  DataProxy();
40  virtual ~DataProxy();
41 
42  // ---------- const member functions ---------------------
43  bool cacheIsValid() const { return cacheIsValid_.load(std::memory_order_acquire); }
44 
45  void doGet(EventSetupRecordImpl const& iRecord,
46  DataKey const& iKey,
47  bool iTransiently,
48  ActivityRegistry const*) const;
49  void const* get(EventSetupRecordImpl const&,
50  DataKey const& iKey,
51  bool iTransiently,
52  ActivityRegistry const*) const;
53 
56  // ---------- static member functions --------------------
57 
58  // ---------- member functions ---------------------------
59  void invalidate() {
62  }
63 
64  void resetIfTransient();
65 
67 
68  protected:
75  virtual void const* getImpl(EventSetupRecordImpl const&, DataKey const& iKey) = 0;
76 
80  virtual void invalidateCache() = 0;
81 
87  virtual void invalidateTransientCache();
88 
89  void clearCacheIsValid();
90 
91  private:
92  DataProxy(DataProxy const&) = delete; // stop default
93 
94  DataProxy const& operator=(DataProxy const&) = delete; // stop default
95 
96  // ---------- member data --------------------------------
97  CMS_THREAD_SAFE mutable void const* cache_; //protected by a global mutex
98  mutable std::atomic<bool> cacheIsValid_;
99  mutable std::atomic<bool> nonTransientAccessRequested_;
101  };
102  } // namespace eventsetup
103 } // namespace edm
104 #endif
bool cacheIsValid() const
Definition: DataProxy.h:43
virtual void invalidateTransientCache()
Definition: DataProxy.cc:80
std::atomic< bool > nonTransientAccessRequested_
Definition: DataProxy.h:99
void doGet(EventSetupRecordImpl const &iRecord, DataKey const &iKey, bool iTransiently, ActivityRegistry const *) const
Definition: DataProxy.cc:148
std::atomic< bool > cacheIsValid_
Definition: DataProxy.h:98
virtual void const * getImpl(EventSetupRecordImpl const &, DataKey const &iKey)=0
void setProviderDescription(ComponentDescription const *iDesc)
Definition: DataProxy.h:66
#define CMS_THREAD_SAFE
DataProxy const & operator=(DataProxy const &)=delete
ComponentDescription const * description_
Definition: DataProxy.h:100
ComponentDescription const * providerDescription() const
returns the description of the DataProxyProvider which owns this Proxy
Definition: DataProxy.h:55
HLT enums.
virtual void invalidateCache()=0