CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Types | 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 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, helper_vector &helpers) const
 
reference front ()
 
const_reference front () const
 
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::auto_ptr< D > d)
 
void push_back (T const &valueToCopy)
 
void reserve (size_t)
 
void reverse ()
 
void setPtr (std::type_info const &toType, unsigned long index, void const *&ptr) const
 
size_type size () const
 
template<typename S >
void sort (S s)
 
void sort ()
 
void swap (OwnVector< T, P > &other) noexcept
 
 ~OwnVector () noexcept
 

Private Types

typedef std::vector< T * > base
 

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 25 of file OwnVector.h.

Member Typedef Documentation

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

Definition at line 30 of file OwnVector.h.

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

Definition at line 38 of file OwnVector.h.

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

Definition at line 36 of file OwnVector.h.

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

Definition at line 39 of file OwnVector.h.

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

Definition at line 37 of file OwnVector.h.

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

Definition at line 34 of file OwnVector.h.

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

Definition at line 35 of file OwnVector.h.

Constructor & Destructor Documentation

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

Definition at line 185 of file OwnVector.h.

185  : data_() {
186  }
template<typename T , typename P >
edm::OwnVector< T, P >::OwnVector ( size_type  n)
inline

Definition at line 189 of file OwnVector.h.

189  : data_(n) {
190  }
template<typename T, typename P = ClonePolicy<T>>
edm::OwnVector< T, P >::OwnVector ( OwnVector< T, P > const &  )
template<typename T , typename P >
edm::OwnVector< T, P >::~OwnVector ( )
inlinenoexcept

Definition at line 207 of file OwnVector.h.

References pyrootRender::destroy().

207  {
208  destroy();
209  }
void destroy() noexcept
Definition: OwnVector.h:359

Member Function Documentation

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

Definition at line 321 of file OwnVector.h.

References edm::errors::NullPointerError, query::result, and edm::Exception::throwThis().

Referenced by SeedFromProtoTrack::init(), SeedCombiner::produce(), cms::TrackListMerger::produce(), cms::SimpleTrackListMerger::produce(), reco::modules::DuplicateListMerger::produce(), DTCombinatorialPatternReco::reconstruct(), DTCombinatorialExtendedPatternReco::reconstruct(), and KalmanAlignmentTrackRefitter::sortRecHits().

321  {
322  T* result = data_.back();
323  if (result == 0) {
325  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
326  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
327  "pointer at the end of the collection is not null before calling back()\n"
328  "if you wish to avoid this exception.\n"
329  "Consider using OwnVector::is_back_safe()\n");
330  }
331  return *data_.back();
332  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
tuple result
Definition: query.py:137
long double T
template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::back ( ) const
inline

Definition at line 335 of file OwnVector.h.

References edm::errors::NullPointerError, query::result, and edm::Exception::throwThis().

335  {
336  T* result = data_.back();
337  if (result == 0) {
339  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
340  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
341  "pointer at the end of the collection is not null before calling back()\n"
342  "if you wish to avoid this exception.\n"
343  "Consider using OwnVector::is_back_safe()\n");
344  }
345  return *data_.back();
346  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
tuple result
Definition: query.py:137
long double T
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::begin ( void  )
inline
template<typename T , typename P >
OwnVector< T, P >::const_iterator edm::OwnVector< T, P >::begin ( void  ) const
inline

Definition at line 238 of file OwnVector.h.

238  {
239  return const_iterator(data_.begin());
240  }
template<typename T , typename P >
void edm::OwnVector< T, P >::clear ( void  )
inline
template<typename T , typename P >
OwnVector< T, P >::base const & edm::OwnVector< T, P >::data ( ) const
inline

Definition at line 366 of file OwnVector.h.

Referenced by cuy.FindIssue::__init__(), and SiTrackerMultiRecHit::recHits().

366  {
367  return data_;
368  }
template<typename T , typename P >
void edm::OwnVector< T, P >::destroy ( )
inlineprivatenoexcept

Definition at line 359 of file OwnVector.h.

References b, alignCSCRings::e, and i.

359  {
360  typename base::const_iterator b = data_.begin(), e = data_.end();
361  for(typename base::const_iterator i = b; i != e; ++ i)
362  delete * i;
363  }
int i
Definition: DBlmapReader.cc:9
double b
Definition: hdecay.h:120
template<typename T , typename P >
bool edm::OwnVector< T, P >::empty ( ) const
inline
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::end ( void  )
inline
template<typename T , typename P >
OwnVector< T, P >::const_iterator edm::OwnVector< T, P >::end ( void  ) const
inline

Definition at line 243 of file OwnVector.h.

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

243  {
244  return const_iterator(data_.end());
245  }
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  pos)

Definition at line 377 of file OwnVector.h.

References edm::OwnVector< T, P >::iterator::i.

377  {
378  delete * pos.i;
379  return iterator(data_.erase(pos.i));
380  }
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  first,
iterator  last 
)

Definition at line 383 of file OwnVector.h.

References b, alignCSCRings::e, i, and edm::OwnVector< T, P >::iterator::i.

383  {
384  typename base::iterator b = first.i, e = last.i;
385  for(typename base::iterator i = b; i != e; ++ i)
386  delete * i;
387  return iterator(data_.erase(b, e));
388  }
int i
Definition: DBlmapReader.cc:9
double b
Definition: hdecay.h:120
T first(std::pair< T, U > const &p)
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 482 of file OwnVector.h.

References edm::detail::reallyfillPtrVector().

Referenced by edm::fillPtrVector().

484  {
485  detail::reallyfillPtrVector(*this, toType, indices, ptrs);
486  }
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
Definition: fillPtrVector.h:38
template<typename T , typename P >
void edm::OwnVector< T, P >::fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
helper_vector helpers 
) const

Definition at line 406 of file OwnVector.h.

References alignCSCRings::e, h, i, combine::key, edm::errors::NullPointerError, edm::reftobase::RefVectorHolderBase::push_back(), edm::reftobase::RefVectorHolderBase::reserve(), findQualityFiles::size, and edm::Exception::throwThis().

Referenced by edm::fillView().

408  {
409  typedef Ref<OwnVector> ref_type ;
410  typedef reftobase::RefHolder<ref_type> holder_type;
411 
412  size_type numElements = this->size();
413  pointers.reserve(numElements);
414  helpers.reserve(numElements);
415  size_type key = 0;
416  for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) {
417 
418  if (*i == 0) {
420  "In OwnVector::fillView() we have intercepted an attempt to put a null pointer\n"
421  "into a View and that is not allowed. It is probably an error that the null\n"
422  "pointer was in the OwnVector in the first place.\n");
423  }
424  else {
425  pointers.push_back(*i);
426  holder_type h(ref_type(id, *i, key,this));
427  helpers.push_back(&h);
428  }
429  }
430  }
int i
Definition: DBlmapReader.cc:9
size_type size() const
Definition: OwnVector.h:248
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
base::size_type size_type
Definition: OwnVector.h:34
list key
Definition: combine.py:13
template<typename T , typename P >
OwnVector< T, P >::reference edm::OwnVector< T, P >::front ( )
inline
template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::front ( ) const
inline

Definition at line 354 of file OwnVector.h.

354  {
355  return *data_.front();
356  }
template<typename T , typename P >
bool edm::OwnVector< T, P >::is_back_safe ( ) const
inline

Definition at line 316 of file OwnVector.h.

316  {
317  return data_.back() != 0;
318  }
template<typename T, typename P>
OwnVector< T, P > & edm::OwnVector< T, P >::operator= ( OwnVector< T, P > const &  o)
inline

Definition at line 212 of file OwnVector.h.

References edm::swap(), and groupFilesInBlocks::temp.

212  {
213  OwnVector<T,P> temp(o);
214  swap(temp);
215  return *this;
216  }
void swap(OwnVector< T, P > &other) noexcept
Definition: OwnVector.h:401
template<typename T , typename P >
OwnVector< T, P >::reference edm::OwnVector< T, P >::operator[] ( size_type  n)
inline

Definition at line 258 of file OwnVector.h.

References n.

258  {
259  return *data_[n];
260  }
template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::operator[] ( size_type  n) const
inline

Definition at line 263 of file OwnVector.h.

References n.

263  {
264  return *data_[n];
265  }
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 178 of file OwnVector.h.

178  {
179  return Ordering<O>(comp);
180  }
template<typename T , typename P >
void edm::OwnVector< T, P >::pop_back ( )
inline

Definition at line 308 of file OwnVector.h.

308  {
309  // We have to delete the pointed-to thing, before we squeeze it
310  // out of the vector...
311  delete data_.back();
312  data_.pop_back();
313  }
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *&  d)
inline

Definition at line 274 of file OwnVector.h.

Referenced by reco::CompositeCandidate::addDaughter(), pat::PATObject< reco::Muon >::addUserData(), pat::PATObject< reco::Muon >::addUserDataFromPtr(), MuonAssociatorByHits::associateMuons(), MuonErrorMatrixAdjuster::attachRecHits(), SeedFromGenericPairOrTriplet::buildSeed(), SeedForPhotonConversion1Leg::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeed(), SeedFromConsecutiveHitsCreator::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeedBool(), RPCSeedOverlapper::CheckOverlap(), Traj2TrackHits::copy(), RPCSeedPattern::createFakeSeed(), MuonSeedFromRecHits::createSeed(), MuonSeedCreator::createSeed(), RPCSeedPattern::createSeed(), OutInConversionSeedFinder::createSeed(), InOutConversionSeedFinder::createSeed(), CSCSegtoRPC::CSCSegtoRPC(), OutsideInMuonSeeder::doLayer(), DTSegtoRPC::DTSegtoRPC(), SiStripElectronAlgo::findElectron(), SeedFromNuclearInteraction::hits(), CosmicLayerPairs::init(), reco::modules::CosmicTrackSplitter::makeCandidate(), reco::modules::TrackerTrackHitFilter::makeCandidate(), CosmicSeedCreator::makeSeed(), SETSeedFinder::makeSeed(), SiStripRecHitMatcher::match(), TrackMerger::merge(), GlobalTrackerMuonAlignment::muonFitter(), FastElectronSeedGenerator::prepareElTrackSeed(), PFAlgoTestBenchElectrons::processBlock(), PFAlgo::processBlock(), SeedCombiner::produce(), DTSegment4DT0Corrector::produce(), MuonReSeeder::produce(), cms::TrackListMerger::produce(), cms::SimpleTrackListMerger::produce(), SETMuonSeedProducer::produce(), TrajectorySeedProducer::produce(), TrackCandidateProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), reco::modules::DuplicateListMerger::produce(), TrajectorySeedFromMuonProducer::produce(), ConvBremSeedProducer::produce(), L2MuonSeedGenerator::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), TSGForRoadSearch::pushTrajectorySeed(), DTNoDriftAlgo::reconstruct(), RPCRecHitBaseAlgo::reconstruct(), GEMRecHitBaseAlgo::reconstruct(), DTRecHitBaseAlgo::reconstruct(), DTCombinatorialPatternReco4D::reconstruct(), DTMeantimerPatternReco4D::reconstruct(), DTRefitAndCombineReco4D::reconstruct(), DTCombinatorialPatternReco::reconstruct(), DTCombinatorialExtendedPatternReco::reconstruct(), DTMeantimerPatternReco::reconstruct(), KalmanAlignmentTrackRefitter::refitTracks(), PFPhotonAlgo::RunPFPhoton(), SeedFromProtoTrack::SeedFromProtoTrack(), SeedGeneratorForCRack::seeds(), SeedGeneratorForCosmics::seeds(), SimpleCosmicBONSeeder::seeds(), SiTrackerMultiRecHit::SiTrackerMultiRecHit(), KalmanAlignmentTrackRefitter::sortRecHits(), Traj2TrackHits::split(), TSGFromPropagation::trackerSeeds(), FastTSGFromPropagation::trackerSeeds(), GlobalTrackerMuonAlignment::trackFitter(), TracktoRPC::TracktoRPC(), and PFBenchmarkAlgo::vector_add().

274  {
275  // C++ does not yet support rvalue references, so d should only be
276  // able to bind to an lvalue.
277  // This should be called only for lvalues.
278  data_.push_back(d);
279  d = 0;
280  }
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *const &  d)
inline

Definition at line 284 of file OwnVector.h.

284  {
285 
286  // C++ allows d to be bound to an lvalue or rvalue. But the other
287  // signature should be a better match for an lvalue (because it
288  // does not require an lvalue->rvalue conversion). Thus this
289  // signature should only be chosen for rvalues.
290  data_.push_back(d);
291  }
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( std::auto_ptr< D >  d)
inline

Definition at line 296 of file OwnVector.h.

296  {
297  data_.push_back(d.release());
298  }
template<typename T, typename P >
void edm::OwnVector< T, P >::push_back ( T const &  valueToCopy)
inline

Definition at line 302 of file OwnVector.h.

References clone().

302  {
303  data_.push_back(policy_type::clone(d));
304  }
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
template<typename T , typename P >
void edm::OwnVector< T, P >::reserve ( size_t  n)
inline
template<typename T, typename P = ClonePolicy<T>>
void edm::OwnVector< T, P >::reverse ( )
inline

Definition at line 143 of file OwnVector.h.

Referenced by cms::CosmicTrackFinder::produce().

143 { std::reverse(data_.begin(),data_.end());}
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 463 of file OwnVector.h.

References cmsHarvester::index.

Referenced by edm::setPtr().

465  {
466  detail::reallySetPtr<OwnVector<T,P> >(*this, toType, index, ptr);
467  }
template<typename T , typename P >
OwnVector< T, P >::size_type edm::OwnVector< T, P >::size ( void  ) const
inline

Definition at line 248 of file OwnVector.h.

Referenced by MuonAssociatorByHits::associateMuons(), PFRecoTauAlgorithm::buildPFTau(), FWPFBlockProxyBuilder::buildViewType(), RPCSeedOverlapper::CheckOverlap(), DTSegtoRPC::DTSegtoRPC(), JetMatchingTools::getGenParticle(), RPCSeedOverlapper::isShareHit(), SiStripRecHitConverterAlgorithm::match(), TrackMerger::merge(), GlobalTrackerMuonAlignment::muonFitter(), TrajectorySeed::nHits(), reco::CompositeCandidate::numberOfDaughters(), reco::tau::RecoTauElectronRejectionPlugin::operator()(), PFAlgoTestBenchElectrons::processBlock(), PFAlgo::processBlock(), DTRecSegment4DProducer::produce(), DTRecHitProducer::produce(), DTRecSegment2DProducer::produce(), TrackCandidateProducer::produce(), TrajectorySeedProducer::produce(), DTRecSegment2DExtendedProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), GEMRecHitProducer::produce(), RPCRecHitProducer::produce(), PFEGammaProducer::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), PFAlgo::reconstructParticles(), KalmanAlignmentTrackRefitter::refitSingleTracklet(), KalmanAlignmentTrackRefitter::refitTracks(), PFPhotonAlgo::RunPFPhoton(), PFElectronAlgo::SetLinks(), SiTrackerMultiRecHit::sharesInput(), KalmanAlignmentTrackRefitter::sortRecHits(), pat::Jet::tagInfo(), pat::Jet::tagInfoByType(), GlobalTrackerMuonAlignment::trackFitter(), and OutInConversionTrackFinder::tracks().

248  {
249  return data_.size();
250  }
template<typename T , typename P >
template<typename S >
void edm::OwnVector< T, P >::sort ( s)

Definition at line 391 of file OwnVector.h.

References config::ordering, and python.multivaluedict::sort().

Referenced by PFBenchmarkAlgo::vector_sort().

391  {
392  std::sort(data_.begin(), data_.end(), ordering(comp));
393  }
static Ordering< O > ordering(O const &comp)
Definition: OwnVector.h:178
template<typename T , typename P >
void edm::OwnVector< T, P >::sort ( )

Definition at line 396 of file OwnVector.h.

References config::ordering, and python.multivaluedict::sort().

396  {
397  std::sort(data_.begin(), data_.end(), ordering(std::less<value_type>()));
398  }
static Ordering< O > ordering(O const &comp)
Definition: OwnVector.h:178
template<typename T, typename P>
void edm::OwnVector< T, P >::swap ( OwnVector< T, P > &  other)
inlinenoexcept

Definition at line 401 of file OwnVector.h.

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

401  {
402  data_.swap(other.data_);
403  }

Member Data Documentation

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

Definition at line 181 of file OwnVector.h.

Referenced by edm::OwnVector< reco::reco::PFBlockElement >::reverse().