Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
DataFormats
Common
interface
TestHandle.h
Go to the documentation of this file.
1
#ifndef DataFormats_Common_TestHandle_h
2
#define DataFormats_Common_TestHandle_h
3
4
/*----------------------------------------------------------------------
5
6
TestHandle: Non-owning "smart pointer" for reference to EDProducts.
7
8
9
This is a very preliminary version, and lacks safety features and
10
elegance.
11
12
If the pointed-to EDProduct is destroyed, use of the TestHandle
13
becomes undefined. There is no way to query the TestHandle to
14
discover if this has happened.
15
16
TestHandles can have:
17
-- Product pointer null and id == 0;
18
-- Product pointer valid and id != 0;
19
20
To check validity, one can use the isValid() function.
21
22
----------------------------------------------------------------------*/
23
24
#include "
DataFormats/Common/interface/OrphanHandleBase.h
"
25
26
namespace
edm {
27
28
template
<
typename
T>
29
class
TestHandle
:
public
OrphanHandleBase
{
30
public
:
31
typedef
T
element_type
;
32
33
// Default constructed handles are invalid.
34
TestHandle
();
35
36
TestHandle
(
T
const
*
prod
,
ProductID
const
&
id
);
37
38
~TestHandle
();
39
40
T
const
*
product
()
const
;
41
T
const
*
operator->
()
const
;
// alias for product()
42
T
const
&
operator*
()
const
;
43
44
private
:
45
};
46
47
template
<
class
T>
48
TestHandle<T>::TestHandle
() :
OrphanHandleBase
()
49
{ }
50
51
template
<
class
T>
52
TestHandle<T>::TestHandle
(
T
const
*
prod
,
ProductID
const
& theId) :
OrphanHandleBase
(prod, theId) {
53
}
54
55
template
<
class
T>
56
TestHandle<T>::~TestHandle
() {}
57
58
template
<
class
T>
59
T
const
*
60
TestHandle<T>::product
()
const
{
61
return
static_cast<
T
const
*
>
(productStorage());
62
}
63
64
template
<
class
T>
65
T
const
*
66
TestHandle<T>::operator->
()
const
{
67
return
product();
68
}
69
70
template
<
class
T>
71
T
const
&
72
TestHandle<T>::operator*
()
const
{
73
return
*product();
74
}
75
76
}
77
#endif
edm::TestHandle::product
T const * product() const
Definition:
TestHandle.h:60
edm::TestHandle::operator*
T const & operator*() const
Definition:
TestHandle.h:72
edm::OrphanHandleBase
Definition:
OrphanHandleBase.h:28
edm::ProductID
Definition:
ProductID.h:27
edm::TestHandle::element_type
T element_type
Definition:
TestHandle.h:31
edm::TestHandle::operator->
T const * operator->() const
Definition:
TestHandle.h:66
edmStreamStallGrapher.const
string const
Definition:
edmStreamStallGrapher.py:590
OrphanHandleBase.h
edm::TestHandle
Definition:
TestHandle.h:29
T
long double T
Definition:
Basic3DVectorLD.h:57
edm::TestHandle::TestHandle
TestHandle()
Definition:
TestHandle.h:48
parseEventContent.prod
dictionary prod
Definition:
parseEventContent.py:153
edm::TestHandle::~TestHandle
~TestHandle()
Definition:
TestHandle.h:56
Generated for CMSSW Reference Manual by
1.8.5