FWCore
Utilities
interface
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
22
#include "
FWCore/Utilities/interface/propagate_const.h
"
23
24
namespace
edm
{
25
26
template
<
typename
T>
27
class
ConstRespectingPtr
{
28
public
:
29
ConstRespectingPtr
();
30
explicit
ConstRespectingPtr
(
T
*);
31
~ConstRespectingPtr
();
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
:
49
ConstRespectingPtr
(
ConstRespectingPtr<T>
const
&) =
delete
;
50
ConstRespectingPtr
&
operator=
(
ConstRespectingPtr<T>
const
&) =
delete
;
51
52
edm::propagate_const<T*>
m_data
;
53
};
54
55
template
<
typename
T>
56
ConstRespectingPtr<T>::ConstRespectingPtr
() : m_data(nullptr) {}
57
58
template
<
typename
T>
59
ConstRespectingPtr<T>::ConstRespectingPtr
(
T
*
v
) : m_data(
v
) {}
60
61
template
<
typename
T>
62
ConstRespectingPtr<T>::~ConstRespectingPtr
() {
63
delete
m_data.
get
();
64
}
65
66
template
<
typename
T>
67
bool
ConstRespectingPtr<T>::isSet
()
const
{
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>
78
T
*
ConstRespectingPtr<T>::release
() {
79
T
*
tmp
= m_data;
80
m_data =
nullptr
;
81
return
tmp
;
82
}
83
84
template
<
typename
T>
85
void
ConstRespectingPtr<T>::reset
() {
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
Generated for CMSSW Reference Manual by
1.8.16