DataFormats
Common
src
HandleBase.cc
Go to the documentation of this file.
1
#include "
DataFormats/Common/interface/HandleBase.h
"
2
#include "
DataFormats/Provenance/interface/Provenance.h
"
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
#include "
FWCore/Utilities/interface/Likely.h
"
5
6
namespace
{
7
void
throwInvalidHandleDeref() {
8
throw
cms::Exception
(
"DereferenceUnsetHandle"
)
9
<<
"An attempt was made to dereference an edm::Handle which was never set."
;
10
}
11
void
throwInvalidHandleProv() {
12
throw
cms::Exception
(
"ProvenanceFromUnsetHandle"
)
13
<<
"An attempt was made to get the ProductId from an edm::Handle which was never set."
;
14
}
15
}
// namespace
16
17
namespace
edm
{
18
void
const
*
HandleBase::productStorage
()
const
{
19
if
UNLIKELY
(not
product_
) {
20
if
LIKELY
(static_cast<bool>(
whyFailedFactory_
)) {
21
whyFailedFactory_
->make()->raise();
22
}
else
{
23
throwInvalidHandleDeref();
24
}
25
}
26
return
product_
;
27
}
28
29
ProductID
HandleBase::id
()
const
{
30
if
UNLIKELY
(not
prov_
) {
31
if
LIKELY
(static_cast<bool>(
whyFailedFactory_
)) {
32
whyFailedFactory_
->make()->raise();
33
}
else
{
34
throwInvalidHandleProv();
35
}
36
}
37
return
prov_
->
productID
();
38
}
39
}
// namespace edm
Likely.h
edm::HandleBase::productStorage
void const * productStorage() const
Definition:
HandleBase.cc:18
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::Provenance::productID
ProductID const & productID() const
Definition:
Provenance.h:79
HandleBase.h
UNLIKELY
#define UNLIKELY(x)
Definition:
Likely.h:21
Provenance.h
edm::HandleBase::whyFailedFactory_
std::shared_ptr< HandleExceptionFactory const > whyFailedFactory_
Definition:
HandleBase.h:110
edm::HandleBase::prov_
Provenance const * prov_
Definition:
HandleBase.h:109
LIKELY
#define LIKELY(x)
Definition:
Likely.h:20
Exception
Definition:
hltDiff.cc:246
edm::HandleBase::product_
void const * product_
Definition:
HandleBase.h:108
Exception.h
edm::HandleBase::id
ProductID id() const
Definition:
HandleBase.cc:29
edm::ProductID
Definition:
ProductID.h:27
Generated for CMSSW Reference Manual by
1.8.16