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

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

Definition at line 188 of file OwnVector.h.

188  : data_(n) {
189  }
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 206 of file OwnVector.h.

References pyrootRender::destroy().

206  {
207  destroy();
208  }
void destroy() noexcept
Definition: OwnVector.h:358

Member Function Documentation

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

Definition at line 320 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().

320  {
321  T* result = data_.back();
322  if (result == 0) {
324  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
325  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
326  "pointer at the end of the collection is not null before calling back()\n"
327  "if you wish to avoid this exception.\n"
328  "Consider using OwnVector::is_back_safe()\n");
329  }
330  return *data_.back();
331  }
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 334 of file OwnVector.h.

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

334  {
335  T* result = data_.back();
336  if (result == 0) {
338  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
339  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
340  "pointer at the end of the collection is not null before calling back()\n"
341  "if you wish to avoid this exception.\n"
342  "Consider using OwnVector::is_back_safe()\n");
343  }
344  return *data_.back();
345  }
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 237 of file OwnVector.h.

237  {
238  return const_iterator(data_.begin());
239  }
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 365 of file OwnVector.h.

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

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

Definition at line 358 of file OwnVector.h.

References b, alignCSCRings::e, and i.

358  {
359  typename base::const_iterator b = data_.begin(), e = data_.end();
360  for(typename base::const_iterator i = b; i != e; ++ i)
361  delete * i;
362  }
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 242 of file OwnVector.h.

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

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

Definition at line 376 of file OwnVector.h.

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

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

Definition at line 382 of file OwnVector.h.

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

382  {
383  typename base::iterator b = first.i, e = last.i;
384  for(typename base::iterator i = b; i != e; ++ i)
385  delete * i;
386  return iterator(data_.erase(b, e));
387  }
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 481 of file OwnVector.h.

References edm::detail::reallyfillPtrVector().

Referenced by edm::fillPtrVector().

483  {
484  detail::reallyfillPtrVector(*this, toType, indices, ptrs);
485  }
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 405 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().

407  {
408  typedef Ref<OwnVector> ref_type ;
409  typedef reftobase::RefHolder<ref_type> holder_type;
410 
411  size_type numElements = this->size();
412  pointers.reserve(numElements);
413  helpers.reserve(numElements);
414  size_type key = 0;
415  for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) {
416 
417  if (*i == 0) {
419  "In OwnVector::fillView() we have intercepted an attempt to put a null pointer\n"
420  "into a View and that is not allowed. It is probably an error that the null\n"
421  "pointer was in the OwnVector in the first place.\n");
422  }
423  else {
424  pointers.push_back(*i);
425  holder_type h(ref_type(id, *i, key,this));
426  helpers.push_back(&h);
427  }
428  }
429  }
int i
Definition: DBlmapReader.cc:9
size_type size() const
Definition: OwnVector.h:247
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 353 of file OwnVector.h.

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

Definition at line 315 of file OwnVector.h.

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

Definition at line 211 of file OwnVector.h.

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

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

Definition at line 257 of file OwnVector.h.

References n.

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

Definition at line 262 of file OwnVector.h.

References n.

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

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

Definition at line 307 of file OwnVector.h.

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

Definition at line 273 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(), SeedFromConsecutiveHitsCreator::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeedBool(), RPCSeedOverlapper::CheckOverlap(), 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(), TrajectorySeedProducer::produce(), TrackCandidateProducer::produce(), cms::TrackListMerger::produce(), cms::SimpleTrackListMerger::produce(), SETMuonSeedProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), reco::modules::DuplicateListMerger::produce(), TrajectorySeedFromMuonProducer::produce(), ConvBremSeedProducer::produce(), L2MuonSeedGenerator::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), cms::CosmicTrackFinder::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), TSGForRoadSearch::pushTrajectorySeed(), DTNoDriftAlgo::reconstruct(), RPCRecHitBaseAlgo::reconstruct(), GEMRecHitBaseAlgo::reconstruct(), DTRecHitBaseAlgo::reconstruct(), DTMeantimerPatternReco4D::reconstruct(), DTCombinatorialPatternReco4D::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(), TSGFromPropagation::trackerSeeds(), FastTSGFromPropagation::trackerSeeds(), GlobalTrackerMuonAlignment::trackFitter(), InOutConversionTrackFinder::tracks(), OutInConversionTrackFinder::tracks(), TracktoRPC::TracktoRPC(), and PFBenchmarkAlgo::vector_add().

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

Definition at line 283 of file OwnVector.h.

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

Definition at line 295 of file OwnVector.h.

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

Definition at line 301 of file OwnVector.h.

References statics::clone.

301  {
302  data_.push_back(policy_type::clone(d));
303  }
tuple clone
Definition: statics.py:58
template<typename T , typename P >
void edm::OwnVector< T, P >::reserve ( size_t  n)
inline
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 462 of file OwnVector.h.

References getHLTprescales::index.

Referenced by edm::setPtr().

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

Definition at line 247 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()(), PFBlockAlgo::packLinks(), PFAlgoTestBenchElectrons::processBlock(), PFAlgo::processBlock(), PFRootEventManagerColin::processHIGH_E_TAUS(), DTRecSegment4DProducer::produce(), DTRecHitProducer::produce(), TrajectorySeedProducer::produce(), TrackCandidateProducer::produce(), DTRecSegment2DExtendedProducer::produce(), DTRecSegment2DProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), GEMRecHitProducer::produce(), RPCRecHitProducer::produce(), PFEGammaProducer::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), 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().

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

Definition at line 390 of file OwnVector.h.

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

Referenced by PFBenchmarkAlgo::vector_sort().

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

Definition at line 395 of file OwnVector.h.

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

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

Definition at line 400 of file OwnVector.h.

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

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

Member Data Documentation

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

Definition at line 180 of file OwnVector.h.