CMS 3D CMS Logo

ConstRespectingPtr.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_ConstRespectingPtr_h
2 #define FWCore_Utilities_ConstRespectingPtr_h
3 
4 // Package: FWCore/Utilities
5 // Class : ConstRespectingPtr
6 //
17 // Original Author: W. David Dagenhart
18 // Created: 20 March 2014
19 
20 #include <memory>
21 
23 
24 namespace edm {
25 
26  template <typename T>
28  public:
30  explicit ConstRespectingPtr(T*);
32 
33  T const* operator->() const { return m_data; }
34  T const& operator*() const { return *m_data; }
35  T const* get() const { return m_data; }
36 
37  T* operator->() { return m_data; }
38  T& operator*() { return *m_data; }
39  T* get() { return m_data; }
40 
41  bool isSet() const;
42 
43  void set(std::unique_ptr<T> iNewValue);
44 
45  T* release();
46  void reset();
47 
48  private:
51 
53  };
54 
55  template <typename T>
57 
58  template <typename T>
60 
61  template <typename T>
63  delete m_data.get();
64  }
65 
66  template <typename T>
68  return nullptr != m_data;
69  }
70 
71  template <typename T>
72  void ConstRespectingPtr<T>::set(std::unique_ptr<T> iNewValue) {
73  delete m_data;
74  m_data = iNewValue.release();
75  }
76 
77  template <typename T>
79  T* tmp = m_data;
80  m_data = nullptr;
81  return tmp;
82  }
83 
84  template <typename T>
86  delete m_data;
87  m_data = nullptr;
88  }
89 } // namespace edm
90 #endif
edm::ConstRespectingPtr::get
T const * get() const
Definition: ConstRespectingPtr.h:35
edm::ConstRespectingPtr::reset
void reset()
Definition: ConstRespectingPtr.h:85
edm::ConstRespectingPtr::operator*
T const & operator*() const
Definition: ConstRespectingPtr.h:34
propagate_const.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ConstRespectingPtr::operator*
T & operator*()
Definition: ConstRespectingPtr.h:38
findQualityFiles.v
v
Definition: findQualityFiles.py:179
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::ConstRespectingPtr::release
T * release()
Definition: ConstRespectingPtr.h:78
edm::propagate_const< T * >
edm::ConstRespectingPtr::set
void set(std::unique_ptr< T > iNewValue)
Definition: ConstRespectingPtr.h:72
edm::ConstRespectingPtr::isSet
bool isSet() const
Definition: ConstRespectingPtr.h:67
edm::ConstRespectingPtr::m_data
edm::propagate_const< T * > m_data
Definition: ConstRespectingPtr.h:52
edm::ConstRespectingPtr::operator->
T const * operator->() const
Definition: ConstRespectingPtr.h:33
fetchall_from_DQM_v2.release
release
Definition: fetchall_from_DQM_v2.py:92
edm::ConstRespectingPtr::operator->
T * operator->()
Definition: ConstRespectingPtr.h:37
edm::ConstRespectingPtr
Definition: ConstRespectingPtr.h:27
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ConstRespectingPtr::operator=
ConstRespectingPtr & operator=(ConstRespectingPtr< T > const &)=delete
reset
void reset(double vett[256])
Definition: TPedValues.cc:11
edm::ConstRespectingPtr::get
T * get()
Definition: ConstRespectingPtr.h:39
edm::ConstRespectingPtr::ConstRespectingPtr
ConstRespectingPtr()
Definition: ConstRespectingPtr.h:56
edm::ConstRespectingPtr::~ConstRespectingPtr
~ConstRespectingPtr()
Definition: ConstRespectingPtr.h:62