CMS 3D CMS Logo

ECGetterBase.h
Go to the documentation of this file.
1 #ifndef Utilities_ECGetterBase_h
2 #define Utilities_ECGetterBase_h
3 // -*- C++ -*-
4 //
5 // Package: Utilities
6 // Class : ECGetterBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Fri Sep 22 12:41:05 EDT 2006
19 //
20 
21 // system include files
22 
23 // user include files
24 
25 // forward declarations
26 namespace edm {
27  namespace extensioncord {
28  template <class T>
29  class ECGetterBase {
30  public:
31  ECGetterBase() : data_(nullptr) {}
32  virtual ~ECGetterBase() {}
33 
34  // ---------- const member functions ---------------------
35  const T* get() const {
36  if (data_ == nullptr) {
37  data_ = this->getImpl();
38  }
39  return data_;
40  }
41 
42  private:
43  //ECGetterBase(const ECGetterBase&); // allow default
44 
45  //const ECGetterBase& operator=(const ECGetterBase&); // allow default
46 
47  //the actual method which is used to get the requested data
48  virtual const T* getImpl() const = 0;
49 
50  // ---------- member data --------------------------------
51  //does not own the data
52  mutable const T* data_;
53  };
54  } // namespace extensioncord
55  template <class T>
57  public:
58  ValueHolderECGetter(const T& iValue) : value_(&iValue) {}
59 
60  private:
61  const T* getImpl() const override { return value_; }
62  const T* value_;
63  };
64 } // namespace edm
65 
66 #endif
edm::ValueHolderECGetter::getImpl
const T * getImpl() const override
Definition: ECGetterBase.h:61
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ValueHolderECGetter::value_
const T * value_
Definition: ECGetterBase.h:62
edm::extensioncord::ECGetterBase
Definition: ECGetterBase.h:29
edm::ValueHolderECGetter::ValueHolderECGetter
ValueHolderECGetter(const T &iValue)
Definition: ECGetterBase.h:58
edm::ValueHolderECGetter
Definition: ECGetterBase.h:56
edm::extensioncord::ECGetterBase::~ECGetterBase
virtual ~ECGetterBase()
Definition: ECGetterBase.h:32
edm::extensioncord::ECGetterBase::ECGetterBase
ECGetterBase()
Definition: ECGetterBase.h:31
edm::extensioncord::ECGetterBase::get
const T * get() const
Definition: ECGetterBase.h:35
edm::extensioncord::ECGetterBase::data_
const T * data_
Definition: ECGetterBase.h:52
T
long double T
Definition: Basic3DVectorLD.h:48
edm::extensioncord::ECGetterBase::getImpl
virtual const T * getImpl() const =0