TrackingTools
TrajectoryState
interface
ProxyBase11.h
Go to the documentation of this file.
1
#ifndef Tracker_ProxyBase11_H
2
#define Tracker_ProxyBase11_H
3
4
#include "
FWCore/Utilities/interface/Visibility.h
"
5
#include "
FWCore/Utilities/interface/Likely.h
"
6
7
#ifdef TR_DEBUG
8
#include <iostream>
9
#endif
10
11
#include "
ChurnAllocator.h
"
12
22
template
<
class
T>
23
class
ProxyBase11
{
24
public
:
25
using
pointer
= std::shared_ptr<T>;
26
27
// protected:
28
29
ProxyBase11
() {}
30
31
explicit
ProxyBase11
(
T
*
p
) :
theData
(
p
) {}
32
template
<
typename
U>
33
ProxyBase11
(std::shared_ptr<U>
p
) :
theData
(
std
::
move
(
p
)) {}
34
template
<
typename
U>
35
ProxyBase11
&
operator=
(std::shared_ptr<U>
p
) {
36
theData
=
std::move
(
p
);
37
return
*
this
;
38
}
39
40
~ProxyBase11
() noexcept {
destroy
(); }
41
42
void
swap
(
ProxyBase11
&
other
) noexcept {
std::swap
(
theData
,
other
.theData); }
43
44
ProxyBase11
(
ProxyBase11
&&
other
) noexcept =
default
;
45
ProxyBase11
&
operator=
(
ProxyBase11
&&
other
) noexcept =
default
;
46
ProxyBase11
(
ProxyBase11
const
&
other
) =
default
;
47
ProxyBase11
&
operator=
(
const
ProxyBase11
&
other
) =
default
;
48
49
void
reset
() {
theData
.reset(); }
50
51
const
T
&
data
()
const
{
52
check
();
53
return
*
theData
;
54
}
55
56
T
&
unsharedData
() {
57
check
();
58
if
(
references
() > 1) {
59
theData
=
theData
->clone();
60
}
61
return
*
theData
;
62
}
63
64
T
&
sharedData
() {
65
check
();
66
return
*
theData
;
67
}
68
69
bool
isValid
()
const
{
return
bool
(
theData
); }
70
71
void
check
()
const
{
72
#ifdef TR_DEBUG
73
if
74
UNLIKELY
(!
theData
)
std::cout
<<
"dead proxyBase11 "
<<
references
() << std::endl;
75
#endif
76
}
77
78
void
destroy
() noexcept {}
79
int
references
()
const
{
return
theData
.use_count(); }
80
81
private
:
82
std::shared_ptr<T>
theData
;
83
};
84
85
template
<
class
T>
86
inline
void
swap
(
ProxyBase11<T>
&
lh
,
ProxyBase11<T>
& rh) noexcept {
87
lh
.swap(rh);
88
}
89
90
#endif // Tracker_ProxyBase11_H
Likely.h
Visibility.h
electrons_cff.bool
bool
Definition:
electrons_cff.py:372
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
ProxyBase11::references
int references() const
Definition:
ProxyBase11.h:79
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
ProxyBase11::reset
void reset()
Definition:
ProxyBase11.h:49
mathSSE::lh
bool int lh
Definition:
SIMDVec.h:20
swap
void swap(ProxyBase11< T > &lh, ProxyBase11< T > &rh) noexcept
Definition:
ProxyBase11.h:86
UNLIKELY
#define UNLIKELY(x)
Definition:
Likely.h:21
ProxyBase11::operator=
ProxyBase11 & operator=(std::shared_ptr< U > p)
Definition:
ProxyBase11.h:35
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition:
DataFrameContainer.h:209
ProxyBase11::theData
std::shared_ptr< T > theData
Definition:
ProxyBase11.h:82
ProxyBase11::pointer
std::shared_ptr< T > pointer
Definition:
ProxyBase11.h:25
trackingPlots.other
other
Definition:
trackingPlots.py:1465
ProxyBase11::ProxyBase11
ProxyBase11(T *p)
Definition:
ProxyBase11.h:31
ProxyBase11::swap
void swap(ProxyBase11 &other) noexcept
Definition:
ProxyBase11.h:42
ProxyBase11::sharedData
T & sharedData()
Definition:
ProxyBase11.h:64
ChurnAllocator.h
ProxyBase11::unsharedData
T & unsharedData()
Definition:
ProxyBase11.h:56
ProxyBase11::isValid
bool isValid() const
Definition:
ProxyBase11.h:69
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
ProxyBase11
Definition:
ProxyBase11.h:23
T
long double T
Definition:
Basic3DVectorLD.h:48
ProxyBase11::data
const T & data() const
Definition:
ProxyBase11.h:51
ProxyBase11::ProxyBase11
ProxyBase11()
Definition:
ProxyBase11.h:29
ProxyBase11::destroy
void destroy() noexcept
Definition:
ProxyBase11.h:78
ProxyBase11::~ProxyBase11
~ProxyBase11() noexcept
Definition:
ProxyBase11.h:40
ProxyBase11::check
void check() const
Definition:
ProxyBase11.h:71
ProxyBase11::ProxyBase11
ProxyBase11(std::shared_ptr< U > p)
Definition:
ProxyBase11.h:33
Generated for CMSSW Reference Manual by
1.8.16