src
DataFormats
Common
interface
OrphanHandle.h
Go to the documentation of this file.
1
#ifndef DataFormats_Common_OrphanHandle_h
2
#define DataFormats_Common_OrphanHandle_h
3
4
/*----------------------------------------------------------------------
5
6
OrphanHandle: Non-owning "smart pointer" for reference to EDProducts.
7
8
This is a very preliminary version, and lacks safety features and elegance.
9
10
If the pointed-to EDProduct is destroyed, use of the OrphanHandle
11
becomes undefined. There is no way to query the OrphanHandle to
12
discover if this has happened.
13
14
OrphanHandles can have:
15
-- Product pointer null and id == 0;
16
-- Product pointer valid and id != 0;
17
18
To check validity, one can use the isValid() function.
19
20
----------------------------------------------------------------------*/
21
22
#include "
DataFormats/Common/interface/OrphanHandleBase.h
"
23
24
namespace
edm
{
25
template
<
typename
T>
26
class
OrphanHandle :
public
OrphanHandleBase {
27
public
:
28
typedef
T
element_type
;
29
30
// Default constructed handles are invalid.
31
OrphanHandle
();
32
33
OrphanHandle
(
T
const
*
prod
,
ProductID
const
&
id
);
34
35
~OrphanHandle
();
36
37
T
const
*
product
()
const
;
38
T
const
*
operator->
()
const
;
// alias for product()
39
T
const
&
operator*
()
const
;
40
41
private
:
42
};
43
44
template
<
class
T>
45
OrphanHandle<T>::OrphanHandle
() :
OrphanHandleBase
() {}
46
47
template
<
class
T>
48
OrphanHandle<T>::OrphanHandle
(
T
const
*
prod
,
ProductID
const
& theId) :
OrphanHandleBase
(
prod
, theId) {}
49
50
template
<
class
T>
51
OrphanHandle<T>::~OrphanHandle
() {}
52
53
template
<
class
T>
54
T
const
*
OrphanHandle<T>::product
()
const
{
55
return
static_cast<
T
const
*
>
(productStorage());
56
}
57
58
template
<
class
T>
59
T
const
*
OrphanHandle<T>::operator->
()
const
{
60
return
product();
61
}
62
63
template
<
class
T>
64
T
const
&
OrphanHandle<T>::operator*
()
const
{
65
return
*product();
66
}
67
68
}
// namespace edm
69
#endif
runTheMatrix.const
const
Definition:
runTheMatrix.py:376
edm::OrphanHandle::~OrphanHandle
~OrphanHandle()
Definition:
OrphanHandle.h:51
dumpMFGeometry_cfg.prod
prod
Definition:
dumpMFGeometry_cfg.py:24
edm::OrphanHandle
Definition:
EDProductfwd.h:39
edm::OrphanHandle::element_type
T element_type
Definition:
OrphanHandle.h:28
edm::OrphanHandleBase
Definition:
OrphanHandleBase.h:28
edm::OrphanHandle::OrphanHandle
OrphanHandle()
Definition:
OrphanHandle.h:45
edm::ProductID
Definition:
ProductID.h:27
edm::OrphanHandle::operator->
T const * operator->() const
Definition:
OrphanHandle.h:59
OrphanHandleBase.h
edm::OrphanHandle::operator*
T const & operator*() const
Definition:
OrphanHandle.h:64
edm::OrphanHandle::product
T const * product() const
Definition:
OrphanHandle.h:54
edm
HLT enums.
Definition:
AlignableModifier.h:19
operator*
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Definition:
MatrixMeschach.cc:117
T
long double T
Definition:
Basic3DVectorLD.h:48
Generated for CMSSW Reference Manual by
1.8.14