CMS 3D CMS Logo

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

#include <EDProductfwd.h>

Public Types

typedef holder_type::const_iterator const_iterator
 
typedef reftobase::BaseVectorHolder< Tholder_type
 
typedef T member_type
 
typedef holder_type::size_type size_type
 
typedef RefToBase< Tvalue_type
 

Public Member Functions

value_type at (size_type idx) const
 
const_iterator begin () const
 
void clear ()
 
bool empty () const
 
const_iterator end () const
 
void fillView (std::vector< void const * > &pointers, FillViewHelperVector &helpers) const
 
ProductID id () const
 
bool isAvailable () const
 
bool isInvalid () const
 
bool isValid () const
 
RefToBaseVectoroperator= (RefToBaseVector const &iRHS)
 
value_type operator[] (size_type idx) const
 
EDProductGetter const * productGetter () const
 
void push_back (const RefToBase< T > &)
 
 RefToBaseVector ()
 
 RefToBaseVector (RefToBaseVector const &)
 
template<class REFV >
 RefToBaseVector (REFV const &)
 
template<typename C >
 RefToBaseVector (Handle< C > const &)
 
 RefToBaseVector (std::shared_ptr< reftobase::RefVectorHolderBase > p)
 
template<class REFV >
 RefToBaseVector (const REFV &iRef)
 
template<class T >
 RefToBaseVector (const RefToBaseVector< T > &iOther)
 
template<typename C >
 RefToBaseVector (const Handle< C > &h)
 
size_type size () const
 
void swap (RefToBaseVector &other)
 
std::unique_ptr< reftobase::RefVectorHolderBasevectorHolder () const
 
 ~RefToBaseVector ()
 

Static Public Member Functions

static short Class_Version ()
 

Private Attributes

holder_typeholder_
 

Detailed Description

template<class T>
class edm::RefToBaseVector< T >

RefToBase<T> provides a mechanism to refer to an object of type T (or which has T as a public base), held in a collection (of type not known to RefToBase<T>) which itself it in an Event.

Definition at line 24 of file EDProductfwd.h.

Member Typedef Documentation

Definition at line 33 of file RefToBaseVector.h.

Definition at line 31 of file RefToBaseVector.h.

template<class T>
typedef T edm::RefToBaseVector< T >::member_type

Definition at line 30 of file RefToBaseVector.h.

template<class T>
typedef holder_type::size_type edm::RefToBaseVector< T >::size_type

Definition at line 32 of file RefToBaseVector.h.

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

Definition at line 29 of file RefToBaseVector.h.

Constructor & Destructor Documentation

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

Definition at line 111 of file RefToBaseVector.h.

111  :
112  holder_(nullptr)
113  { }
holder_type * holder_
template<class T>
edm::RefToBaseVector< T >::RefToBaseVector ( RefToBaseVector< T > const &  )
template<class T>
template<class REFV >
edm::RefToBaseVector< T >::RefToBaseVector ( REFV const &  )
explicit
template<class T>
template<typename C >
edm::RefToBaseVector< T >::RefToBaseVector ( Handle< C > const &  )
explicit
template<class T >
RefToBaseVector::RefToBaseVector ( std::shared_ptr< reftobase::RefVectorHolderBase p)
inline

Definition at line 130 of file RefToBaseVector.h.

130  :
131  holder_(new reftobase::IndirectVectorHolder<T>(p)) {
132  }
holder_type * holder_
template<class T >
RefToBaseVector::~RefToBaseVector ( )
inline

Definition at line 152 of file RefToBaseVector.h.

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

153  {
154  delete holder_;
155  }
holder_type * holder_
template<class T>
template<class REFV >
edm::RefToBaseVector< T >::RefToBaseVector ( const REFV &  iRef)
inline

Definition at line 118 of file RefToBaseVector.h.

118  :
119  holder_(new reftobase::VectorHolder<T,REFV>(iRef))
120  { }
holder_type * holder_
template<class T>
template<class T >
edm::RefToBaseVector< T >::RefToBaseVector ( const RefToBaseVector< T > &  iOther)
inline

Definition at line 124 of file RefToBaseVector.h.

124  :
125  holder_(iOther.holder_ ? iOther.holder_->clone() : nullptr)
126  { }
holder_type * holder_
template<class T>
template<typename C >
edm::RefToBaseVector< T >::RefToBaseVector ( const Handle< C > &  h)

Definition at line 285 of file RefToBaseVector.h.

285  :
286  holder_(new reftobase::VectorHolder<T, RefVector<C, typename refhelper::ValueTrait<C>::value,
287  typename refhelper::FindTrait<C, T>::value> >(h.id())) {
288  }
holder_type * holder_
FindUsingAdvance< C, T > value
Definition: RefTraits.h:41
long double T
edm::RefVector< Container > RefVector

Member Function Documentation

template<class T >
RefToBaseVector< T >::value_type RefToBaseVector::at ( size_type  idx) const
inline

Definition at line 160 of file RefToBaseVector.h.

References edm::reftobase::BaseVectorHolder< T >::at(), edm::errors::InvalidReference, and edm::Exception::throwThis().

Referenced by edm::RefToBaseVector< T >::operator[]().

161  {
162  if ( holder_ == nullptr )
164  "Trying to dereference null RefToBaseVector<T> in method: at(",
165  idx,
166  ")\n");
167  return holder_->at( idx );
168  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
holder_type * holder_
virtual base_ref_type const at(size_type idx) const =0
template<class T >
RefToBaseVector< T >::const_iterator RefToBaseVector::begin ( void  ) const
inline
template<class T>
static short edm::RefToBaseVector< T >::Class_Version ( )
inlinestatic

Definition at line 72 of file RefToBaseVector.h.

74 :
reftobase::BaseVectorHolder< T > holder_type
holder_type * holder_
template<class T >
void RefToBaseVector::clear ( void  )
inline
template<class T >
bool RefToBaseVector::empty ( ) const
inline
template<class T >
RefToBaseVector< T >::const_iterator RefToBaseVector::end ( void  ) const
inline
template<typename T >
void RefToBaseVector::fillView ( std::vector< void const * > &  pointers,
FillViewHelperVector helpers 
) const

Definition at line 237 of file RefToBaseVector.h.

References edm::RefToBaseVector< T >::begin(), MillePedeFileConverter_cfg::e, edm::RefToBaseVector< T >::end(), mps_fire::i, edm::RefToBase< T >::id(), edm::RefToBase< T >::isNull(), edm::RefToBase< T >::key(), and edm::RefToBaseVector< T >::size().

Referenced by edm::fillView().

238  {
239  pointers.reserve(this->size());
240  helpers.reserve(this->size());
241  for (const_iterator i=begin(), e=end(); i!=e; ++i) {
242  RefToBase<T> ref = * i;
243  member_type const * address = ref.isNull() ? 0 : & * ref;
244  pointers.push_back(address);
245  helpers.push_back(FillViewHelperVector::value_type(ref.id(),ref.key()));
246  }
247  }
holder_type::const_iterator const_iterator
const_iterator end() const
size_type size() const
const_iterator begin() const
template<class T >
ProductID RefToBaseVector::id ( ) const
inline

Definition at line 206 of file RefToBaseVector.h.

References edm::reftobase::BaseVectorHolder< T >::id().

Referenced by TrackingNtuple::fillVertices(), and MatchJet::operator()().

207  {
208  return holder_ ? holder_->id() : ProductID();
209  }
holder_type * holder_
virtual ProductID id() const =0
template<class T>
bool edm::RefToBaseVector< T >::isAvailable ( ) const
inline

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

Definition at line 69 of file RefToBaseVector.h.

69 { return holder_->isAvailable(); }
holder_type * holder_
virtual bool isAvailable() const =0
template<class T>
bool edm::RefToBaseVector< T >::isInvalid ( ) const
inline

Definition at line 53 of file RefToBaseVector.h.

Referenced by edm::operator==().

53 { return holder_ == nullptr; }
holder_type * holder_
template<class T>
bool edm::RefToBaseVector< T >::isValid ( void  ) const
inline

Definition at line 52 of file RefToBaseVector.h.

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

52 { return holder_ != nullptr; }
holder_type * holder_
template<class T>
RefToBaseVector< T > & RefToBaseVector::operator= ( RefToBaseVector< T > const &  iRHS)
inline

Definition at line 137 of file RefToBaseVector.h.

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

137  {
138  RefToBaseVector temp(iRHS);
139  this->swap(temp);
140  return *this;
141  }
void swap(RefToBaseVector &other)
template<class T >
RefToBaseVector< T >::value_type RefToBaseVector::operator[] ( size_type  idx) const
inline

Definition at line 173 of file RefToBaseVector.h.

References edm::RefToBaseVector< T >::at().

174  {
175  return at( idx );
176  }
value_type at(size_type idx) const
template<class T >
EDProductGetter const * RefToBaseVector::productGetter ( ) const
inline

Definition at line 214 of file RefToBaseVector.h.

References edm::reftobase::BaseVectorHolder< T >::productGetter().

215  {
216  return holder_ ? holder_->productGetter() : nullptr;
217  }
holder_type * holder_
virtual EDProductGetter const * productGetter() const =0
template<typename T>
void RefToBaseVector::push_back ( const RefToBase< T > &  r)

Definition at line 264 of file RefToBaseVector.h.

References edm::RefToBase< T >::holder_, AlCaHLTBitMon_ParallelJobs::p, and edm::reftobase::BaseVectorHolder< T >::push_back().

Referenced by RecoMuonValidator::analyze(), MultiTrackValidator::analyze(), TkConvValidator::analyze(), PhotonValidator::analyze(), TrackingNtuple::analyze(), TrackGenAssociatorByChi2Impl::associateGenToReco(), MuonToSimAssociatorByHits::associateMuons(), MuonToTrackingParticleAssociatorByHitsImpl::associateMuons(), TrackGenAssociatorByChi2Impl::associateRecoToGen(), MuonAssociatorByHits::associateRecoToSim(), reco::TrackToTrackingParticleAssociatorBaseImpl::associateRecoToSim(), reco::TrackToTrackingParticleAssociatorBaseImpl::associateSimToReco(), MuonAssociatorByHits::associateSimToReco(), TrackingNtuple::fillSeeds(), BTagPerformanceAnalyzerMC::getJetWithFlavour(), MatchJet::matchCollections(), helper::SelectionRefViewAdder< T >::operator()(), TagProbeMassProducer::produce(), MuonMCClassifier::produce(), RecoTrackViewRefSelector::select(), and pat::helper::TriggerMatchHelper::triggerMatchCandidates().

264  {
265  if ( holder_ == nullptr ) {
266  std::unique_ptr<reftobase::BaseVectorHolder<T> > p = r.holder_->makeVectorHolder();
267  holder_ = p.release();
268  }
269  holder_->push_back( r.holder_ );
270  }
virtual void push_back(BaseHolder< T > const *)=0
holder_type * holder_
template<class T >
RefToBaseVector< T >::size_type RefToBaseVector::size ( void  ) const
inline
template<class T >
void RefToBaseVector::swap ( RefToBaseVector< T > &  other)
inline

Definition at line 146 of file RefToBaseVector.h.

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

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

146  {
147  std::swap(holder_, other.holder_);
148  }
holder_type * holder_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
template<typename T >
std::unique_ptr< reftobase::RefVectorHolderBase > RefToBaseVector::vectorHolder ( ) const

Definition at line 273 of file RefToBaseVector.h.

References edm::reftobase::BaseVectorHolder< T >::vectorHolder().

273  {
274  return holder_ ? holder_->vectorHolder() : std::unique_ptr<reftobase::RefVectorHolderBase>();
275  }
holder_type * holder_
virtual std::unique_ptr< RefVectorHolderBase > vectorHolder() const =0

Member Data Documentation

template<class T>
holder_type* edm::RefToBaseVector< T >::holder_
private