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 T * pointer
typedef P policy_type
typedef T & reference
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 (const std::type_info &toType, const std::vector< unsigned long > &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)
 ~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 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 188 of file OwnVector.h.

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

Definition at line 192 of file OwnVector.h.

                                               : data_(n) {
  }
template<typename T , typename P >
edm::OwnVector< T, P >::OwnVector ( OwnVector< T, P > const &  o) [inline]
template<typename T , typename P >
edm::OwnVector< T, P >::~OwnVector ( ) [inline]

Definition at line 212 of file OwnVector.h.

References matplotRender::destroy().

                                     {
    destroy();
  }

Member Function Documentation

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

Definition at line 340 of file OwnVector.h.

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

Referenced by SeedFromProtoTrack::init(), SeedCombiner::produce(), cms::SimpleTrackListMerger::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");
    }
    fixup();
    touch();
    return *data_.back();
  }
template<typename T , typename P >
OwnVector< T, P >::const_reference edm::OwnVector< T, P >::back ( ) const [inline]

Definition at line 356 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");
    }
    fixup();
    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 248 of file OwnVector.h.

                                                                             {
    fixup();
    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 391 of file OwnVector.h.

Referenced by SiTrackerMultiRecHit::recHits().

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

Definition at line 384 of file OwnVector.h.

References b, ExpressReco_HICollisions_FallBack::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 265 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 254 of file OwnVector.h.

                                                                           {
    fixup();
    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 403 of file OwnVector.h.

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

                                                                      {
    fixup();
    touch();
    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 411 of file OwnVector.h.

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

                                                                                       {
    fixup();
    touch();
    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<class T , class P >
void edm::OwnVector< T, P >::fillPtrVector ( const std::type_info &  toType,
const std::vector< unsigned long > &  indices,
std::vector< void const * > &  ptrs 
) const [inline]

Definition at line 517 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 437 of file OwnVector.h.

References ExpressReco_HICollisions_FallBack::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 = ClonePolicy<T>>
void edm::OwnVector< T, P >::fixup ( ) const [inline, private]

Definition at line 183 of file OwnVector.h.

{ fixup_(data_); }
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 378 of file OwnVector.h.

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

Definition at line 335 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 217 of file OwnVector.h.

References edm::swap(), and cond::rpcobtemp::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 276 of file OwnVector.h.

References n.

                                                                                              {
    fixup();
    return *data_[n];
  }
template<typename T , typename P >
OwnVector< T, P >::reference edm::OwnVector< T, P >::operator[] ( size_type  n) [inline]

Definition at line 270 of file OwnVector.h.

References n.

                                                                                  {
    fixup();
    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 178 of file OwnVector.h.

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

Definition at line 326 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();
    touch();
  }
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( std::auto_ptr< D >  d) [inline]

Definition at line 312 of file OwnVector.h.

                                                         {
    data_.push_back(d.release());
    touch();
  }
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *&  d) [inline]

Definition at line 288 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(), MuonSeedCreator::createSeed(), RPCSeedPattern::createSeed(), OutInConversionSeedFinder::createSeed(), InOutConversionSeedFinder::createSeed(), MuonSeedFromRecHits::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(), SeedCombiner::produce(), cms::SimpleTrackListMerger::produce(), L2MuonSeedGenerator::produce(), TrajectorySeedFromMuonProducer::produce(), TrackCandidateProducer::produce(), TrackCandidateTopBottomHitFilter::produce(), DTSegment4DT0Corrector::produce(), SETMuonSeedProducer::produce(), TrackerToMuonPropagator::produce(), TrajectorySeedProducer::produce(), ConvBremSeedProducer::produce(), cms::CosmicTrackFinder::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(), 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;
    touch();
  }
template<typename T, typename P >
void edm::OwnVector< T, P >::push_back ( T const &  valueToCopy) [inline]

Definition at line 319 of file OwnVector.h.

References clone().

                                                   {
    data_.push_back(policy_type::clone(d));
    touch();
  }
template<typename T , typename P >
template<typename D >
void edm::OwnVector< T, P >::push_back ( D *const &  d) [inline]

Definition at line 299 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);
    touch();
  }
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().

  {
    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 260 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()(), 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(), SimpleTrackRefitter::refitTrack(), KalmanAlignmentTrackRefitter::refitTracks(), RoadSearchTrackCandidateMakerAlgorithm::run(), PFConversionAlgo::setLinks(), 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 >
template<typename S >
void edm::OwnVector< T, P >::sort ( s)

Definition at line 421 of file OwnVector.h.

References cmsCodeRules::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 >::sort ( )

Definition at line 426 of file OwnVector.h.

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

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

Definition at line 184 of file OwnVector.h.

{ fixup_.touch(); }

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]