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)
 
 ~OwnVector ()
 

Private Types

typedef std::vector< T * > base
 

Private Member Functions

void destroy ()
 
void fixup () const
 
void touch ()
 

Static Private Member Functions

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

Private Attributes

base data_
 
helpers::PostReadFixupTrait< T >
::type 
fixup_
 

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

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

Definition at line 29 of file OwnVector.h.

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

Definition at line 37 of file OwnVector.h.

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

Definition at line 35 of file OwnVector.h.

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

Definition at line 38 of file OwnVector.h.

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

Definition at line 36 of file OwnVector.h.

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.

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

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

Definition at line 190 of file OwnVector.h.

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

Definition at line 194 of file OwnVector.h.

194  : data_(n) {
195  }
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 214 of file OwnVector.h.

References matplotRender::destroy().

214  {
215  destroy();
216  }
void destroy()
Definition: OwnVector.h:386

Member Function Documentation

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

Definition at line 342 of file OwnVector.h.

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

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

342  {
343  T* result = data_.back();
344  if (result == 0) {
346  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
347  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
348  "pointer at the end of the collection is not null before calling back()\n"
349  "if you wish to avoid this exception.\n"
350  "Consider using OwnVector::is_back_safe()\n");
351  }
352  fixup();
353  touch();
354  return *data_.back();
355  }
void touch()
Definition: OwnVector.h:186
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:81
tuple result
Definition: query.py:137
void fixup() const
Definition: OwnVector.h:185
long double T
template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::back ( ) const
inline

Definition at line 358 of file OwnVector.h.

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

358  {
359  T* result = data_.back();
360  if (result == 0) {
362  "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
363  "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
364  "pointer at the end of the collection is not null before calling back()\n"
365  "if you wish to avoid this exception.\n"
366  "Consider using OwnVector::is_back_safe()\n");
367  }
368  fixup();
369  return *data_.back();
370  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:81
tuple result
Definition: query.py:137
void fixup() const
Definition: OwnVector.h:185
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 250 of file OwnVector.h.

250  {
251  fixup();
252  return const_iterator(data_.begin());
253  }
void fixup() const
Definition: OwnVector.h:185
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 393 of file OwnVector.h.

Referenced by SiTrackerMultiRecHit::recHits().

393  {
394  fixup();
395  return data_;
396  }
void fixup() const
Definition: OwnVector.h:185
template<typename T , typename P >
void edm::OwnVector< T, P >::destroy ( )
inlineprivate

Definition at line 386 of file OwnVector.h.

References b, and i.

386  {
387  typename base::const_iterator b = data_.begin(), e = data_.end();
388  for( typename base::const_iterator i = b; i != e; ++ i )
389  delete * i;
390  }
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 256 of file OwnVector.h.

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

256  {
257  fixup();
258  return const_iterator(data_.end());
259  }
void fixup() const
Definition: OwnVector.h:185
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  pos)

Definition at line 405 of file OwnVector.h.

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

405  {
406  fixup();
407  touch();
408  delete * pos.i;
409  return iterator(data_.erase(pos.i));
410  }
void touch()
Definition: OwnVector.h:186
void fixup() const
Definition: OwnVector.h:185
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::erase ( iterator  first,
iterator  last 
)

Definition at line 413 of file OwnVector.h.

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

413  {
414  fixup();
415  touch();
416  typename base::iterator b = first.i, e = last.i;
417  for( typename base::iterator i = b; i != e; ++ i )
418  delete * i;
419  return iterator(data_.erase(b, e));
420  }
int i
Definition: DBlmapReader.cc:9
void touch()
Definition: OwnVector.h:186
void fixup() const
Definition: OwnVector.h:185
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 515 of file OwnVector.h.

References edm::detail::reallyfillPtrVector().

Referenced by edm::fillPtrVector().

517  {
518  detail::reallyfillPtrVector(*this, toType, indices, ptrs);
519  }
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
Definition: fillPtrVector.h:39
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 439 of file OwnVector.h.

References 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().

441  {
442  typedef Ref<OwnVector> ref_type ;
443  typedef reftobase::RefHolder<ref_type> holder_type;
444 
445  size_type numElements = this->size();
446  pointers.reserve(numElements);
447  helpers.reserve(numElements);
448  size_type key = 0;
449  for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) {
450 
451  if (*i == 0) {
453  "In OwnVector::fillView() we have intercepted an attempt to put a null pointer\n"
454  "into a View and that is not allowed. It is probably an error that the null\n"
455  "pointer was in the OwnVector in the first place.\n");
456  }
457  else {
458  pointers.push_back(*i);
459  holder_type h(ref_type(id, *i, key,this));
460  helpers.push_back(&h);
461  }
462  }
463  }
int i
Definition: DBlmapReader.cc:9
size_type size() const
Definition: OwnVector.h:262
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:81
base::size_type size_type
Definition: OwnVector.h:33
list key
Definition: combine.py:13
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
template<typename T, typename P = ClonePolicy<T>>
void edm::OwnVector< T, P >::fixup ( ) const
inlineprivate

Definition at line 185 of file OwnVector.h.

185 { fixup_(data_); }
helpers::PostReadFixupTrait< T >::type fixup_
Definition: OwnVector.h:184
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 380 of file OwnVector.h.

380  {
381  fixup();
382  return *data_.front();
383  }
void fixup() const
Definition: OwnVector.h:185
template<typename T , typename P >
bool edm::OwnVector< T, P >::is_back_safe ( ) const
inline

Definition at line 337 of file OwnVector.h.

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

Definition at line 219 of file OwnVector.h.

References edm::swap(), and cond::rpcobtemp::temp.

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

Definition at line 272 of file OwnVector.h.

References n.

272  {
273  fixup();
274  return *data_[n];
275  }
void fixup() const
Definition: OwnVector.h:185
template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::operator[] ( size_type  n) const
inline

Definition at line 278 of file OwnVector.h.

References n.

278  {
279  fixup();
280  return *data_[n];
281  }
void fixup() const
Definition: OwnVector.h:185
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 180 of file OwnVector.h.

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

Definition at line 328 of file OwnVector.h.

328  {
329  // We have to delete the pointed-to thing, before we squeeze it
330  // out of the vector...
331  delete data_.back();
332  data_.pop_back();
333  touch();
334  }
void touch()
Definition: OwnVector.h:186
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *&  d)
inline

Definition at line 290 of file OwnVector.h.

Referenced by reco::CompositeCandidate::addDaughter(), pat::PATObject< reco::Muon >::addUserData(), pat::PATObject< reco::Muon >::addUserDataFromPtr(), MuonAssociatorByHits::associateMuons(), MuonErrorMatrixAdjuster::attachRecHits(), SeedFromConsecutiveHitsCreator::buildSeed(), SeedFromGenericPairOrTriplet::buildSeed(), RPCSeedOverlapper::CheckOverlap(), RPCSeedPattern::createFakeSeed(), MuonSeedFromRecHits::createSeed(), MuonSeedCreator::createSeed(), RPCSeedPattern::createSeed(), OutInConversionSeedFinder::createSeed(), InOutConversionSeedFinder::createSeed(), RoadSearchTrackCandidateMakerAlgorithm::createSeedTrajectory(), CSCSegtoRPC::CSCSegtoRPC(), DTSegtoRPC::DTSegtoRPC(), SiStripElectronAlgo::findElectron(), SeedFromNuclearInteraction::hits(), CosmicLayerPairs::init(), reco::modules::CosmicTrackSplitter::makeCandidate(), reco::modules::TrackerTrackHitFilter::makeCandidate(), SETSeedFinder::makeSeed(), SiStripRecHitMatcher::match(), GlobalTrackerMuonAlignment::muonFitter(), FastElectronSeedGenerator::prepareElTrackSeed(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), PFAlgoTestBenchElectrons::processBlock(), PFAlgo::processBlock(), SeedCombiner::produce(), DTSegment4DT0Corrector::produce(), TrackCandidateProducer::produce(), TrajectorySeedProducer::produce(), L2MuonSeedGenerator::produce(), SETMuonSeedProducer::produce(), cms::SimpleTrackListMerger::produce(), TrackCandidateTopBottomHitFilter::produce(), TrajectorySeedFromMuonProducer::produce(), ConvBremSeedProducer::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), cms::CosmicTrackFinder::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), TSGForRoadSearch::pushTrajectorySeed(), DTNoDriftAlgo::reconstruct(), RPCRecHitBaseAlgo::reconstruct(), DTRecHitBaseAlgo::reconstruct(), DTMeantimerPatternReco4D::reconstruct(), DTCombinatorialPatternReco4D::reconstruct(), DTRefitAndCombineReco4D::reconstruct(), DTCombinatorialPatternReco::reconstruct(), DTCombinatorialExtendedPatternReco::reconstruct(), DTMeantimerPatternReco::reconstruct(), KalmanAlignmentTrackRefitter::refitTracks(), RoadSearchTrackCandidateMakerAlgorithm::run(), 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(), CosmicSeedCreator::trajectorySeed(), and PFBenchmarkAlgo::vector_add().

290  {
291  // C++ does not yet support rvalue references, so d should only be
292  // able to bind to an lvalue.
293  // This should be called only for lvalues.
294  data_.push_back(d);
295  d = 0;
296  touch();
297  }
void touch()
Definition: OwnVector.h:186
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *const &  d)
inline

Definition at line 301 of file OwnVector.h.

301  {
302 
303  // C++ allows d to be bound to an lvalue or rvalue. But the other
304  // signature should be a better match for an lvalue (because it
305  // does not require an lvalue->rvalue conversion). Thus this
306  // signature should only be chosen for rvalues.
307  data_.push_back(d);
308  touch();
309  }
void touch()
Definition: OwnVector.h:186
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( std::auto_ptr< D >  d)
inline

Definition at line 314 of file OwnVector.h.

314  {
315  data_.push_back(d.release());
316  touch();
317  }
void touch()
Definition: OwnVector.h:186
template<typename T, typename P >
void edm::OwnVector< T, P >::push_back ( T const &  valueToCopy)
inline

Definition at line 321 of file OwnVector.h.

References clone().

321  {
322  data_.push_back(policy_type::clone(d));
323  touch();
324  }
void touch()
Definition: OwnVector.h:186
T * clone(const T *tp)
Definition: Ptr.h:42
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 496 of file OwnVector.h.

References getHLTprescales::index.

Referenced by edm::setPtr().

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

Definition at line 262 of file OwnVector.h.

Referenced by MuonAssociatorByHits::associateMuons(), PFRecoTauAlgorithm::buildPFTau(), FWPFBlockProxyBuilder::buildViewType(), PFBlockAlgo::checkDisplacedVertexLinks(), RPCSeedOverlapper::CheckOverlap(), DTSegtoRPC::DTSegtoRPC(), JetMatchingTools::getGenParticle(), RPCSeedOverlapper::isShareHit(), SiStripRecHitConverterAlgorithm::match(), 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(), TrackCandidateProducer::produce(), TrajectorySeedProducer::produce(), DTRecSegment2DProducer::produce(), DTRecSegment2DExtendedProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), RPCRecHitProducer::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), PFAlgo::reconstructParticles(), KalmanAlignmentTrackRefitter::refitSingleTracklet(), SimpleTrackRefitter::refitTrack(), KalmanAlignmentTrackRefitter::refitTracks(), RoadSearchTrackCandidateMakerAlgorithm::run(), PFPhotonAlgo::RunPFPhoton(), PFConversionAlgo::setLinks(), PFElectronAlgo::SetLinks(), SiTrackerMultiRecHit::sharesInput(), KalmanAlignmentTrackRefitter::sortRecHits(), pat::Jet::tagInfo(), pat::Jet::tagInfoByType(), GlobalTrackerMuonAlignment::trackFitter(), and OutInConversionTrackFinder::tracks().

262  {
263  return data_.size();
264  }
template<typename T , typename P >
template<typename S >
void edm::OwnVector< T, P >::sort ( s)

Definition at line 423 of file OwnVector.h.

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

Referenced by hltFindDuplicates.ModuleList::group(), and PFBenchmarkAlgo::vector_sort().

423  {
424  std::sort(data_.begin(), data_.end(), ordering(comp));
425  }
static Ordering< O > ordering(O const &comp)
Definition: OwnVector.h:180
template<typename T , typename P >
void edm::OwnVector< T, P >::sort ( )

Definition at line 428 of file OwnVector.h.

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

Referenced by hltFindDuplicates.ModuleList::group().

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

Definition at line 433 of file OwnVector.h.

References edm::OwnVector< T, P >::data_, edm::hash_detail::fixup_(), edm::OwnVector< T, P >::fixup_, and std::swap().

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

433  {
434  data_.swap(other.data_);
435  std::swap(fixup_, other.fixup_);
436  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
helpers::PostReadFixupTrait< T >::type fixup_
Definition: OwnVector.h:184
template<typename T, typename P = ClonePolicy<T>>
void edm::OwnVector< T, P >::touch ( )
inlineprivate

Definition at line 186 of file OwnVector.h.

186 { fixup_.touch(); }
helpers::PostReadFixupTrait< T >::type fixup_
Definition: OwnVector.h:184

Member Data Documentation

template<typename T, typename P = ClonePolicy<T>>
base edm::OwnVector< T, P >::data_
private
template<typename T, typename P = ClonePolicy<T>>
helpers::PostReadFixupTrait<T>::type edm::OwnVector< T, P >::fixup_
private