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

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

Definition at line 195 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 215 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 343 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(), 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 359 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 251 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 394 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 387 of file OwnVector.h.

References b, 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 268 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 257 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 406 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 414 of file OwnVector.h.

References b, 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<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 516 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 440 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().

                                                               {
    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 186 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 381 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 338 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 220 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 279 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 273 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 181 of file OwnVector.h.

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

Definition at line 329 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 315 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 291 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(), 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(), cms::TrackListMerger::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(), 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;
    touch();
  }
template<typename T, typename P >
void edm::OwnVector< T, P >::push_back ( T const &  valueToCopy) [inline]

Definition at line 322 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 302 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 497 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]
template<typename T , typename P >
template<typename S >
void edm::OwnVector< T, P >::sort ( s)

Definition at line 424 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 429 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 187 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]