Main Page
Namespaces
Classes
Package Documentation
DataFormats
Common
interface
RefToPtr.h
Go to the documentation of this file.
1
#ifndef DataFormats_Common_RefToPtr_h
2
#define DataFormats_Common_RefToPtr_h
3
4
/*----------------------------------------------------------------------
5
6
Ref: A function template for conversion from Ref to Ptr
7
8
----------------------------------------------------------------------*/
9
/*
10
----------------------------------------------------------------------*/
11
12
#include "
DataFormats/Common/interface/Ref.h
"
13
#include "
DataFormats/Common/interface/RefTraits.h
"
14
#include "
DataFormats/Common/interface/Ptr.h
"
15
16
namespace
edm
{
17
template
<
typename
C>
18
Ptr<typename C::value_type>
refToPtr
(
19
Ref
<
C
,
typename
C::value_type
,
refhelper::FindUsingAdvance<C, typename C::value_type>
>
const
& ref) {
20
typedef
typename
C::value_type
T
;
21
if
(ref.isNull()) {
22
return
Ptr<T>
();
23
}
24
if
(ref.isTransient()) {
25
return
Ptr<T>
(ref.get(), ref.key());
26
}
else
{
27
//Another thread could change this value so get only once
28
EDProductGetter
const
* getter = ref.productGetter();
29
if
(getter) {
30
return
Ptr<T>
(ref.id(), ref.key(), getter);
31
}
32
}
33
return
Ptr<T>
(ref.id(), ref.get(), ref.key());
34
}
35
}
36
#endif
edm::refToPtr
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition:
RefToPtr.h:18
edm::EDProductGetter
Definition:
EDProductGetter.h:32
edm::Ref
Definition:
AssociativeIterator.h:51
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
patCaloMETCorrections_cff.C
C
Definition:
patCaloMETCorrections_cff.py:45
edm::refhelper::FindUsingAdvance
Definition:
RefTraits.h:12
Ptr.h
edm::Ptr
Definition:
AssociationVector.h:30
Ref.h
RefTraits.h
edm
HLT enums.
Definition:
AlignableModifier.h:17
T
long double T
Definition:
Basic3DVectorLD.h:66
Generated for CMSSW Reference Manual by
1.8.11