CMS 3D CMS Logo

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>

List of all members.

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
const_iterator end () const
iterator end ()
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 *const &d)
void push_back (T const &valueToCopy)
template<typename D >
void push_back (std::auto_ptr< D > d)
template<typename D >
void push_back (D *&d)
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.

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

Definition at line 188 of file OwnVector.h.

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

References pyrootRender::destroy().

                                              {
    destroy();
  }

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::SimpleTrackListMerger::produce(), cms::TrackListMerger::produce(), reco::modules::DuplicateListMerger::produce(), DTCombinatorialExtendedPatternReco::reconstruct(), DTCombinatorialPatternReco::reconstruct(), and KalmanAlignmentTrackRefitter::sortRecHits().

                                                                 {
    T* result = data_.back();
    if (result == 0) {
      Exception::throwThis(errors::NullPointerError,
        "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
        "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
        "pointer at the end of the collection is not null before calling back()\n"
        "if you wish to avoid this exception.\n"
        "Consider using OwnVector::is_back_safe()\n");
    }
    return *data_.back();
  }
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().

                                                                             {
    T* result = data_.back();
    if (result == 0) {
      Exception::throwThis(errors::NullPointerError,
        "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
        "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
        "pointer at the end of the collection is not null before calling back()\n"
        "if you wish to avoid this exception.\n"
        "Consider using OwnVector::is_back_safe()\n");
    }
    return *data_.back();
  }
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.

                                                                             {
    return const_iterator(data_.begin());
  }
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 SiTrackerMultiRecHit::recHits().

                                                                         {
    return data_;
  }
template<typename T , typename P >
void edm::OwnVector< T, P >::destroy ( ) [inline, private]

Definition at line 358 of file OwnVector.h.

References b, alignCSCRings::e, and i.

                                                {
    typename base::const_iterator b = data_.begin(), e = data_.end();
    for(typename base::const_iterator i = b; i != e; ++ i)
      delete * i;
  }
template<typename T , typename P >
bool edm::OwnVector< T, P >::empty ( ) const [inline]

Definition at line 252 of file OwnVector.h.

Referenced by KalmanAlignmentTrackRefitter::refitTracks().

                                           {
    return data_.empty();
  }
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.

                                                                           {
    return const_iterator(data_.end());
  }
template<typename T , typename P >
OwnVector< T, P >::iterator edm::OwnVector< T, P >::end ( void  ) [inline]
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.

                                                                      {
    delete * pos.i;
    return iterator(data_.erase(pos.i));
  }
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, edm::OwnVector< T, P >::iterator::i, and i.

                                                                                       {
    typename base::iterator b = first.i, e = last.i;
    for(typename base::iterator i = b; i != e; ++ i)
      delete * i;
    return iterator(data_.erase(b, e));
  }
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().

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

                                                               {
    typedef Ref<OwnVector>      ref_type ;
    typedef reftobase::RefHolder<ref_type> holder_type;

    size_type numElements = this->size();
    pointers.reserve(numElements);
    helpers.reserve(numElements);
    size_type key = 0;
    for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) {

      if (*i == 0) {
        Exception::throwThis(errors::NullPointerError,
          "In OwnVector::fillView() we have intercepted an attempt to put a null pointer\n"
          "into a View and that is not allowed.  It is probably an error that the null\n"
          "pointer was in the OwnVector in the first place.\n");
      }
      else {
        pointers.push_back(*i);
        holder_type h(ref_type(id, *i, key,this));
        helpers.push_back(&h);
      }
    }
  }
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.

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

Definition at line 315 of file OwnVector.h.

                                                  {
    return data_.back() != 0;
  }
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.

                                                                             {
    OwnVector<T,P> temp(o);
    swap(temp);
    return *this;
  }
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.

                                                                                              {
    return *data_[n];
  }
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.

                                                                                  {
    return *data_[n];
  }
template<typename T, typename P = ClonePolicy<T>>
template<typename O >
static Ordering<O> edm::OwnVector< T, P >::ordering ( O const &  comp) [inline, static, private]

Definition at line 177 of file OwnVector.h.

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

Definition at line 307 of file OwnVector.h.

                                        {
    // We have to delete the pointed-to thing, before we squeeze it
    // out of the vector...
    delete data_.back();
    data_.pop_back();
  }
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.

                                                         {
    data_.push_back(d.release());
  }
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 clone().

                                                   {
    data_.push_back(policy_type::clone(d));
  }
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(), SeedForPhotonConversion1Leg::buildSeed(), SeedFromConsecutiveHitsCreator::buildSeed(), SeedFromGenericPairOrTriplet::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeed(), SeedForPhotonConversionFromQuadruplets::buildSeedBool(), RPCSeedOverlapper::CheckOverlap(), RPCSeedPattern::createFakeSeed(), MuonSeedCreator::createSeed(), RPCSeedPattern::createSeed(), OutInConversionSeedFinder::createSeed(), InOutConversionSeedFinder::createSeed(), MuonSeedFromRecHits::createSeed(), RoadSearchTrackCandidateMakerAlgorithm::createSeedTrajectory(), CSCSegtoRPC::CSCSegtoRPC(), OutsideInMuonSeeder::doLayer(), DTSegtoRPC::DTSegtoRPC(), SiStripElectronAlgo::findElectron(), SeedFromNuclearInteraction::hits(), CosmicLayerPairs::init(), reco::modules::CosmicTrackSplitter::makeCandidate(), reco::modules::TrackerTrackHitFilter::makeCandidate(), SETSeedFinder::makeSeed(), SiStripRecHitMatcher::match(), TrackMerger::merge(), GlobalTrackerMuonAlignment::muonFitter(), FastElectronSeedGenerator::prepareElTrackSeed(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), SeedCombiner::produce(), cms::TrackListMerger::produce(), cms::SimpleTrackListMerger::produce(), L2MuonSeedGenerator::produce(), TrajectorySeedFromMuonProducer::produce(), MuonReSeeder::produce(), reco::modules::DuplicateListMerger::produce(), TrackCandidateProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), SETMuonSeedProducer::produce(), DTSegment4DT0Corrector::produce(), TrackerToMuonPropagator::produce(), TrajectorySeedProducer::produce(), cms::CosmicTrackFinder::produce(), ConvBremSeedProducer::produce(), CSCOverlapsTrackPreparation::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), TSGForRoadSearch::pushTrajectorySeed(), DTRefitAndCombineReco4D::reconstruct(), DTCombinatorialExtendedPatternReco::reconstruct(), DTRecHitBaseAlgo::reconstruct(), RPCRecHitBaseAlgo::reconstruct(), DTNoDriftAlgo::reconstruct(), DTCombinatorialPatternReco4D::reconstruct(), DTMeantimerPatternReco4D::reconstruct(), DTCombinatorialPatternReco::reconstruct(), DTMeantimerPatternReco::reconstruct(), PFAlgo::reconstructParticles(), KalmanAlignmentTrackRefitter::refitTracks(), RoadSearchTrackCandidateMakerAlgorithm::run(), PFPhotonAlgo::RunPFPhoton(), SeedFromProtoTrack::SeedFromProtoTrack(), SeedGeneratorForCRack::seeds(), SimpleCosmicBONSeeder::seeds(), SeedGeneratorForCosmics::seeds(), SiTrackerMultiRecHit::SiTrackerMultiRecHit(), KalmanAlignmentTrackRefitter::sortRecHits(), FastTSGFromPropagation::trackerSeeds(), TSGFromPropagation::trackerSeeds(), GlobalTrackerMuonAlignment::trackFitter(), OutInConversionTrackFinder::tracks(), InOutConversionTrackFinder::tracks(), TracktoRPC::TracktoRPC(), CosmicSeedCreator::trajectorySeed(), and PFBenchmarkAlgo::vector_add().

                                              {
    // C++ does not yet support rvalue references, so d should only be
    // able to bind to an lvalue.
    // This should be called only for lvalues.
    data_.push_back(d);
    d = 0;
  }
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.

                                                    {

    // C++ allows d to be bound to an lvalue or rvalue. But the other
    // signature should be a better match for an lvalue (because it
    // does not require an lvalue->rvalue conversion). Thus this
    // signature should only be chosen for rvalues.
    data_.push_back(d);
  }
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().

                                                           {
    detail::reallySetPtr<OwnVector<T,P> >(*this, toType, index, ptr);
  }
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()(), PFDisplacedVertexCandidateFinder::packLinks(), PFAlgoTestBenchElectrons::processBlock(), PFRootEventManagerColin::processHIGH_E_TAUS(), RPCRecHitProducer::produce(), TrackCandidateProducer::produce(), DTRecHitProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), DTRecSegment2DProducer::produce(), TrackerToMuonPropagator::produce(), TrajectorySeedProducer::produce(), DTRecSegment4DProducer::produce(), CSCOverlapsTrackPreparation::produce(), DTRecSegment2DExtendedProducer::produce(), PFAlgo::reconstructParticles(), KalmanAlignmentTrackRefitter::refitSingleTracklet(), KalmanAlignmentTrackRefitter::refitTracks(), RoadSearchTrackCandidateMakerAlgorithm::run(), PFPhotonAlgo::RunPFPhoton(), PFElectronAlgo::SetLinks(), SiTrackerMultiRecHit::sharesInput(), KalmanAlignmentTrackRefitter::sortRecHits(), pat::Jet::tagInfo(), pat::Jet::tagInfoByType(), GlobalTrackerMuonAlignment::trackFitter(), and OutInConversionTrackFinder::tracks().

                                                                       {
    return data_.size();
  }
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().

                             {
    std::sort(data_.begin(), data_.end(), ordering(std::less<value_type>()));
  }
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().

                                   {
    std::sort(data_.begin(), data_.end(), ordering(comp));
  }
template<typename T, typename P>
void edm::OwnVector< T, P >::swap ( OwnVector< T, P > &  other) [inline]

Definition at line 400 of file OwnVector.h.

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

                                                                   {
    data_.swap(other.data_);
  }

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.