CMS 3D CMS Logo

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

#include <OwnVector.h>

Classes

class  const_iterator
 
class  iterator
 
struct  Ordering
 

Public Types

typedef std::vector< T * > base
 
typedef T const & const_reference
 
typedef Tpointer
 
typedef P policy_type
 
typedef Treference
 
typedef base::size_type size_type
 
typedef T value_type
 

Public Member Functions

reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 
base const & data () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
iterator erase (iterator pos)
 
iterator erase (iterator first, iterator last)
 
void fillPtrVector (std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const *> &ptrs) const
 
void fillView (ProductID const &id, std::vector< void const *> &pointers, FillViewHelperVector &helpers) const
 
reference front ()
 
const_reference front () const
 
template<typename D >
void insert (const_iterator i, D *&d)
 
template<typename D >
void insert (const_iterator i, D *const &d)
 
template<typename D >
void insert (const_iterator i, std::unique_ptr< D > d)
 
void insert (const_iterator i, T const &valueToCopy)
 
bool is_back_safe () const
 
OwnVector< T, P > & operator= (OwnVector< T, P > const &)
 
reference operator[] (size_type)
 
const_reference operator[] (size_type) const
 
 OwnVector ()
 
 OwnVector (size_type)
 
 OwnVector (OwnVector const &)
 
void pop_back ()
 
template<typename D >
void push_back (D *&d)
 
template<typename D >
void push_back (D *const &d)
 
template<typename D >
void push_back (std::unique_ptr< D > d)
 
void push_back (T const &valueToCopy)
 
void reserve (size_t)
 
void reverse ()
 
template<typename D >
void set (size_t i, D *&d)
 
template<typename D >
void set (size_t i, D *const &d)
 
template<typename D >
void set (size_t i, std::unique_ptr< D > d)
 
void set (size_t i, T const &valueToCopy)
 
void setPtr (std::type_info const &toType, unsigned long index, void const *&ptr) const
 
void shrink_to_fit ()
 
size_type size () const
 
template<typename S >
void sort (S s)
 
void sort ()
 
void swap (OwnVector< T, P > &other) noexcept
 
 ~OwnVector () noexcept
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

void destroy () noexcept
 

Static Private Member Functions

template<typename O >
static Ordering< O > ordering (O const &comp)
 

Private Attributes

base data_
 

Detailed Description

template<typename T, typename P = ClonePolicy<T>>
class edm::OwnVector< T, P >

Definition at line 24 of file OwnVector.h.

Member Typedef Documentation

◆ base

template<typename T, typename P = ClonePolicy<T>>
typedef std::vector<T*> edm::OwnVector< T, P >::base

Definition at line 29 of file OwnVector.h.

◆ const_reference

template<typename T, typename P = ClonePolicy<T>>
typedef T const& edm::OwnVector< T, P >::const_reference

Definition at line 37 of file OwnVector.h.

◆ pointer

template<typename T, typename P = ClonePolicy<T>>
typedef T* edm::OwnVector< T, P >::pointer

Definition at line 35 of file OwnVector.h.

◆ policy_type

template<typename T, typename P = ClonePolicy<T>>
typedef P edm::OwnVector< T, P >::policy_type

Definition at line 38 of file OwnVector.h.

◆ reference

template<typename T, typename P = ClonePolicy<T>>
typedef T& edm::OwnVector< T, P >::reference

Definition at line 36 of file OwnVector.h.

◆ size_type

template<typename T, typename P = ClonePolicy<T>>
typedef base::size_type edm::OwnVector< T, P >::size_type

Definition at line 33 of file OwnVector.h.

◆ value_type

template<typename T, typename P = ClonePolicy<T>>
typedef T edm::OwnVector< T, P >::value_type

Definition at line 34 of file OwnVector.h.

Constructor & Destructor Documentation

◆ OwnVector() [1/3]

template<typename T , typename P >
edm::OwnVector< T, P >::OwnVector ( )
inline

Definition at line 240 of file OwnVector.h.

240 : data_() {}

◆ OwnVector() [2/3]

template<typename T , typename P >
edm::OwnVector< T, P >::OwnVector ( size_type  n)
inline

Definition at line 243 of file OwnVector.h.

◆ OwnVector() [3/3]

template<typename T, typename P = ClonePolicy<T>>
edm::OwnVector< T, P >::OwnVector ( OwnVector< T, P > const &  )

◆ ~OwnVector()

template<typename T , typename P >
edm::OwnVector< T, P >::~OwnVector ( )
inlinenoexcept

Definition at line 260 of file OwnVector.h.

260  {
261  destroy();
262  }
void destroy() noexcept
Definition: OwnVector.h:469

Member Function Documentation

◆ back() [1/2]

template<typename T , typename P >
OwnVector< T, P >::reference edm::OwnVector< T, P >::back ( )
inline

Definition at line 431 of file OwnVector.h.

Referenced by SeedFromProtoTrack::init(), edm::OwnVector< TrackingRegion >::is_back_safe(), edm::OwnVector< TrackingRegion >::pop_back(), SeedCombiner::produce(), and TrackListMerger::produce().

431  {
432  T* result = data_.back();
433  if (result == nullptr) {
435  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
436  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
437  "pointer at the end of the collection is not null before calling back()\n"
438  "if you wish to avoid this exception.\n"
439  "Consider using OwnVector::is_back_safe()\n");
440  }
441  return *data_.back();
442  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:84
long double T

◆ back() [2/2]

template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::back ( ) const
inline

Definition at line 445 of file OwnVector.h.

445  {
446  T* result = data_.back();
447  if (result == 0) {
449  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
450  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
451  "pointer at the end of the collection is not null before calling back()\n"
452  "if you wish to avoid this exception.\n"
453  "Consider using OwnVector::is_back_safe()\n");
454  }
455  return *data_.back();
456  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:84
long double T

◆ begin() [1/2]

template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::begin ( void  )
inline

◆ begin() [2/2]

template<typename T , typename P >
OwnVector< T, P >::const_iterator edm::OwnVector< T, P >::begin ( void  ) const
inline

Definition at line 290 of file OwnVector.h.

290  {
291  return const_iterator(data_.begin());
292  }

◆ Class_Version()

template<typename T, typename P = ClonePolicy<T>>
static short edm::OwnVector< T, P >::Class_Version ( )
inlinestatic

Definition at line 220 of file OwnVector.h.

222 :
223  void destroy() noexcept;
void destroy() noexcept
Definition: OwnVector.h:469

◆ clear()

template<typename T , typename P >
void edm::OwnVector< T, P >::clear ( void  )
inline

◆ data()

template<typename T , typename P >
OwnVector< T, P >::base const & edm::OwnVector< T, P >::data ( ) const
inline

◆ destroy()

template<typename T , typename P >
void edm::OwnVector< T, P >::destroy ( )
inlineprivatenoexcept

Definition at line 469 of file OwnVector.h.

469  {
470  typename base::const_iterator b = data_.begin(), e = data_.end();
471  for (typename base::const_iterator i = b; i != e; ++i)
472  delete *i;
473  }
double b
Definition: hdecay.h:118

◆ empty()

template<typename T , typename P >
bool edm::OwnVector< T, P >::empty ( ) const
inline

◆ end() [1/2]

template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::end ( void  )
inline

◆ end() [2/2]

template<typename T , typename P >
OwnVector< T, P >::const_iterator edm::OwnVector< T, P >::end ( void  ) const
inline

Definition at line 295 of file OwnVector.h.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

295  {
296  return const_iterator(data_.end());
297  }

◆ erase() [1/2]

template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  pos)

Definition at line 487 of file OwnVector.h.

487  {
488  delete *pos.i;
489  return iterator(data_.erase(pos.i));
490  }

◆ erase() [2/2]

template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  first,
iterator  last 
)

Definition at line 493 of file OwnVector.h.

493  {
494  typename base::iterator b = first.i, e = last.i;
495  for (typename base::iterator i = b; i != e; ++i)
496  delete *i;
497  return iterator(data_.erase(b, e));
498  }
double b
Definition: hdecay.h:118
T first(std::pair< T, U > const &p)

◆ fillPtrVector()

template<typename T , typename P >
void edm::OwnVector< T, P >::fillPtrVector ( std::type_info const &  toType,
std::vector< unsigned long > const &  indices,
std::vector< void const *> &  ptrs 
) const
inline

Definition at line 574 of file OwnVector.h.

576  {
577  detail::reallyfillPtrVector(*this, toType, indices, ptrs);
578  }
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const *> &oPtr)
Definition: fillPtrVector.h:37

◆ fillView()

template<typename T, typename P = ClonePolicy<T>>
void edm::OwnVector< T, P >::fillView ( ProductID const &  id,
std::vector< void const *> &  pointers,
FillViewHelperVector helpers 
) const

◆ front() [1/2]

template<typename T , typename P >
OwnVector< T, P >::reference edm::OwnVector< T, P >::front ( )
inline

◆ front() [2/2]

template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::front ( ) const
inline

Definition at line 464 of file OwnVector.h.

464  {
465  return *data_.front();
466  }

◆ insert() [1/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::insert ( const_iterator  i,
D *&  d 
)
inline

Definition at line 395 of file OwnVector.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), and BeautifulSoup.PageElement::append().

395  {
396  data_.insert(it.base_iter(), d);
397  d = nullptr;
398  }
d
Definition: ztail.py:151

◆ insert() [2/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::insert ( const_iterator  i,
D *const &  d 
)
inline

Definition at line 402 of file OwnVector.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), and BeautifulSoup.PageElement::append().

402  {
403  data_.insert(it.base_iter(), d);
404  }
d
Definition: ztail.py:151

◆ insert() [3/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::insert ( const_iterator  i,
std::unique_ptr< D >  d 
)
inline

Definition at line 408 of file OwnVector.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), and BeautifulSoup.PageElement::append().

408  {
409  data_.insert(it.base_iter(), d.release());
410  }
d
Definition: ztail.py:151

◆ insert() [4/4]

template<typename T, typename P >
void edm::OwnVector< T, P >::insert ( const_iterator  i,
T const &  valueToCopy 
)
inline

Definition at line 413 of file OwnVector.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), and BeautifulSoup.PageElement::append().

413  {
414  data_.insert(it.base_iter(), policy_type::clone(d));
415  }
d
Definition: ztail.py:151
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135

◆ is_back_safe()

template<typename T , typename P >
bool edm::OwnVector< T, P >::is_back_safe ( ) const
inline

Definition at line 426 of file OwnVector.h.

426  {
427  return data_.back() != 0;
428  }

◆ operator=()

template<typename T, typename P>
OwnVector< T, P > & edm::OwnVector< T, P >::operator= ( OwnVector< T, P > const &  o)
inline

Definition at line 265 of file OwnVector.h.

265  {
266  OwnVector<T, P> temp(o);
267  swap(temp);
268  return *this;
269  }
void swap(OwnVector< T, P > &other) noexcept
Definition: OwnVector.h:512

◆ operator[]() [1/2]

template<typename T , typename P >
OwnVector< T, P >::reference edm::OwnVector< T, P >::operator[] ( size_type  n)
inline

Definition at line 310 of file OwnVector.h.

310  {
311  return *data_[n];
312  }

◆ operator[]() [2/2]

template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::operator[] ( size_type  n) const
inline

Definition at line 315 of file OwnVector.h.

315  {
316  return *data_[n];
317  }

◆ ordering()

template<typename T, typename P = ClonePolicy<T>>
template<typename O >
static Ordering<O> edm::OwnVector< T, P >::ordering ( O const &  comp)
inlinestaticprivate

Definition at line 233 of file OwnVector.h.

233  {
234  return Ordering<O>(comp);
235  }

◆ pop_back()

template<typename T , typename P >
void edm::OwnVector< T, P >::pop_back ( )
inline

Definition at line 418 of file OwnVector.h.

418  {
419  // We have to delete the pointed-to thing, before we squeeze it
420  // out of the vector...
421  delete data_.back();
422  data_.pop_back();
423  }

◆ push_back() [1/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *&  d)
inline

Definition at line 326 of file OwnVector.h.

Referenced by reco::CompositeCandidate::addDaughter(), MuonToTrackingParticleAssociatorByHitsImpl::associateMuons(), MuonErrorMatrixAdjuster::attachRecHits(), SeedFromConsecutiveHitsCreator::buildSeed(), SeedFromGenericPairOrTriplet::buildSeed(), SeedForPhotonConversion1Leg::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeedBool(), RPCSeedPattern::createFakeSeed(), MuonSeedFromRecHits::createSeed(), MuonSeedCreator::createSeed(), OutInConversionSeedFinder::createSeed(), RPCSeedPattern::createSeed(), InOutConversionSeedFinder::createSeed(), CosmicMuonSeedGenerator::createSeed(), PFRecoTauDiscriminationByIsolation::discriminate(), PFRecoTauDiscriminationByIsolationContainer::discriminate(), OutsideInMuonSeeder::doLayer(), SeedFromNuclearInteraction::hits(), CosmicLayerPairs::init(), CalibrationTrackSelectorFromDetIdList::makeCandidate(), reco::modules::CosmicTrackSplitter::makeCandidate(), reco::modules::TrackerTrackHitFilter::makeCandidate(), CosmicSeedCreator::makeSeed(), SETSeedFinder::makeSeed(), TSGForOIDNN::makeSeedsFromHitDoublets(), TSGForOI::makeSeedsFromHits(), TSGForOIDNN::makeSeedsFromHits(), TSGForOIFromL2::makeSeedsFromHits(), SiStripRecHitMatcher::match(), TrackMerger::merge(), SeedCombiner::produce(), MuonReducedTrackExtraProducer::produce(), MuonReSeeder::produce(), TrackListMerger::produce(), SETMuonSeedProducer::produce(), TrackCandidateProducer::produce(), TrajectorySeedFromMuonProducer::produce(), L2MuonSeedGeneratorFromL1T::produce(), ConvBremSeedProducer::produce(), L2MuonSeedGenerator::produce(), L2MuonSeedGeneratorFromL1TkMu::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), TrajectorySeedProducer::produce(), TSGForRoadSearch::pushTrajectorySeed(), SeedingOTEDProducer::run(), SeedFromProtoTrack::SeedFromProtoTrack(), SiTrackerMultiRecHit::SiTrackerMultiRecHit(), TrackMerger::sortByHitPosition(), FastTrackerRecHitSplitter::split(), TracktoRPC::thePoints(), TSGFromPropagation::trackerSeeds(), and FastTSGFromPropagation::trackerSeeds().

326  {
327  // C++ does not yet support rvalue references, so d should only be
328  // able to bind to an lvalue.
329  // This should be called only for lvalues.
330  data_.push_back(d);
331  d = nullptr;
332  }
d
Definition: ztail.py:151

◆ push_back() [2/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *const &  d)
inline

Definition at line 336 of file OwnVector.h.

336  {
337  // C++ allows d to be bound to an lvalue or rvalue. But the other
338  // signature should be a better match for an lvalue (because it
339  // does not require an lvalue->rvalue conversion). Thus this
340  // signature should only be chosen for rvalues.
341  data_.push_back(d);
342  }
d
Definition: ztail.py:151

◆ push_back() [3/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( std::unique_ptr< D >  d)
inline

Definition at line 346 of file OwnVector.h.

346  {
347  data_.push_back(d.release());
348  }
d
Definition: ztail.py:151

◆ push_back() [4/4]

template<typename T, typename P >
void edm::OwnVector< T, P >::push_back ( T const &  valueToCopy)
inline

Definition at line 351 of file OwnVector.h.

351  {
352  data_.push_back(policy_type::clone(d));
353  }
d
Definition: ztail.py:151
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135

◆ reserve()

template<typename T , typename P >
void edm::OwnVector< T, P >::reserve ( size_t  n)
inline

◆ reverse()

template<typename T, typename P = ClonePolicy<T>>
void edm::OwnVector< T, P >::reverse ( )
inline

Definition at line 204 of file OwnVector.h.

◆ set() [1/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::set ( size_t  i,
D *&  d 
)
inline

Definition at line 357 of file OwnVector.h.

357  {
358  // see push_back for documentation
359  if (d == data_[i])
360  return;
361  delete data_[i];
362  data_[i] = d;
363  d = nullptr;
364  }
d
Definition: ztail.py:151

◆ set() [2/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::set ( size_t  i,
D *const &  d 
)
inline

Definition at line 368 of file OwnVector.h.

368  {
369  // see push_back for documentation
370  if (d == data_[i])
371  return;
372  delete data_[i];
373  data_[i] = d;
374  }
d
Definition: ztail.py:151

◆ set() [3/4]

template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::set ( size_t  i,
std::unique_ptr< D >  d 
)
inline

Definition at line 378 of file OwnVector.h.

378  {
379  if (d.get() == data_[i])
380  return;
381  delete data_[i];
382  data_[i] = d.release();
383  }
d
Definition: ztail.py:151

◆ set() [4/4]

template<typename T, typename P >
void edm::OwnVector< T, P >::set ( size_t  i,
T const &  valueToCopy 
)
inline

Definition at line 386 of file OwnVector.h.

386  {
387  if (&d == data_[i])
388  return;
389  delete data_[i];
391  }
d
Definition: ztail.py:151
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135

◆ setPtr()

template<typename T , typename P >
void edm::OwnVector< T, P >::setPtr ( std::type_info const &  toType,
unsigned long  index,
void const *&  ptr 
) const
inline

Definition at line 564 of file OwnVector.h.

564  {
565  detail::reallySetPtr<OwnVector<T, P> >(*this, toType, index, ptr);
566  }

◆ shrink_to_fit()

template<typename T, typename P = ClonePolicy<T>>
void edm::OwnVector< T, P >::shrink_to_fit ( )
inline

Definition at line 167 of file OwnVector.h.

167 { data_.shrink_to_fit(); }

◆ size()

template<typename T , typename P >
OwnVector< T, P >::size_type edm::OwnVector< T, P >::size ( void  ) const
inline

◆ sort() [1/2]

template<typename T , typename P >
template<typename S >
void edm::OwnVector< T, P >::sort ( S  s)

Definition at line 502 of file OwnVector.h.

502  {
503  std::sort(data_.begin(), data_.end(), ordering(comp));
504  }
static Ordering< O > ordering(O const &comp)
Definition: OwnVector.h:233

◆ sort() [2/2]

template<typename T , typename P >
void edm::OwnVector< T, P >::sort ( )

Definition at line 507 of file OwnVector.h.

507  {
508  std::sort(data_.begin(), data_.end(), ordering(std::less<value_type>()));
509  }
static Ordering< O > ordering(O const &comp)
Definition: OwnVector.h:233

◆ swap()

template<typename T, typename P>
void edm::OwnVector< T, P >::swap ( OwnVector< T, P > &  other)
inlinenoexcept

Definition at line 512 of file OwnVector.h.

Referenced by TrajectorySeed::swap(), and TrackCandidate::TrackCandidate().

512  {
513  data_.swap(other.data_);
514  }

Member Data Documentation

◆ data_

template<typename T, typename P = ClonePolicy<T>>
base edm::OwnVector< T, P >::data_
private