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
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::CacheHandle::operator->
T const * operator->() const
Definition: CacheHandle.h:26
edm::CacheHandle::operator*
T const & operator*() const
Definition: CacheHandle.h:27
edm::CacheHandle::isValid
bool isValid() const
Definition: CacheHandle.h:29
edm::CacheHandle::data_
T const * data_
Definition: CacheHandle.h:32
edm::CacheHandle::get
T const * get() const
Definition: CacheHandle.h:20
edm::CacheHandle::CacheHandle
CacheHandle(T const *data)
Definition: CacheHandle.h:18
edm::CacheHandle::CacheHandle
CacheHandle()
Definition: CacheHandle.h:17
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:245
edm::CacheHandle
Definition: CacheHandle.h:15
Exception.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79