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
(
ConstRespectingPtr<T>
const
&) =
delete
;
32
ConstRespectingPtr
&
operator=
(
ConstRespectingPtr<T>
const
&) =
delete
;
33
~ConstRespectingPtr
();
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
:
51
edm::propagate_const<T*>
m_data
;
52
};
53
54
template
<
typename
T>
55
ConstRespectingPtr<T>::ConstRespectingPtr
() : m_data(nullptr) {}
56
57
template
<
typename
T>
58
ConstRespectingPtr<T>::ConstRespectingPtr
(
T
*
v
) : m_data(
v
) {}
59
60
template
<
typename
T>
61
ConstRespectingPtr<T>::~ConstRespectingPtr
() {
62
delete
m_data.
get
();
63
}
64
65
template
<
typename
T>
66
bool
ConstRespectingPtr<T>::isSet
()
const
{
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>
77
T
*
ConstRespectingPtr<T>::release
() {
78
T
*
tmp
= m_data;
79
m_data =
nullptr
;
80
return
tmp
;
81
}
82
83
template
<
typename
T>
84
void
ConstRespectingPtr<T>::reset
() {
85
delete
m_data;
86
m_data =
nullptr
;
87
}
88
}
// namespace edm
89
#endif
edm::propagate_const
Definition:
propagate_const.h:32
edm::ConstRespectingPtr::operator*
T const & operator*() const
Definition:
ConstRespectingPtr.h:36
edm::ConstRespectingPtr::ConstRespectingPtr
ConstRespectingPtr()
Definition:
ConstRespectingPtr.h:55
edm::ConstRespectingPtr::m_data
edm::propagate_const< T * > m_data
Definition:
ConstRespectingPtr.h:51
findQualityFiles.v
v
Definition:
findQualityFiles.py:179
edm::ConstRespectingPtr::~ConstRespectingPtr
~ConstRespectingPtr()
Definition:
ConstRespectingPtr.h:61
edm::ConstRespectingPtr::isSet
bool isSet() const
Definition:
ConstRespectingPtr.h:66
edm::ConstRespectingPtr::reset
void reset()
Definition:
ConstRespectingPtr.h:84
edm::ConstRespectingPtr
Definition:
ConstRespectingPtr.h:27
edm::ConstRespectingPtr::operator->
T * operator->()
Definition:
ConstRespectingPtr.h:39
edm::ConstRespectingPtr::get
T const * get() const
Definition:
ConstRespectingPtr.h:37
edm
HLT enums.
Definition:
AlignableModifier.h:19
fetchall_from_DQM_v2.release
release
Definition:
fetchall_from_DQM_v2.py:92
edm::ConstRespectingPtr::release
T * release()
Definition:
ConstRespectingPtr.h:77
edm::ConstRespectingPtr::operator->
T const * operator->() const
Definition:
ConstRespectingPtr.h:35
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
T
long double T
Definition:
Basic3DVectorLD.h:48
edm::ConstRespectingPtr::operator*
T & operator*()
Definition:
ConstRespectingPtr.h:40
edm::ConstRespectingPtr::operator=
ConstRespectingPtr & operator=(ConstRespectingPtr< T > const &)=delete
reset
void reset(double vett[256])
Definition:
TPedValues.cc:11
propagate_const.h
Generated for CMSSW Reference Manual by
1.8.14