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)
 
RefToBaseoperator= (RefToBase const &rhs)
 
bool operator== (RefToBase const &rhs) const
 
EDProductGetter const * productGetter () const
 
 RefToBase ()
 
 RefToBase (RefToBase const &other)
 
 RefToBase (RefToBase &&other)
 
template<typename C1 , typename T1 , typename F1 >
 RefToBase (Ref< C1, T1, F1 > const &r)
 
template<typename C >
 RefToBase (RefProd< C > const &r)
 
 RefToBase (RefToBaseProd< T > const &r, size_t i)
 
 RefToBase (Handle< View< T > > const &handle, size_t i)
 
template<typename T1 >
 RefToBase (RefToBase< T1 > const &r)
 
 RefToBase (std::unique_ptr< reftobase::BaseHolder< value_type >>)
 
 RefToBase (std::shared_ptr< reftobase::RefHolderBase > p)
 
void swap (RefToBase &other)
 
 ~RefToBase ()
 

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 50 of file AssociativeIterator.h.

Member Typedef Documentation

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

Definition at line 68 of file RefToBase.h.

Constructor & Destructor Documentation

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

Definition at line 134 of file RefToBase.h.

134  :
135  holder_(nullptr)
136  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
RefToBase::RefToBase ( RefToBase< T > const &  other)
inline

Definition at line 140 of file RefToBase.h.

140  :
141  holder_(other.holder_ ? other.holder_->clone() : nullptr)
142  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
RefToBase::RefToBase ( RefToBase< T > &&  other)
inline

Definition at line 146 of file RefToBase.h.

References trackingPlots::other.

146  :
147  holder_(other.holder_) { other.holder_=nullptr;}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
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.

159  :
160  holder_(new reftobase::Holder<T,Ref<C1, T1, F1> >(iRef))
161  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
long double T
template<class T >
template<typename C >
RefToBase::RefToBase ( RefProd< C > const &  r)
inlineexplicit

Definition at line 166 of file RefToBase.h.

166  :
167  holder_(new reftobase::Holder<T,RefProd<C> >(iRef))
168  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
long double T
template<class T>
RefToBase::RefToBase ( RefToBaseProd< T > const &  r,
size_t  i 
)
inline

Definition at line 416 of file RefToBase.h.

416  :
417  holder_( r.operator->()->refAt( i ).holder_->clone() ) {
418  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<typename T>
RefToBase::RefToBase ( Handle< View< T > > const &  handle,
size_t  i 
)
inline

Definition at line 422 of file RefToBase.h.

422  :
423  holder_( handle.operator->()->refAt( i ).holder_->clone() ) {
424  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
template<typename T1 >
RefToBase::RefToBase ( RefToBase< T1 > const &  r)
inlineexplicit

Definition at line 173 of file RefToBase.h.

References relativeConstraints::value.

173  :
174  holder_(new reftobase::IndirectHolder<T> (
175  std::shared_ptr< edm::reftobase::RefHolderBase>(iRef.holder().release())
176  ) )
177  {
178  // OUT: holder_( new reftobase::Holder<T,RefToBase<T1> >(iRef ) ) {
179  // Forcing the conversion through IndirectHolder,
180  // as Holder<T,RefToBase<T1>> would need dictionaries we will never have.
181  // In this way we only need the IndirectHolder<T> and the RefHolder of the real type of the item
182  // This might cause a small performance penalty.
183  static_assert( std::is_base_of<T, T1>::value, "RefToBase::RefToBase T not base of T1" );
184  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T>
RefToBase::RefToBase ( std::unique_ptr< reftobase::BaseHolder< value_type >>  p)
inline

Definition at line 188 of file RefToBase.h.

188  :
189  holder_(p.release())
190  {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T>
RefToBase::RefToBase ( std::shared_ptr< reftobase::RefHolderBase p)
inline

Definition at line 194 of file RefToBase.h.

194  :
195  holder_(new reftobase::IndirectHolder<T>(p))
196  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
RefToBase::~RefToBase ( )
inline

Definition at line 200 of file RefToBase.h.

References edm::RefToBase< T >::holder_, edm::RefToBase< T >::operator=(), edm::RefToBase< T >::swap(), and groupFilesInBlocks::temp.

201  {
202  delete holder_;
203  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122

Member Function Documentation

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

Definition at line 289 of file RefToBase.h.

References edm::RefToBase< T >::holder_, edm::errors::InvalidReference, edm::RefToBase< T >::isTransient(), edm::RefToBase< T >::key(), dataset::name, edm::RefToBase< T >::productGetter(), edm::Exception::throwThis(), and relativeConstraints::value.

Referenced by egPM::AbsEtaNrClus::AbsEtaNrClus(), egPM::AbsEtaNrClusEt::AbsEtaNrClusEt(), egPM::AbsEtaNrClusPhi::AbsEtaNrClusPhi(), ElectronMcSignalValidator::analyze(), ElectronSeedAnalyzer::analyze(), ElectronMcFakeValidator::analyze(), ZMuMuAnalyzer::analyze(), GsfElectronDataAnalyzer::analyze(), GsfElectronMCFakeAnalyzer::analyze(), GsfElectronFakeAnalyzer::analyze(), GsfElectronMCAnalyzer::analyze(), ZMuMuAnalyzer_cynematics::analyze(), ConversionProducer::buildCollection(), MuonTrajectoryCleaner::clean(), reco::JetSignalVertexCompatibilityAlgo::convert(), ZToMuMuFilter::filter(), HLTElectronPixelMatchFilter::getNrOfMatches(), reco::GsfElectronCore::GsfElectronCore(), reco::PFTauDecayMode::pfMasterClones(), pat::PATJetUpdater::produce(), MuMuForEmbeddingSelector::produce(), ElectronSeedProducer::produce(), HLTScoutingEgammaProducer::produce(), EgammaHLTGsfTrackVarProducer::produce(), NuclearTrackCorrector::produce(), EgammaHLTPixelMatchVarProducer::produce(), GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore(), GsfElectronAlgo::setCutBasedPreselectionFlag(), reco::CaloTauTagInfo::setJetRef(), and GsfElectronAlgo::setPixelMatchInfomation().

289  {
290 
291  if (!holder_) {
293  "attempting to cast a null RefToBase;\n"
294  "You should check for nullity before casting.");
295  }
296 
297  checkTypeCompatibility<T, typename REF::value_type>();
298 
299  // If REF is type edm::Ref<C,T,F>, then it is impossible to
300  // check the container type C here. We just have to assume
301  // that the caller provided the correct type.
302 
303  EDProductGetter const* getter = productGetter();
304  if(getter) {
305  return REF(id(), key(), getter);
306  }
307 
308  T const* value = get();
309  if(value == nullptr) {
310  return REF(id());
311  }
312  typename REF::value_type const* newValue = convertTo<T, typename REF::value_type>(value);
313  if(newValue) {
314  return REF(id(), newValue, key(), isTransient());
315  }
316 
318  "RefToBase<T>::castTo Error attempting to cast mismatched types\n"
319  "casting from RefToBase with T: ",
320  typeid(T).name(),
321  "\ncasting to: ",
322  typeid(REF).name()
323  );
324  return REF();
325  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
size_t key() const
Definition: RefToBase.h:250
Definition: value.py:1
EDProductGetter const * productGetter() const
Definition: RefToBase.h:382
bool isTransient() const
Definition: RefToBase.h:116
long double T
template<class T>
static short edm::RefToBase< T >::Class_Version ( )
inlinestatic

Definition at line 119 of file RefToBase.h.

120 :
121  value_type const* getPtrImpl() const;
value_type const * getPtrImpl() const
Definition: RefToBase.h:389
template<class T >
T const * RefToBase::get ( ) const
inline

Definition at line 234 of file RefToBase.h.

References edm::RefToBase< T >::getPtrImpl().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), DimuonStatistics::analyze(), GlbMuQualityCutsAnalysis::analyze(), PFCheckHitPattern::analyze(), TkConvValidator::analyze(), TestOutliers::analyze(), PhotonValidator::analyze(), IsolatedTracksNxN::analyze(), PFElecTkProducer::applySelection(), ConversionProducer::buildCollection(), rrapi.RRApi::columns(), util.rrapi.RRApi::columns(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), rrapi.RRApi::count(), util.rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), PFCandCommonVertexFitterBase::fill(), PFElecTkProducer::FindPfRef(), pat::GenericParticle::GenericParticle(), reco::GenJet::genParticle(), reco::Candidate::get(), reco::LeafCandidate::get(), MultiTrackSelector::getBestVertex(), L6SLBCorrector::getBTagInfoIndex(), L6SLBCorrectorImpl::getBTagInfoIndex(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getResultingSection(), PFElecTkProducer::isSameEgSC(), PFElecTkProducer::isSharingEcalEnergyWithEgSC(), reco::makeSpecific(), TemplatedSecondaryVertexProducer< IPTI, VTX >::matchSubjets(), pat::MET::MET(), reco::operator<<(), pat::TriggerObject::origObjCand(), PFCheckHitPattern::print(), DimuonMCMatcher::produce(), pat::PATJetProducer::produce(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), reco::CaloTauTagInfo::setJetRef(), util.rrapi.RRApi::tables(), rrapi.RRApi::tables(), util.rrapi.RRApi::tags(), rrapi.RRApi::tags(), util.rrapi.RRApi::templates(), rrapi.RRApi::templates(), reco::ConversionTrack::track(), pat::VertexAssociation::track(), rrapi.RRApi::workspaces(), and util.rrapi.RRApi::workspaces().

235  {
236  return getPtrImpl();
237  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:389
template<class T >
T const * RefToBase::getPtrImpl ( ) const
inlineprivate

Definition at line 389 of file RefToBase.h.

References edm::reftobase::BaseHolder< T >::getPtr(), and edm::RefToBase< T >::holder_.

Referenced by edm::RefToBase< T >::get(), edm::RefToBase< T >::operator*(), and edm::RefToBase< T >::operator->().

390  {
391  return holder_ ? holder_->getPtr() : nullptr;
392  }
virtual T const * getPtr() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
std::unique_ptr< reftobase::RefHolderBase > RefToBase::holder ( ) const

Definition at line 395 of file RefToBase.h.

References edm::reftobase::BaseHolder< T >::holder(), and edm::RefToBase< T >::holder_.

395  {
396  return holder_? holder_->holder() : std::unique_ptr<reftobase::RefHolderBase>();
397  }
virtual std::unique_ptr< RefHolderBase > holder() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
ProductID RefToBase::id ( ) const
inline
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 114 of file RefToBase.h.

Referenced by edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), MTVHistoProducerAlgoForTracker::getSeedingLayerSetBin(), and reco::operator<<().

114 { return holder_? holder_->isAvailable(): false; }
virtual bool isAvailable() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
bool RefToBase::isNonnull ( ) const
inline
template<class T >
bool RefToBase::isNull ( ) const
inline
template<class T>
bool edm::RefToBase< T >::isTransient ( ) const
inline

Definition at line 116 of file RefToBase.h.

Referenced by edm::RefToBase< T >::castTo().

116 { return holder_ ? holder_->isTransient() : false; }
virtual bool isTransient() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T >
size_t RefToBase::key ( ) const
inline

Definition at line 250 of file RefToBase.h.

References edm::RefToBase< T >::holder_, edm::errors::InvalidReference, edm::reftobase::BaseHolder< T >::key(), CfgNavigationSchool_cfi::OUT, lumiQTWidget::t, edm::Exception::throwThis(), and relativeConstraints::value.

Referenced by ElectronSeedGenerator::addSeed(), MuonTrackValidator::analyze(), MuonToTrackingParticleAssociatorByHitsImpl::associateMuons(), VertexAssociatorByTracks::associateSimToReco(), edm::RefToBase< T >::castTo(), PFDisplacedVertexFinder::commonTracks(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), equals(), edm::RefToBaseVector< T >::fillView(), pat::GenericParticle::GenericParticle(), PFDisplacedVertexCandidateFinder::link(), ConversionTools::matchesConversion(), TemplatedSecondaryVertexProducer< IPTI, VTX >::matchSubjets(), MuonToSimAssociatorBase::RefToBaseSort::operator()(), reco::JetSignalVertexCompatibilityAlgo::RefToBaseLess< T >::operator()(), reco::RefToBaseSort::operator()(), BTagPerformanceAnalyzerOnData::JetRefCompare::operator()(), BTagPerformanceAnalyzerMC::JetRefCompare::operator()(), HLTBTagPerformanceAnalyzer::JetRefCompare::operator()(), SoftLepton::TrackCompare::operator()(), TopMonitor::JetRefCompare::operator()(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::operator[](), DistortedPFCandProducer::produce(), PFDisplacedTrackerVertexProducer::produce(), Onia2MuMuPAT::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), IPProducerHelpers::FromJetAndCands::tracks(), pat::helper::TriggerMatchHelper::triggerMatchObject(), and JetTagProducer::~JetTagProducer().

251  {
252  if ( holder_ == nullptr )
253  {
255  "attempting get key from null RefToBase;\n"
256  "You should check for nullity before calling key().");
257  return 0;
258  }
259  return holder_->key();
260  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
virtual size_t key() const =0
template<class T >
bool RefToBase::operator! ( ) const
inline

Checks for null.

Definition at line 349 of file RefToBase.h.

References edm::RefToBase< T >::isNull().

350  {
351  return isNull();
352  }
bool isNull() const
Checks for null.
Definition: RefToBase.h:331
template<class T>
bool RefToBase::operator!= ( RefToBase< T > const &  rhs) const
inline

Definition at line 367 of file RefToBase.h.

368  {
369  return !(*this == rhs);
370  }
template<class T >
T const & RefToBase::operator* ( ) const
inline

Definition at line 218 of file RefToBase.h.

References edm::RefToBase< T >::getPtrImpl().

219  {
220  return *getPtrImpl();
221  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:389
template<class T >
T const * RefToBase::operator-> ( ) const
inline

Definition at line 226 of file RefToBase.h.

References edm::RefToBase< T >::getPtrImpl().

227  {
228  return getPtrImpl();
229  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:389
template<class T >
RefToBase< T > & RefToBase::operator= ( RefToBase< T > &&  other)
inline

Definition at line 151 of file RefToBase.h.

References edm::RefToBase< T >::holder_, and trackingPlots::other.

Referenced by edm::RefToBase< T >::~RefToBase().

151  {
152  delete holder_; holder_=other.holder_; other.holder_=nullptr; return *this;
153  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T>
RefToBase& edm::RefToBase< T >::operator= ( RefToBase< T > const &  rhs)
template<class T>
bool RefToBase::operator== ( RefToBase< T > const &  rhs) const
inline

Definition at line 357 of file RefToBase.h.

References edm::RefToBase< T >::holder_, and edm::reftobase::BaseHolder< T >::isEqualTo().

358  {
359  return holder_
360  ? holder_->isEqualTo(*rhs.holder_)
361  : holder_ == rhs.holder_;
362  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
virtual bool isEqualTo(BaseHolder< T > const &rhs) const =0
template<class T >
EDProductGetter const * RefToBase::productGetter ( ) const
inline

Definition at line 382 of file RefToBase.h.

References edm::RefToBase< T >::holder_, and edm::reftobase::BaseHolder< T >::productGetter().

Referenced by edm::RefToBase< T >::castTo().

382  {
383  return holder_? holder_->productGetter():nullptr;
384  }
virtual EDProductGetter const * productGetter() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
template<class T>
void RefToBase::swap ( RefToBase< T > &  other)
inline

Definition at line 375 of file RefToBase.h.

References edm::RefToBase< T >::holder_, and std::swap().

Referenced by edm::swap(), and edm::RefToBase< T >::~RefToBase().

376  {
377  std::swap(holder_, other.holder_);
378  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:122
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

Friends And Related Function Documentation

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

Definition at line 125 of file RefToBase.h.

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

Definition at line 124 of file RefToBase.h.

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

Definition at line 123 of file RefToBase.h.

Member Data Documentation

template<class T>
reftobase::BaseHolder<value_type>* edm::RefToBase< T >::holder_
private