CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr
< reftobase::RefHolderBase
holder () 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 const &rhs)
 
bool operator== (RefToBase const &rhs) const
 
EDProductGetter const * productGetter () const
 
 RefToBase ()
 
 RefToBase (RefToBase const &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 49 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 131 of file RefToBase.h.

131  :
132  holder_(nullptr)
133  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T >
RefToBase::RefToBase ( RefToBase< T > const &  other)
inline

Definition at line 137 of file RefToBase.h.

137  :
138  holder_(other.holder_ ? other.holder_->clone() : nullptr)
139  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T >
template<typename C1 , typename T1 , typename F1 >
RefToBase::RefToBase ( Ref< C1, T1, F1 > const &  r)
inlineexplicit

Definition at line 144 of file RefToBase.h.

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

Definition at line 151 of file RefToBase.h.

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

Definition at line 398 of file RefToBase.h.

398  :
399  holder_( r.operator->()->refAt( i ).holder_->clone() ) {
400  }
int i
Definition: DBlmapReader.cc:9
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<typename T>
RefToBase::RefToBase ( Handle< View< T > > const &  handle,
size_t  i 
)
inline

Definition at line 404 of file RefToBase.h.

404  :
405  holder_( handle.operator->()->refAt( i ).holder_->clone() ) {
406  }
int i
Definition: DBlmapReader.cc:9
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T >
template<typename T1 >
RefToBase::RefToBase ( RefToBase< T1 > const &  r)
inlineexplicit

Definition at line 158 of file RefToBase.h.

References relativeConstraints::value.

158  :
159  holder_(new reftobase::IndirectHolder<T> (
160  std::shared_ptr< edm::reftobase::RefHolderBase>(iRef.holder().release())
161  ) )
162  {
163  // OUT: holder_( new reftobase::Holder<T,RefToBase<T1> >(iRef ) ) {
164  // Forcing the conversion through IndirectHolder,
165  // as Holder<T,RefToBase<T1>> would need dictionaries we will never have.
166  // In this way we only need the IndirectHolder<T> and the RefHolder of the real type of the item
167  // This might cause a small performance penalty.
168  static_assert( std::is_base_of<T, T1>::value, "RefToBase::RefToBase T not base of T1" );
169  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T>
RefToBase::RefToBase ( std::unique_ptr< reftobase::BaseHolder< value_type >>  p)
inline

Definition at line 173 of file RefToBase.h.

173  :
174  holder_(p.release())
175  {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T>
RefToBase::RefToBase ( std::shared_ptr< reftobase::RefHolderBase p)
inline

Definition at line 179 of file RefToBase.h.

179  :
180  holder_(new reftobase::IndirectHolder<T>(p))
181  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T >
RefToBase::~RefToBase ( )
inline

Definition at line 185 of file RefToBase.h.

186  {
187  delete holder_;
188  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119

Member Function Documentation

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

Definition at line 271 of file RefToBase.h.

References edm::errors::InvalidReference, relval_steps::key, mergeVDriftHistosByStation::name, edm::refcoreimpl::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(), GsfElectronMCFakeAnalyzer::analyze(), GsfElectronDataAnalyzer::analyze(), GsfElectronFakeAnalyzer::analyze(), GsfElectronMCAnalyzer::analyze(), ZMuMuAnalyzer_cynematics::analyze(), ConversionProducer::buildCollection(), MuonTrajectoryCleaner::clean(), reco::JetSignalVertexCompatibilityAlgo::convert(), ZToMuMuFilter::filter(), HLTElectronPixelMatchFilter::getNrOfMatches(), reco::GsfElectronCore::GsfElectronCore(), HLTEgamma::MakeL1IsolatedElectrons(), HLTEgamma::MakeL1NonIsolatedElectrons(), reco::PFTauDecayMode::pfMasterClones(), L1TMuon::InternalTrack::print(), EgammaHLTPixelMatchVarProducer::produce(), pat::PATJetUpdater::produce(), ElectronSeedProducer::produce(), HLTScoutingEgammaProducer::produce(), EgammaHLTGsfTrackVarProducer::produce(), NuclearTrackCorrector::produce(), GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore(), GsfElectronAlgo::setCutBasedPreselectionFlag(), reco::CaloTauTagInfo::setJetRef(), and GsfElectronAlgo::setPixelMatchInfomation().

271  {
272 
273  if (!holder_) {
275  "attempting to cast a null RefToBase;\n"
276  "You should check for nullity before casting.");
277  }
278 
279  checkTypeCompatibility<T, typename REF::value_type>();
280 
281  // If REF is type edm::Ref<C,T,F>, then it is impossible to
282  // check the container type C here. We just have to assume
283  // that the caller provided the correct type.
284 
285  EDProductGetter const* getter = productGetter();
286  if(getter) {
287  return REF(id(), key(), getter);
288  }
289 
290  T const* value = get();
291  if(value == nullptr) {
292  return REF(id());
293  }
294  typename REF::value_type const* newValue = convertTo<T, typename REF::value_type>(value);
295  if(newValue) {
296  return REF(id(), newValue, key(), isTransient());
297  }
298 
300  "RefToBase<T>::castTo Error attempting to cast mismatched types\n"
301  "casting from RefToBase with T: ",
302  typeid(T).name(),
303  "\ncasting to: ",
304  typeid(REF).name()
305  );
306  return REF();
307  }
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:119
size_t key() const
Definition: RefToBase.h:235
EDProductGetter const * productGetter() const
Definition: RefToBase.h:364
bool isTransient() const
Definition: RefToBase.h:113
long double T
template<class T>
static short edm::RefToBase< T >::Class_Version ( )
inlinestatic

Definition at line 116 of file RefToBase.h.

117 :
118  value_type const* getPtrImpl() const;
value_type const * getPtrImpl() const
Definition: RefToBase.h:371
template<class T >
T const * RefToBase::get ( ) const
inline

Definition at line 219 of file RefToBase.h.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), DimuonStatistics::analyze(), GlbMuQualityCutsAnalysis::analyze(), PFCheckHitPattern::analyze(), TkConvValidator::analyze(), TestOutliers::analyze(), PhotonValidator::analyze(), IsolatedTracksNxN::analyze(), ConversionProducer::buildCollection(), util.rrapi.RRApi::columns(), 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(), reco::GenJet::genParticle(), reco::Candidate::get(), reco::LeafCandidate::get(), MultiTrackSelector::getBestVertex(), L6SLBCorrector::getBTagInfoIndex(), L6SLBCorrectorImpl::getBTagInfoIndex(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), SelectReplacementCandidates::getRawIDsAdvanced(), betterConfigParser.BetterConfigParser::getResultingSection(), PFElecTkProducer::isSameEgSC(), PFElecTkProducer::isSharingEcalEnergyWithEgSC(), reco::makeSpecific(), TemplatedSecondaryVertexProducer< IPTI, VTX >::matchSubjets(), pat::MET::MET(), 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(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), reco::ConversionTrack::track(), pat::VertexAssociation::track(), rrapi.RRApi::workspaces(), and util.rrapi.RRApi::workspaces().

220  {
221  return getPtrImpl();
222  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:371
template<class T >
T const * RefToBase::getPtrImpl ( ) const
inlineprivate

Definition at line 371 of file RefToBase.h.

372  {
373  return holder_ ? holder_->getPtr() : nullptr;
374  }
virtual T const * getPtr() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T >
std::auto_ptr< reftobase::RefHolderBase > RefToBase::holder ( ) const

Definition at line 377 of file RefToBase.h.

377  {
378  return holder_? holder_->holder() : std::auto_ptr<reftobase::RefHolderBase>();
379  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
virtual std::auto_ptr< RefHolderBase > holder() const =0
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 111 of file RefToBase.h.

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

111 { return holder_? holder_->isAvailable(): false; }
virtual bool isAvailable() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
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 113 of file RefToBase.h.

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

Definition at line 235 of file RefToBase.h.

References edm::errors::InvalidReference, and edm::Exception::throwThis().

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

236  {
237  if ( holder_ == nullptr )
239  "attempting get key from null RefToBase;\n"
240  "You should check for nullity before calling key().");
241  return holder_->key();
242  }
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:119
virtual size_t key() const =0
template<class T >
bool RefToBase::operator! ( ) const
inline

Checks for null.

Definition at line 331 of file RefToBase.h.

332  {
333  return isNull();
334  }
bool isNull() const
Checks for null.
Definition: RefToBase.h:313
template<class T>
bool RefToBase::operator!= ( RefToBase< T > const &  rhs) const
inline

Definition at line 349 of file RefToBase.h.

350  {
351  return !(*this == rhs);
352  }
template<class T >
T const & RefToBase::operator* ( ) const
inline

Definition at line 203 of file RefToBase.h.

204  {
205  return *getPtrImpl();
206  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:371
template<class T >
T const * RefToBase::operator-> ( ) const
inline

Definition at line 211 of file RefToBase.h.

212  {
213  return getPtrImpl();
214  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:371
template<class T>
RefToBase< T > & RefToBase::operator= ( RefToBase< T > const &  rhs)
inline

Definition at line 193 of file RefToBase.h.

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

194  {
195  RefToBase<T> temp( iRHS);
196  temp.swap(*this);
197  return *this;
198  }
template<class T>
bool RefToBase::operator== ( RefToBase< T > const &  rhs) const
inline

Definition at line 339 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

340  {
341  return holder_
342  ? holder_->isEqualTo(*rhs.holder_)
343  : holder_ == rhs.holder_;
344  }
virtual bool isEqualTo(BaseHolder< T > const &rhs) const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
template<class T >
EDProductGetter const * RefToBase::productGetter ( ) const
inline

Definition at line 364 of file RefToBase.h.

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

Definition at line 357 of file RefToBase.h.

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

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

358  {
359  std::swap(holder_, other.holder_);
360  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:119
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 122 of file RefToBase.h.

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

Definition at line 121 of file RefToBase.h.

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

Definition at line 120 of file RefToBase.h.

Member Data Documentation

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