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*);
34 
35  T const* operator->() const { return m_data; }
36  T const& operator*() const { return *m_data; }
37  T const* get() const { return m_data; }
38 
39  T* operator->() { return m_data; }
40  T& operator*() { return *m_data; }
41  T* get() { return m_data; }
42 
43  bool isSet() const;
44 
45  void set(std::unique_ptr<T> iNewValue);
46 
47  T* release();
48  void reset();
49 
50  private:
52  };
53 
54  template <typename T>
56 
57  template <typename T>
59 
60  template <typename T>
62  delete m_data.get();
63  }
64 
65  template <typename T>
67  return nullptr != m_data;
68  }
69 
70  template <typename T>
71  void ConstRespectingPtr<T>::set(std::unique_ptr<T> iNewValue) {
72  delete m_data;
73  m_data = iNewValue.release();
74  }
75 
76  template <typename T>
78  T* tmp = m_data;
79  m_data = nullptr;
80  return tmp;
81  }
82 
83  template <typename T>
85  delete m_data;
86  m_data = nullptr;
87  }
88 } // namespace edm
89 #endif
T const & operator*() const
edm::propagate_const< T * > m_data
HLT enums.
T const * operator->() const
tmp
align.sh
Definition: createJobs.py:716
long double T
ConstRespectingPtr & operator=(ConstRespectingPtr< T > const &)=delete
void reset(double vett[256])
Definition: TPedValues.cc:11