CMS 3D CMS Logo

edm::RefGetter< T > Class Template Reference

#include <DataFormats/Common/interface/RefGetter.h>

List of all members.

Public Types

typedef std::vector< region_refcollection_type
typedef
boost::indirect_iterator
< typename
collection_type::const_iterator > 
const_iterator
typedef std::pair< typename
record_type::const_iterator,
typename
record_type::const_iterator > 
record_pair
typedef std::vector< T > record_type
typedef Ref< LazyGetter< T >,
RegionIndex< T >, FindRegion
< T > > 
region_ref

Public Member Functions

const RegionIndex< T > & back () const
 Returns a reference to the last RegionIndex<T> added to the collection, or throws an exception if empty.
const_iterator begin () const
 Return an iterator to the first RegionIndex<T>.
bool empty () const
 Return true if we contain no 'region_ref's (one per Region).
const_iterator end () const
 Return the off-the-end iterator.
bool find (uint32_t) const
 Returns true if region already defined.
const RegionIndex< T > & operator[] (uint32_t) const
 Return a reference to the RegionIndex<T> for a given region.
void push_back (const edm::Handle< LazyGetter< T > > &, const uint32_t &)
 Add a new region to the end of the collection.
 RefGetter (const edm::Handle< LazyGetter< T > > &, const std::vector< uint32_t > &)
 Constructor with regions and Handle.
 RefGetter (uint32_t=50000)
 Default constructor. Default maximum region number 50,000.
void reserve (uint32_t)
 Reserve memory for sets_ collection.
uint32_t size () const
 Return the number of contained 'region_ref's (one per Region).
void swap (RefGetter &other)
 Swap contents of class.

Private Member Functions

 BOOST_CLASS_REQUIRE (T, boost, LessThanComparableConcept)

Private Attributes

std::vector< uint32_t > regions_
collection_type sets_


Detailed Description

template<class T>
class edm::RefGetter< T >

Definition at line 20 of file RefGetter.h.


Member Typedef Documentation

template<class T>
typedef std::vector<region_ref> edm::RefGetter< T >::collection_type

Definition at line 26 of file RefGetter.h.

template<class T>
typedef boost::indirect_iterator<typename collection_type::const_iterator> edm::RefGetter< T >::const_iterator

Definition at line 27 of file RefGetter.h.

template<class T>
typedef std::pair<typename record_type::const_iterator, typename record_type::const_iterator> edm::RefGetter< T >::record_pair

Definition at line 29 of file RefGetter.h.

template<class T>
typedef std::vector<T> edm::RefGetter< T >::record_type

Definition at line 28 of file RefGetter.h.

template<class T>
typedef Ref< LazyGetter<T>, RegionIndex<T>, FindRegion<T> > edm::RefGetter< T >::region_ref

Definition at line 25 of file RefGetter.h.


Constructor & Destructor Documentation

template<class T>
edm::RefGetter< T >::RefGetter ( uint32_t  maxindex = 50000  )  [inline]

Default constructor. Default maximum region number 50,000.

Definition at line 76 of file RefGetter.h.

00076                                              : sets_(), regions_(maxindex/32+1,0)
00077     {}

template<class T>
edm::RefGetter< T >::RefGetter ( const edm::Handle< LazyGetter< T > > &  getter,
const std::vector< uint32_t > &  interest 
) [inline]

Constructor with regions and Handle.

Definition at line 81 of file RefGetter.h.

References index, and edm::RefGetter< T >::sets_.

00081                                                                                                         : sets_(), regions_(getter->regions()/32+1,0) 
00082     {
00083       sets_.reserve(interest.size());
00084       for (uint32_t index=0;index<interest.size();index++) {
00085         sets_.push_back(region_ref(getter,interest[index],false));
00086       }
00087     }


Member Function Documentation

template<class T>
const RegionIndex< T > & edm::RefGetter< T >::back (  )  const [inline]

Returns a reference to the last RegionIndex<T> added to the collection, or throws an exception if empty.

Definition at line 144 of file RefGetter.h.

References edm::lazydetail::_throw_range(), edm::RefGetter< T >::empty(), and edm::RefGetter< T >::size().

00145     {
00146       if (empty()) edm::lazydetail::_throw_range(0);
00147       return (*this)[size()-1];
00148     } 

template<class T>
RefGetter< T >::const_iterator edm::RefGetter< T >::begin (  )  const [inline]

Return an iterator to the first RegionIndex<T>.

Definition at line 153 of file RefGetter.h.

References edm::RefGetter< T >::sets_.

00154     {
00155       return sets_.begin();
00156     }

template<class T>
edm::RefGetter< T >::BOOST_CLASS_REQUIRE ( ,
boost  ,
LessThanComparableConcept   
) [private]

template<class T>
bool edm::RefGetter< T >::empty (  )  const [inline]

Return true if we contain no 'region_ref's (one per Region).

Definition at line 118 of file RefGetter.h.

References edm::RefGetter< T >::sets_.

Referenced by edm::RefGetter< T >::back().

00119     {
00120       return sets_.empty();
00121     }

template<class T>
RefGetter< T >::const_iterator edm::RefGetter< T >::end (  )  const [inline]

Return the off-the-end iterator.

Definition at line 161 of file RefGetter.h.

References edm::RefGetter< T >::sets_.

Referenced by SiStripRecHitConverterAlgorithm::run().

00162     {
00163       return sets_.end();
00164     }

template<class T>
bool edm::RefGetter< T >::find ( uint32_t  index  )  const [inline]

Returns true if region already defined.

Definition at line 169 of file RefGetter.h.

References edm::RefGetter< T >::regions_.

Referenced by SiStripRegionCabling::updateSiStripRefGetter().

00170     {
00171       return (regions_[index/32]>>(index%32))&1;
00172     }

template<class T>
const RegionIndex< T > & edm::RefGetter< T >::operator[] ( uint32_t  index  )  const [inline]

Return a reference to the RegionIndex<T> for a given region.

Definition at line 134 of file RefGetter.h.

References edm::lazydetail::_throw_range(), it, edm::RefGetter< T >::sets_, and edm::RefGetter< T >::size().

00135     {
00136       if (size() < index+1) edm::lazydetail::_throw_range(index);
00137       const_iterator it = sets_.begin()+index;
00138       return *it;
00139     }

template<class T>
void edm::RefGetter< T >::push_back ( const edm::Handle< LazyGetter< T > > &  getter,
const uint32_t &  index 
) [inline]

Add a new region to the end of the collection.

Definition at line 109 of file RefGetter.h.

References edm::RefGetter< T >::regions_, and edm::RefGetter< T >::sets_.

Referenced by EcalRegionCabling::updateEcalRefGetterWithElementIndex(), and SiStripRegionCabling::updateSiStripRefGetter().

00110      {
00111        sets_.push_back(region_ref(getter, index, false));
00112        regions_[index/32] = regions_[index/32]|(1<<index%32);
00113      }

template<class T>
void edm::RefGetter< T >::reserve ( uint32_t  size  )  [inline]

Reserve memory for sets_ collection.

Definition at line 92 of file RefGetter.h.

References edm::RefGetter< T >::sets_.

00093     {
00094       sets_.reserve(size);
00095     }

template<class T>
uint32_t edm::RefGetter< T >::size ( void   )  const [inline]

Return the number of contained 'region_ref's (one per Region).

Definition at line 126 of file RefGetter.h.

References edm::RefGetter< T >::sets_.

Referenced by edm::RefGetter< T >::back(), and edm::RefGetter< T >::operator[]().

00127     {
00128       return sets_.size();
00129     }

template<class T>
void edm::RefGetter< T >::swap ( RefGetter< T > &  other  )  [inline]

Swap contents of class.

Definition at line 100 of file RefGetter.h.

References edm::RefGetter< T >::regions_, and edm::RefGetter< T >::sets_.

Referenced by edm::swap().

00101     {
00102       sets_.swap(other.sets_);
00103       regions_.swap(other.regions_);
00104     }


Member Data Documentation

template<class T>
std::vector<uint32_t> edm::RefGetter< T >::regions_ [private]

Definition at line 71 of file RefGetter.h.

Referenced by edm::RefGetter< T >::find(), edm::RefGetter< T >::push_back(), and edm::RefGetter< T >::swap().

template<class T>
collection_type edm::RefGetter< T >::sets_ [private]

Definition at line 70 of file RefGetter.h.

Referenced by edm::RefGetter< T >::begin(), edm::RefGetter< T >::empty(), edm::RefGetter< T >::end(), edm::RefGetter< T >::operator[](), edm::RefGetter< T >::push_back(), edm::RefGetter< T >::RefGetter(), edm::RefGetter< T >::reserve(), edm::RefGetter< T >::size(), and edm::RefGetter< T >::swap().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:43:31 2009 for CMSSW by  doxygen 1.5.4