test
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 | 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
 
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
 
void shrink_to_fit ()
 
size_type size () const
 
template<typename S >
void sort (S s)
 
void sort ()
 
void swap (OwnVector< T, P > &other)
 
 ~OwnVector ()
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

void destroy ()
 

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

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

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

Definition at line 195 of file OwnVector.h.

195  : data_(n) {
196  }
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 ( )
inline

Definition at line 213 of file OwnVector.h.

References pyrootRender::destroy().

213  {
214  destroy();
215  }
void destroy()
Definition: OwnVector.h:365

Member Function Documentation

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

Definition at line 327 of file OwnVector.h.

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

Referenced by SeedFromProtoTrack::init(), SeedCombiner::produce(), TrackListMerger::produce(), SimpleTrackListMerger::produce(), DuplicateListMerger::produce(), DTCombinatorialPatternReco::reconstruct(), and DTCombinatorialExtendedPatternReco::reconstruct().

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

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

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

244  {
245  return const_iterator(data_.begin());
246  }
template<typename T, typename P = ClonePolicy<T>>
static short edm::OwnVector< T, P >::Class_Version ( )
inlinestatic

Definition at line 170 of file OwnVector.h.

172 :
173  void destroy() noexcept;
#define noexcept
void destroy()
Definition: OwnVector.h:365
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
template<typename T , typename P >
void edm::OwnVector< T, P >::destroy ( )
inlineprivate

Definition at line 365 of file OwnVector.h.

References b, alignCSCRings::e, and i.

365  {
366  typename base::const_iterator b = data_.begin(), e = data_.end();
367  for(typename base::const_iterator i = b; i != e; ++ i)
368  delete * i;
369  }
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

Definition at line 259 of file OwnVector.h.

Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField::setAutotruncate().

259  {
260  return data_.empty();
261  }
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 249 of file OwnVector.h.

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

249  {
250  return const_iterator(data_.end());
251  }
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  pos)

Definition at line 383 of file OwnVector.h.

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

383  {
384  delete * pos.i;
385  return iterator(data_.erase(pos.i));
386  }
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  first,
iterator  last 
)

Definition at line 389 of file OwnVector.h.

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

389  {
390  typename base::iterator b = first.i, e = last.i;
391  for(typename base::iterator i = b; i != e; ++ i)
392  delete * i;
393  return iterator(data_.erase(b, e));
394  }
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 486 of file OwnVector.h.

References edm::detail::reallyfillPtrVector().

Referenced by edm::fillPtrVector().

488  {
489  detail::reallyfillPtrVector(*this, toType, indices, ptrs);
490  }
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 = ClonePolicy<T>>
void edm::OwnVector< T, P >::fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
FillViewHelperVector helpers 
) const

Referenced by edm::fillView().

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

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

Definition at line 322 of file OwnVector.h.

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

Definition at line 218 of file OwnVector.h.

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

218  {
219  OwnVector<T,P> temp(o);
220  swap(temp);
221  return *this;
222  }
void swap(OwnVector< T, P > &other)
Definition: OwnVector.h:407
template<typename T , typename P >
OwnVector< T, P >::reference edm::OwnVector< T, P >::operator[] ( size_type  n)
inline

Definition at line 264 of file OwnVector.h.

References gen::n.

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

Definition at line 269 of file OwnVector.h.

References gen::n.

269  {
270  return *data_[n];
271  }
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 184 of file OwnVector.h.

184  {
185  return Ordering<O>(comp);
186  }
template<typename T , typename P >
void edm::OwnVector< T, P >::pop_back ( )
inline

Definition at line 314 of file OwnVector.h.

314  {
315  // We have to delete the pointed-to thing, before we squeeze it
316  // out of the vector...
317  delete data_.back();
318  data_.pop_back();
319  }
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *&  d)
inline

Definition at line 280 of file OwnVector.h.

Referenced by reco::CompositeCandidate::addDaughter(), pat::PATObject< reco::Muon >::addUserData(), pat::PATObject< reco::Muon >::addUserDataFromPtr(), MuonToSimAssociatorByHits::associateMuons(), MuonToTrackingParticleAssociatorByHitsImpl::associateMuons(), MuonErrorMatrixAdjuster::attachRecHits(), SeedFromGenericPairOrTriplet::buildSeed(), SeedFromConsecutiveHitsCreator::buildSeed(), SeedForPhotonConversion1Leg::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeedBool(), RPCSeedOverlapper::CheckOverlap(), Traj2TrackHits::copy(), RPCSeedPattern::createFakeSeed(), MuonSeedFromRecHits::createSeed(), MuonSeedCreator::createSeed(), RPCSeedPattern::createSeed(), OutInConversionSeedFinder::createSeed(), CosmicMuonSeedGenerator::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(), TSGForOI::makeSeedsFromHits(), SiStripRecHitMatcher::match(), TrackMerger::merge(), GlobalTrackerMuonAlignment::muonFitter(), PFAlgoTestBenchElectrons::processBlock(), PFAlgo::processBlock(), SeedCombiner::produce(), TrackCandidateProducer::produce(), DTSegment4DT0Corrector::produce(), MuonReSeeder::produce(), SimpleTrackListMerger::produce(), TrackListMerger::produce(), SETMuonSeedProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), TrajectorySeedFromMuonProducer::produce(), DuplicateListMerger::produce(), ConvBremSeedProducer::produce(), L2MuonSeedGenerator::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), TrajectorySeedProducer::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), TSGForRoadSearch::pushTrajectorySeed(), DTNoDriftAlgo::reconstruct(), ME0RecHitBaseAlgo::reconstruct(), RPCRecHitBaseAlgo::reconstruct(), GEMRecHitBaseAlgo::reconstruct(), DTRecHitBaseAlgo::reconstruct(), DTCombinatorialPatternReco4D::reconstruct(), DTMeantimerPatternReco4D::reconstruct(), DTRefitAndCombineReco4D::reconstruct(), DTCombinatorialPatternReco::reconstruct(), DTCombinatorialExtendedPatternReco::reconstruct(), DTMeantimerPatternReco::reconstruct(), PFPhotonAlgo::RunPFPhoton(), SeedFromProtoTrack::SeedFromProtoTrack(), SeedGeneratorForCRack::seeds(), SeedGeneratorForCosmics::seeds(), SimpleCosmicBONSeeder::seeds(), SiTrackerMultiRecHit::SiTrackerMultiRecHit(), FastTrackerRecHitSplitter::split(), Traj2TrackHits::split(), TSGFromPropagation::trackerSeeds(), FastTSGFromPropagation::trackerSeeds(), GlobalTrackerMuonAlignment::trackFitter(), TracktoRPC::TracktoRPC(), and PFBenchmarkAlgo::vector_add().

280  {
281  // C++ does not yet support rvalue references, so d should only be
282  // able to bind to an lvalue.
283  // This should be called only for lvalues.
284  data_.push_back(d);
285  d = 0;
286  }
tuple d
Definition: ztail.py:151
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *const &  d)
inline

Definition at line 290 of file OwnVector.h.

290  {
291 
292  // C++ allows d to be bound to an lvalue or rvalue. But the other
293  // signature should be a better match for an lvalue (because it
294  // does not require an lvalue->rvalue conversion). Thus this
295  // signature should only be chosen for rvalues.
296  data_.push_back(d);
297  }
tuple d
Definition: ztail.py:151
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( std::auto_ptr< D >  d)
inline

Definition at line 302 of file OwnVector.h.

302  {
303  data_.push_back(d.release());
304  }
tuple d
Definition: ztail.py:151
template<typename T, typename P >
void edm::OwnVector< T, P >::push_back ( T const &  valueToCopy)
inline

Definition at line 308 of file OwnVector.h.

References clone().

308  {
309  data_.push_back(policy_type::clone(d));
310  }
tuple d
Definition: ztail.py:151
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 149 of file OwnVector.h.

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

149 { 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 467 of file OwnVector.h.

References cmsHarvester::index.

Referenced by edm::setPtr().

469  {
470  detail::reallySetPtr<OwnVector<T,P> >(*this, toType, index, ptr);
471  }
template<typename T, typename P = ClonePolicy<T>>
void edm::OwnVector< T, P >::shrink_to_fit ( )
inline

Definition at line 127 of file OwnVector.h.

Referenced by Traj2TrackHits::operator()().

127  {
128 #ifndef CMS_NOCXX11
129  data_.shrink_to_fit();
130 #endif
131  }
template<typename T , typename P >
OwnVector< T, P >::size_type edm::OwnVector< T, P >::size ( void  ) const
inline

Definition at line 254 of file OwnVector.h.

Referenced by DiJetAnalyzer::analyze(), GammaJetAnalysis::analyze(), MuonToSimAssociatorByHits::associateMuons(), MuonToTrackingParticleAssociatorByHitsImpl::associateMuons(), PFRecoTauAlgorithm::buildPFTau(), FWPFBlockProxyBuilder::buildViewType(), RPCSeedOverlapper::CheckOverlap(), DTSegtoRPC::DTSegtoRPC(), METAnalyzer::fillMonitorElement(), JetMatchingTools::getGenParticle(), RPCSeedOverlapper::isShareHit(), SiStripRecHitConverterAlgorithm::match(), GlobalTrackerMuonAlignment::muonFitter(), TrajectorySeed::nHits(), reco::CompositeCandidate::numberOfDaughters(), reco::tau::RecoTauElectronRejectionPlugin::operator()(), PFAlgoTestBenchElectrons::processBlock(), PFAlgo::processBlock(), DTRecSegment4DProducer::produce(), DTRecHitProducer::produce(), DTRecSegment2DProducer::produce(), DTRecSegment2DExtendedProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), GEMRecHitProducer::produce(), RPCRecHitProducer::produce(), ME0RecHitProducer::produce(), PFEGammaProducer::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), TrajectorySeedProducer::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), PFAlgo::reconstructParticles(), PFPhotonAlgo::RunPFPhoton(), PFElectronAlgo::SetLinks(), SiTrackerMultiRecHit::sharesInput(), pat::Jet::tagInfoByType(), GlobalTrackerMuonAlignment::trackFitter(), and OutInConversionTrackFinder::tracks().

254  {
255  return data_.size();
256  }
template<typename T , typename P >
template<typename S >
void edm::OwnVector< T, P >::sort ( S  s)

Definition at line 397 of file OwnVector.h.

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

Referenced by PFBenchmarkAlgo::vector_sort().

397  {
398  std::sort(data_.begin(), data_.end(), ordering(comp));
399  }
static Ordering< O > ordering(O const &comp)
Definition: OwnVector.h:184
template<typename T , typename P >
void edm::OwnVector< T, P >::sort ( )

Definition at line 402 of file OwnVector.h.

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

402  {
403  std::sort(data_.begin(), data_.end(), ordering(std::less<value_type>()));
404  }
static Ordering< O > ordering(O const &comp)
Definition: OwnVector.h:184
template<typename T, typename P>
void edm::OwnVector< T, P >::swap ( OwnVector< T, P > &  other)
inline

Definition at line 407 of file OwnVector.h.

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

407  {
408  data_.swap(other.data_);
409  }

Member Data Documentation

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