CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::RefToBase< T > Class Template Reference

#include <AssociativeIterator.h>

Public Types

typedef T value_type
 

Public Member Functions

template<class REF >
REF castTo () const
 
value_type const * get () const
 
std::unique_ptr< reftobase::RefHolderBaseholder () const
 
ProductID id () const
 
bool isAvailable () const
 
bool isNonnull () const
 Checks for non-null. More...
 
bool isNull () const
 Checks for null. More...
 
bool isTransient () const
 
size_t key () const
 
bool operator! () const
 Checks for null. More...
 
bool operator!= (RefToBase const &rhs) const
 
value_type const & operator* () const
 
value_type const * operator-> () const
 
RefToBaseoperator= (RefToBase &&other) noexcept
 
RefToBaseoperator= (RefToBase const &rhs)
 
bool operator== (RefToBase const &rhs) const
 
EDProductGetter const * productGetter () const
 
 RefToBase ()
 
 RefToBase (Handle< View< T >> const &handle, size_t i)
 
template<typename C1 , typename T1 , typename F1 >
 RefToBase (Ref< C1, T1, F1 > const &r)
 
template<typename C >
 RefToBase (RefProd< C > const &r)
 
 RefToBase (RefToBase &&other) noexcept
 
 RefToBase (RefToBase const &other)
 
template<typename T1 >
 RefToBase (RefToBase< T1 > const &r)
 
 RefToBase (RefToBaseProd< T > const &r, size_t i)
 
 RefToBase (std::shared_ptr< reftobase::RefHolderBase > p)
 
 RefToBase (std::unique_ptr< reftobase::BaseHolder< value_type >>)
 
void swap (RefToBase &other)
 
 ~RefToBase () noexcept
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

value_type const * getPtrImpl () const
 

Private Attributes

reftobase::BaseHolder< value_type > * holder_
 

Friends

template<typename B >
class RefToBase
 
class RefToBaseProd< T >
 
class RefToBaseVector< T >
 

Detailed Description

template<class T>
class edm::RefToBase< T >

Definition at line 54 of file AssociativeIterator.h.

Member Typedef Documentation

◆ value_type

template<class T>
typedef T edm::RefToBase< T >::value_type

Definition at line 72 of file RefToBase.h.

Constructor & Destructor Documentation

◆ RefToBase() [1/10]

template<class T >
RefToBase::RefToBase ( )
inline

Definition at line 139 of file RefToBase.h.

139 : holder_(nullptr) {}

◆ RefToBase() [2/10]

template<class T >
RefToBase::RefToBase ( RefToBase< T > const &  other)
inline

Definition at line 142 of file RefToBase.h.

142 : holder_(other.holder_ ? other.holder_->clone() : nullptr) {}

◆ RefToBase() [3/10]

template<class T >
RefToBase::RefToBase ( RefToBase< T > &&  other)
inlinenoexcept

Definition at line 145 of file RefToBase.h.

145  : holder_(other.holder_) {
146  other.holder_ = nullptr;
147  }

◆ RefToBase() [4/10]

template<class T >
template<typename C1 , typename T1 , typename F1 >
RefToBase::RefToBase ( Ref< C1, T1, F1 > const &  r)
inlineexplicit

Definition at line 159 of file RefToBase.h.

160  : holder_(new reftobase::Holder<T, Ref<C1, T1, F1>>(iRef)) {}

◆ RefToBase() [5/10]

template<class T >
template<typename C >
RefToBase::RefToBase ( RefProd< C > const &  r)
inlineexplicit

Definition at line 164 of file RefToBase.h.

164 : holder_(new reftobase::Holder<T, RefProd<C>>(iRef)) {}

◆ RefToBase() [6/10]

template<class T>
RefToBase::RefToBase ( RefToBaseProd< T > const &  r,
size_t  i 
)
inline

Definition at line 354 of file RefToBase.h.

355  : holder_(r.operator->()->refAt(i).holder_->clone()) {}

◆ RefToBase() [7/10]

template<typename T>
RefToBase::RefToBase ( Handle< View< T >> const &  handle,
size_t  i 
)
inline

Definition at line 358 of file RefToBase.h.

359  : holder_(handle.operator->()->refAt(i).holder_->clone()) {}

◆ RefToBase() [8/10]

template<class T >
template<typename T1 >
RefToBase::RefToBase ( RefToBase< T1 > const &  r)
inlineexplicit

Definition at line 168 of file RefToBase.h.

169  : holder_(
170  new reftobase::IndirectHolder<T>(std::shared_ptr<edm::reftobase::RefHolderBase>(iRef.holder().release()))) {
171  // OUT: holder_( new reftobase::Holder<T,RefToBase<T1> >(iRef ) ) {
172  // Forcing the conversion through IndirectHolder,
173  // as Holder<T,RefToBase<T1>> would need dictionaries we will never have.
174  // In this way we only need the IndirectHolder<T> and the RefHolder of the real type of the item
175  // This might cause a small performance penalty.
176  static_assert(std::is_base_of<T, T1>::value, "RefToBase::RefToBase T not base of T1");
177  }

◆ RefToBase() [9/10]

template<class T>
RefToBase::RefToBase ( std::unique_ptr< reftobase::BaseHolder< value_type >>  p)
inline

Definition at line 180 of file RefToBase.h.

180 : holder_(p.release()) {}

◆ RefToBase() [10/10]

template<class T>
RefToBase::RefToBase ( std::shared_ptr< reftobase::RefHolderBase p)
inline

Definition at line 183 of file RefToBase.h.

184  : holder_(new reftobase::IndirectHolder<T>(p)) {}

◆ ~RefToBase()

template<class T >
RefToBase::~RefToBase ( )
inlinenoexcept

Definition at line 187 of file RefToBase.h.

187  {
188  delete holder_;
189  }

Member Function Documentation

◆ castTo()

template<class T >
template<class REF >
REF RefToBase::castTo ( ) const

Definition at line 257 of file RefToBase.h.

257  {
258  if (!holder_) {
260  "attempting to cast a null RefToBase;\n"
261  "You should check for nullity before casting.");
262  }
263 
264  checkTypeCompatibility<T, typename REF::value_type>();
265 
266  // If REF is type edm::Ref<C,T,F>, then it is impossible to
267  // check the container type C here. We just have to assume
268  // that the caller provided the correct type.
269 
270  EDProductGetter const* getter = productGetter();
271  if (getter) {
272  return REF(id(), key(), getter);
273  }
274 
275  T const* value = get();
276  if (value == nullptr) {
277  return REF(id());
278  }
279  typename REF::value_type const* newValue = convertTo<T, typename REF::value_type>(value);
280  if (newValue) {
281  return REF(id(), newValue, key(), isTransient());
282  }
283 
285  "RefToBase<T>::castTo Error attempting to cast mismatched types\n"
286  "casting from RefToBase with T: ",
287  typeid(T).name(),
288  "\ncasting to: ",
289  typeid(REF).name());
290  return REF();
291  }

Referenced by ElectronSeedAnalyzer::analyze(), ZMuMuAnalyzer::analyze(), ZMuMuAnalyzer_cynematics::analyze(), TransientTrackBuilder::build(), ConversionProducer::buildCollection(), MuonTrajectoryCleaner::clean(), ZToMuMuFilter::filter(), HLTElectronPixelMatchFilter::getNrOfMatches(), pat::PATJetUpdater::produce(), MuMuForEmbeddingSelector::produce(), ConversionTrackProducer::produce(), EgammaHLTPixelMatchVarProducer::produce(), and reco::PFTau::sourceCandidatePtr().

◆ Class_Version()

template<class T>
static short edm::RefToBase< T >::Class_Version ( )
inlinestatic

Definition at line 124 of file RefToBase.h.

125 :
126  value_type const* getPtrImpl() const;

◆ get()

template<class T >
T const * RefToBase::get ( ) const
inline

Definition at line 209 of file RefToBase.h.

209  {
210  return getPtrImpl();
211  }

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), DimuonStatistics::analyze(), GlbMuQualityCutsAnalysis::analyze(), TkConvValidator::analyze(), TestOutliers::analyze(), PhotonValidator::analyze(), IsolatedTracksNxN::analyze(), PFElecTkProducer::applySelection(), ConversionProducer::buildCollection(), FWPFTauProxyBuilder::buildViewType(), rrapi.RRApi::columns(), util.rrapi.RRApi::columns(), PFMEtSignInterfaceBase::compResolution(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), rrapi.RRApi::count(), util.rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), PFElecTkProducer::findPfRef(), reco::GenJet::genParticle(), reco::Candidate::get(), reco::LeafCandidate::get(), L6SLBCorrector::getBTagInfoIndex(), L6SLBCorrectorImpl::getBTagInfoIndex(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), PFElecTkProducer::isSameEgSC(), PFElecTkProducer::isSharingEcalEnergyWithEgSC(), reco::makeSpecific(), TemplatedSecondaryVertexProducer< IPTI, VTX >::matchSubjets(), pat::MET::MET(), pat::TriggerObject::origObjCand(), DimuonMCMatcher::produce(), pat::PATJetProducer::produce(), ConversionTrackProducer::produce(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), util.rrapi.RRApi::tables(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), util.rrapi.RRApi::templates(), rrapi.RRApi::templates(), reco::ConversionTrack::track(), pat::VertexAssociation::track(), rrapi.RRApi::workspaces(), and util.rrapi.RRApi::workspaces().

◆ getPtrImpl()

template<class T >
T const * RefToBase::getPtrImpl ( ) const
inlineprivate

Definition at line 332 of file RefToBase.h.

332  {
333  return holder_ ? holder_->getPtr() : nullptr;
334  }

◆ holder()

template<class T >
std::unique_ptr< reftobase::RefHolderBase > RefToBase::holder ( ) const

Definition at line 337 of file RefToBase.h.

337  {
338  return holder_ ? holder_->holder() : std::unique_ptr<reftobase::RefHolderBase>();
339  }

Referenced by edm::RefToBase< TrajectorySeed >::holder().

◆ id()

template<class T >
ProductID RefToBase::id ( ) const
inline

◆ isAvailable()

template<class T>
bool edm::RefToBase< T >::isAvailable ( ) const
inline

Checks if collection is in memory or available in the Event. No type checking is done.

Definition at line 119 of file RefToBase.h.

119 { return holder_ ? holder_->isAvailable() : false; }

Referenced by edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert().

◆ isNonnull()

template<class T >
bool RefToBase::isNonnull ( ) const
inline

◆ isNull()

template<class T >
bool RefToBase::isNull ( ) const
inline

◆ isTransient()

template<class T>
bool edm::RefToBase< T >::isTransient ( ) const
inline

Definition at line 121 of file RefToBase.h.

121 { return holder_ ? holder_->isTransient() : false; }

◆ key()

template<class T >
size_t RefToBase::key ( ) const
inline

◆ operator!()

template<class T >
bool RefToBase::operator! ( ) const
inline

Checks for null.

Definition at line 307 of file RefToBase.h.

307  {
308  return isNull();
309  }

◆ operator!=()

template<class T>
bool RefToBase::operator!= ( RefToBase< T > const &  rhs) const
inline

Definition at line 317 of file RefToBase.h.

317  {
318  return !(*this == rhs);
319  }

◆ operator*()

template<class T >
T const & RefToBase::operator* ( ) const
inline

Definition at line 199 of file RefToBase.h.

199  {
200  return *getPtrImpl();
201  }

◆ operator->()

template<class T >
T const * RefToBase::operator-> ( ) const
inline

Definition at line 204 of file RefToBase.h.

204  {
205  return getPtrImpl();
206  }

◆ operator=() [1/2]

template<class T >
RefToBase< T > & RefToBase::operator= ( RefToBase< T > &&  other)
inlinenoexcept

Definition at line 150 of file RefToBase.h.

150  {
151  delete holder_;
152  holder_ = other.holder_;
153  other.holder_ = nullptr;
154  return *this;
155  }

◆ operator=() [2/2]

template<class T>
RefToBase& edm::RefToBase< T >::operator= ( RefToBase< T > const &  rhs)

◆ operator==()

template<class T>
bool RefToBase::operator== ( RefToBase< T > const &  rhs) const
inline

Definition at line 312 of file RefToBase.h.

312  {
313  return holder_ ? holder_->isEqualTo(*rhs.holder_) : holder_ == rhs.holder_;
314  }

◆ productGetter()

template<class T >
EDProductGetter const * RefToBase::productGetter ( ) const
inline

Definition at line 327 of file RefToBase.h.

327  {
328  return holder_ ? holder_->productGetter() : nullptr;
329  }

◆ swap()

template<class T>
void RefToBase::swap ( RefToBase< T > &  other)
inline

Definition at line 322 of file RefToBase.h.

322  {
323  std::swap(holder_, other.holder_);
324  }

Friends And Related Function Documentation

◆ RefToBase

template<class T>
template<typename B >
friend class RefToBase
friend

Definition at line 131 of file RefToBase.h.

◆ RefToBaseProd< T >

template<class T>
friend class RefToBaseProd< T >
friend

Definition at line 129 of file RefToBase.h.

◆ RefToBaseVector< T >

template<class T>
friend class RefToBaseVector< T >
friend

Definition at line 128 of file RefToBase.h.

Member Data Documentation

◆ holder_

template<class T>
reftobase::BaseHolder<value_type>* edm::RefToBase< T >::holder_
private
edm::RefToBase::isNull
bool isNull() const
Checks for null.
Definition: RefToBase.h:295
edm::RefToBase::productGetter
EDProductGetter const * productGetter() const
Definition: RefToBase.h:327
mps_fire.i
i
Definition: mps_fire.py:428
edm::errors::InvalidReference
Definition: EDMException.h:39
edm::RefToBase::key
size_t key() const
Definition: RefToBase.h:219
patZpeak.handle
handle
Definition: patZpeak.py:23
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::reftobase::BaseHolder::productGetter
virtual EDProductGetter const * productGetter() const =0
edm::reftobase::BaseHolder::isAvailable
virtual bool isAvailable() const =0
edm::RefToBase::value_type
T value_type
Definition: RefToBase.h:72
edm::reftobase::BaseHolder::isEqualTo
virtual bool isEqualTo(BaseHolder< T > const &rhs) const =0
edm::reftobase::BaseHolder::holder
virtual std::unique_ptr< RefHolderBase > holder() const =0
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
edm::reftobase::BaseHolder::key
virtual size_t key() const =0
trackingPlots.other
other
Definition: trackingPlots.py:1467
edm::RefToBase::get
value_type const * get() const
Definition: RefToBase.h:209
EDProductGetter
value
Definition: value.py:1
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::reftobase::BaseHolder::getPtr
virtual T const * getPtr() const =0
edm::ProductID::isValid
bool isValid() const
Definition: ProductID.h:32
edm::reftobase::BaseHolder::isTransient
virtual bool isTransient() const =0
edm::RefToBase::id
ProductID id() const
Definition: RefToBase.h:214
alignCSCRings.r
r
Definition: alignCSCRings.py:93
T
long double T
Definition: Basic3DVectorLD.h:48
edm::RefToBase::isTransient
bool isTransient() const
Definition: RefToBase.h:121
edm::RefToBase::holder_
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:127
relativeConstraints.value
value
Definition: relativeConstraints.py:53
edm::Exception::throwThis
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::reftobase::BaseHolder::id
virtual ProductID id() const =0
edm::RefToBase::getPtrImpl
value_type const * getPtrImpl() const
Definition: RefToBase.h:332