Main Page
Namespaces
Classes
Package Documentation
CVS Directory
WorkBook
Offline Guide
Release schedule
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
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
class
EDProduct;
28
29
template
<
typename
T>
30
class
TestHandle
:
public
OrphanHandleBase
{
31
public
:
32
typedef
T
element_type
;
33
34
// Default constructed handles are invalid.
35
TestHandle
();
36
37
TestHandle
(
T
const
*
prod
,
ProductID
const
&
id
);
38
39
~TestHandle
();
40
41
T
const
*
product
()
const
;
42
T
const
*
operator->
()
const
;
// alias for product()
43
T
const
&
operator*
()
const
;
44
45
private
:
46
};
47
48
template
<
class
T>
49
TestHandle<T>::TestHandle
() :
OrphanHandleBase
()
50
{ }
51
52
template
<
class
T>
53
TestHandle<T>::TestHandle
(
T
const
*
prod
,
ProductID
const
& theId) :
OrphanHandleBase
(prod, theId) {
54
}
55
56
template
<
class
T>
57
TestHandle<T>::~TestHandle
() {}
58
59
template
<
class
T>
60
T
const
*
61
TestHandle<T>::product
()
const
{
62
return
static_cast<
T
const
*
>
(productStorage());
63
}
64
65
template
<
class
T>
66
T
const
*
67
TestHandle<T>::operator->
()
const
{
68
return
product();
69
}
70
71
template
<
class
T>
72
T
const
&
73
TestHandle<T>::operator*
()
const
{
74
return
*product();
75
}
76
77
}
78
#endif
edm::TestHandle::product
T const * product() const
Definition:
TestHandle.h:61
edm::TestHandle::operator*
T const & operator*() const
Definition:
TestHandle.h:73
edm::OrphanHandleBase
Definition:
OrphanHandleBase.h:30
edm::ProductID
Definition:
ProductID.h:27
edm::TestHandle::element_type
T element_type
Definition:
TestHandle.h:32
edm::TestHandle::operator->
T const * operator->() const
Definition:
TestHandle.h:67
OrphanHandleBase.h
edm::TestHandle
Definition:
TestHandle.h:30
compareJSON.const
string const
Definition:
compareJSON.py:14
T
long double T
Definition:
Basic3DVectorLD.h:57
edm::TestHandle::TestHandle
TestHandle()
Definition:
TestHandle.h:49
parseEventContent.prod
dictionary prod
Definition:
parseEventContent.py:153
edm::TestHandle::~TestHandle
~TestHandle()
Definition:
TestHandle.h:57
Generated for CMSSW Reference Manual by
1.8.5