CMS 3D CMS Logo

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

#include <AssociativeIterator.h>

Public Types

typedef T value_type
 

Public Member Functions

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 (RefToBase const &other)
 
 RefToBase (RefToBase &&other) noexcept
 
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)
 
template<class T>
 RefToBase (std::unique_ptr< reftobase::BaseHolder< value_type >> p)
 
void swap (RefToBase &other)
 
 ~RefToBase () noexcept
 

Static Public Member Functions

static short Class_Version ()
 

Public Attributes

template<class REF >
requires requires
 

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/11]

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

Definition at line 146 of file RefToBase.h.

146 : holder_(nullptr) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ RefToBase() [2/11]

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

Definition at line 149 of file RefToBase.h.

149 : holder_(other.holder_ ? other.holder_->clone() : nullptr) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ RefToBase() [3/11]

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

Definition at line 152 of file RefToBase.h.

152  : holder_(other.holder_) {
153  other.holder_ = nullptr;
154  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ RefToBase() [4/11]

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

Definition at line 166 of file RefToBase.h.

167  : holder_(new reftobase::Holder<T, Ref<C1, T1, F1>>(iRef)) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134
long double T

◆ RefToBase() [5/11]

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

Definition at line 171 of file RefToBase.h.

171 : holder_(new reftobase::Holder<T, RefProd<C>>(iRef)) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134
long double T

◆ RefToBase() [6/11]

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

Definition at line 343 of file RefToBase.h.

344  : holder_(r.operator->()->refAt(i).holder_->clone()) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ RefToBase() [7/11]

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

Definition at line 347 of file RefToBase.h.

348  : holder_(handle.operator->()->refAt(i).holder_->clone()) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ RefToBase() [8/11]

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

Definition at line 175 of file RefToBase.h.

176  : holder_(
177  new reftobase::IndirectHolder<T>(std::shared_ptr<edm::reftobase::RefHolderBase>(iRef.holder().release()))) {
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:134

◆ RefToBase() [9/11]

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

◆ RefToBase() [10/11]

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

Definition at line 190 of file RefToBase.h.

191  : holder_(new reftobase::IndirectHolder<T>(p)) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ ~RefToBase()

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

Definition at line 194 of file RefToBase.h.

194  {
195  delete holder_;
196  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ RefToBase() [11/11]

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

Definition at line 187 of file RefToBase.h.

187 : holder_(p.release()) {}
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

Member Function Documentation

◆ castTo()

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

Definition at line 243 of file RefToBase.h.

Referenced by ElectronMcSignalValidator::analyze(), ConversionProducer::buildCollection(), MuonTrajectoryCleaner::clean(), HLTElectronPixelMatchFilter::getNrOfMatches(), pat::PATJetUpdater::produce(), ConversionTrackProducer::produce(), MuMuForEmbeddingSelector::produce(), NuclearTrackCorrector::produce(), EgammaHLTPixelMatchVarProducer::produce(), EgammaHLTExtraProducer::setSeeds(), reco::PFTau::sourceCandidatePtr(), edmtest::ViewAnalyzer::testProductWithBaseClass(), and edmtest::ViewAnalyzer::testRefVector().

243  {
244  if (!holder_) {
246  "attempting to cast a null RefToBase;\n"
247  "You should check for nullity before casting.");
248  }
249 
250  // If REF is type edm::Ref<C,T,F>, then it is impossible to
251  // check the container type C here. We just have to assume
252  // that the caller provided the correct type.
253 
254  EDProductGetter const* getter = productGetter();
255  if (getter) {
256  return REF(id(), key(), getter);
257  }
258 
259  T const* value = get();
260  if (value == nullptr) {
261  return REF(id());
262  }
263  typename REF::value_type const* newValue;
264  if constexpr (std::is_same_v<T, typename REF::value_type> or std::is_base_of_v<typename REF::value_type, T>) {
265  newValue = value;
266  } else {
267  newValue = dynamic_cast<typename REF::value_type const*>(value);
268  }
269  if (newValue) {
270  return REF(id(), newValue, key(), isTransient());
271  }
272 
274  "RefToBase<T>::castTo Error attempting to cast mismatched types\n"
275  "casting from RefToBase with T: ",
276  typeid(T).name(),
277  "\ncasting to: ",
278  typeid(REF).name());
279  return REF();
280  }
bool isTransient() const
Definition: RefToBase.h:128
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:86
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
EDProductGetter const * productGetter() const
Definition: RefToBase.h:316
Definition: value.py:1
size_t key() const
Definition: RefToBase.h:226
long double T

◆ Class_Version()

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

Definition at line 131 of file RefToBase.h.

132 :
133  value_type const* getPtrImpl() const;
value_type const * getPtrImpl() const
Definition: RefToBase.h:321

◆ get()

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

Definition at line 216 of file RefToBase.h.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), TkConvValidator::analyze(), TestOutliers::analyze(), PhotonValidator::analyze(), IsolatedTracksNxN::analyze(), PFElecTkProducer::applySelection(), ConversionProducer::buildCollection(), FWPFTauProxyBuilder::buildViewType(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), PFMEtSignInterfaceBase::compResolution(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), PFElecTkProducer::findPfRef(), reco::GenJet::genParticle(), reco::Candidate::get(), reco::LeafCandidate::get(), 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(), ConversionTrackProducer::produce(), pat::PATJetProducer::produce(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), reco::ConversionTrack::track(), pat::VertexAssociation::track(), rrapi.RRApi::workspaces(), and util.rrapi.RRApi::workspaces().

216  {
217  return getPtrImpl();
218  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:321

◆ getPtrImpl()

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

Definition at line 321 of file RefToBase.h.

321  {
322  return holder_ ? holder_->getPtr() : nullptr;
323  }
virtual T const * getPtr() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ holder()

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

Definition at line 326 of file RefToBase.h.

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

326  {
327  return holder_ ? holder_->holder() : std::unique_ptr<reftobase::RefHolderBase>();
328  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134
virtual std::unique_ptr< RefHolderBase > holder() const =0

◆ 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. This function is potentially costly as it might cause a disk read (note that it does not cause the data to be cached locally)

Definition at line 126 of file RefToBase.h.

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

126 { return holder_ ? holder_->isAvailable() : false; }
virtual bool isAvailable() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ 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 128 of file RefToBase.h.

128 { return holder_ ? holder_->isTransient() : false; }
virtual bool isTransient() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ key()

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

Definition at line 226 of file RefToBase.h.

Referenced by MuonTrackValidator::analyze(), MuonToTrackingParticleAssociatorByHitsImpl::associateMuons(), VertexAssociatorByTracks::associateSimToReco(), PFDisplacedVertexFinder::commonTracks(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), equals(), edm::RefToBaseVector< reco::Track >::fillView(), BTagPerformanceAnalyzerOnData::jetRefCompare(), PFDisplacedVertexCandidateFinder::link(), LowPtConversion::match(), ConversionTools::matchesConversion(), TemplatedSecondaryVertexProducer< IPTI, VTX >::matchSubjets(), TagAndProbeBtagTriggerMonitor::JetRefCompare::operator()(), BTagPerformanceAnalyzerMC::JetRefCompare::operator()(), TopMonitor::JetRefCompare::operator()(), HLTBTagPerformanceAnalyzer::JetRefCompare::operator()(), BTagAndProbe::JetRefCompare::operator()(), PFDisplacedTrackerVertexProducer::produce(), Onia2MuMuPAT::produce(), and pat::helper::TriggerMatchHelper::triggerMatchObject().

226  {
227  if (holder_ == nullptr) {
229  "attempting get key from null RefToBase;\n"
230  "You should check for nullity before calling key().");
231  return 0;
232  }
233  return holder_->key();
234  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:86
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134
virtual size_t key() const =0

◆ operator!()

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

Checks for null.

Definition at line 296 of file RefToBase.h.

296  {
297  return isNull();
298  }
bool isNull() const
Checks for null.
Definition: RefToBase.h:284

◆ operator!=()

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

Definition at line 306 of file RefToBase.h.

306  {
307  return !(*this == rhs);
308  }

◆ operator*()

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

Definition at line 206 of file RefToBase.h.

206  {
207  return *getPtrImpl();
208  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:321

◆ operator->()

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

Definition at line 211 of file RefToBase.h.

211  {
212  return getPtrImpl();
213  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:321

◆ operator=() [1/2]

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

Definition at line 157 of file RefToBase.h.

157  {
158  delete holder_;
159  holder_ = other.holder_;
160  other.holder_ = nullptr;
161  return *this;
162  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ 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 301 of file RefToBase.h.

301  {
302  return holder_ ? holder_->isEqualTo(*rhs.holder_) : holder_ == rhs.holder_;
303  }
virtual bool isEqualTo(BaseHolder< T > const &rhs) const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

◆ productGetter()

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

Definition at line 316 of file RefToBase.h.

316  {
317  return holder_ ? holder_->productGetter() : nullptr;
318  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134
virtual EDProductGetter const * productGetter() const =0

◆ swap()

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

Definition at line 311 of file RefToBase.h.

311  {
312  std::swap(holder_, other.holder_);
313  }
void swap(RefToBase< T > &a, RefToBase< T > &b)
Definition: RefToBase.h:332
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:134

Friends And Related Function Documentation

◆ RefToBase

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

Definition at line 138 of file RefToBase.h.

◆ RefToBaseProd< T >

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

Definition at line 136 of file RefToBase.h.

◆ RefToBaseVector< T >

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

Definition at line 135 of file RefToBase.h.

Member Data Documentation

◆ holder_

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

◆ requires

template<class T>
template<class REF >
requires edm::RefToBase< T >::requires
Initial value:
{
typename REF::value_type

Definition at line 102 of file RefToBase.h.