CMS 3D CMS Logo

CacheHandle.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_CacheHandle_h
2 #define FWCore_Framework_CacheHandle_h
3 
11 
12 namespace edm {
13 
14  template <typename T>
15  class CacheHandle {
16  public:
17  CacheHandle() : data_(nullptr) {}
18  CacheHandle(T const* data) : data_(data) {}
19 
20  T const* get() const {
21  if (!isValid()) {
22  throw cms::Exception("InvalidCache") << "CacheHandle is invalid";
23  }
24  return data_;
25  }
26  T const* operator->() const { return get(); }
27  T const& operator*() const { return *get(); }
28 
29  bool isValid() const { return data_ != nullptr; }
30 
31  private:
32  T const* data_;
33  };
34 } // namespace edm
35 #endif
T const & operator*() const
Definition: CacheHandle.h:27
bool isValid() const
Definition: CacheHandle.h:29
T const * operator->() const
Definition: CacheHandle.h:26
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
long double T
CacheHandle(T const *data)
Definition: CacheHandle.h:18
T const * data_
Definition: CacheHandle.h:32