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_(0) {}
32  virtual ~ECGetterBase() {}
33 
34  // ---------- const member functions ---------------------
35  const T* get() const {
36  if (data_ == 0) {
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  virtual const T* getImpl() const { return value_; }
62  const T* value_;
63  };
64 } // namespace edm
65 
66 #endif
ValueHolderECGetter(const T &iValue)
Definition: ECGetterBase.h:58
virtual const T * getImpl() const
Definition: ECGetterBase.h:61
virtual const T * getImpl() const =0
HLT enums.
long double T