CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
26 
27 // forward declarations
28 namespace edm {
29  namespace eventsetup {
30  struct ComponentDescription;
31  class DataKey;
32  class EventSetupRecord;
33 
34  class DataProxy {
35 
36  public:
37  DataProxy();
38  virtual ~DataProxy();
39 
40  // ---------- const member functions ---------------------
41  bool cacheIsValid() const { return cacheIsValid_.load(std::memory_order_acquire); }
42 
43  void doGet(EventSetupRecord const& iRecord, DataKey const& iKey, bool iTransiently) const;
44  void const* get(EventSetupRecord const&, DataKey const& iKey, bool iTransiently) const;
45 
48  return description_;
49  }
50  // ---------- static member functions --------------------
51 
52  // ---------- member functions ---------------------------
53  void invalidate() {
56  }
57 
58  void resetIfTransient();
59 
61  description_ = iDesc;
62  }
63  protected:
70  virtual void const* getImpl(EventSetupRecord const&, DataKey const& iKey) =0;
71 
75  virtual void invalidateCache() = 0;
76 
82  virtual void invalidateTransientCache();
83 
84  void clearCacheIsValid();
85  private:
86  DataProxy(DataProxy const&); // stop default
87 
88  DataProxy const& operator=(DataProxy const&); // stop default
89 
90  // ---------- member data --------------------------------
91  [[cms::thread_safe]] mutable void const* cache_; //protected by a global mutex
92  mutable std::atomic<bool> cacheIsValid_;
93  mutable std::atomic<bool> nonTransientAccessRequested_;
95  };
96  }
97 }
98 #endif
bool cacheIsValid() const
Definition: DataProxy.h:41
virtual void invalidateTransientCache()
Definition: DataProxy.cc:89
std::atomic< bool > nonTransientAccessRequested_
Definition: DataProxy.h:93
std::atomic< bool > cacheIsValid_
Definition: DataProxy.h:92
void setProviderDescription(ComponentDescription const *iDesc)
Definition: DataProxy.h:60
DataProxy const & operator=(DataProxy const &)
ComponentDescription const * description_
Definition: DataProxy.h:94
ComponentDescription const * providerDescription() const
returns the description of the DataProxyProvider which owns this Proxy
Definition: DataProxy.h:47
void doGet(EventSetupRecord const &iRecord, DataKey const &iKey, bool iTransiently) const
Definition: DataProxy.cc:126
virtual void invalidateCache()=0
virtual void const * getImpl(EventSetupRecord const &, DataKey const &iKey)=0