CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends

edmNew::DetSetVector< T > Class Template Reference

#include <DetSetVectorNew.h>

Inheritance diagram for edmNew::DetSetVector< T >:
edmNew::dstvdetails::DetSetVectorTrans

List of all members.

Classes

class  FastFiller
class  FindForDetSetVector
struct  IterHelp

Public Types

typedef std::vector< data_type >
::const_iterator 
const_DataIter
typedef IdContainer::const_iterator const_IdIter
typedef
boost::transform_iterator
< IterHelp, const_IdIter
const_iterator
typedef std::pair
< const_IdIter, const_DataIter
const_IterPair
typedef T data_type
typedef std::vector< data_typeDataContainer
typedef std::vector< data_type >
::iterator 
DataIter
typedef edmNew::DetSet< TDetSet
typedef dslv::LazyGetter< TGetter
typedef unsigned int id_type
typedef std::vector< ItemIdContainer
typedef IdContainer::iterator IdIter
typedef Trans::Item Item
typedef std::pair< IdIter,
DataIter
IterPair
typedef id_type key_type
typedef std::pair
< const_iterator,
const_iterator
Range
typedef
edm::refhelper::FindForNewDetSetVector
< data_type
RefFinder
typedef edmNew::DetSetVector< Tself
typedef unsigned int size_type
typedef
dstvdetails::DetSetVectorTrans 
Trans
typedef DetSet value_type

Public Member Functions

const_iterator begin () const
data_type const * data (size_t cell) const
DataContainer const & data () const
size_type dataSize () const
size_type detsetSize (size_t cell) const
 DetSetVector (boost::shared_ptr< dslv::LazyGetter< T > > iGetter, const std::vector< det_id_type > &iDets, int isubdet=0)
 DetSetVector (int isubdet=0)
bool empty () const
const_iterator end () const
template<typename CMP >
Range equal_range (id_type i, CMP cmp) const
bool exists (id_type i) const
const_iterator find (id_type i) const
const_IdIter findItem (id_type i) const
id_type id (size_t cell) const
DetSet insert (id_type iid, data_type const *idata, size_type isize)
DetSet insert (id_type iid, size_type isize)
bool isValid (id_type i) const
Item const & item (size_t cell) const
data_type operator() (size_t cell, size_t frame) const
DetSet operator[] (id_type i) const
void pop_back (id_type iid)
Itempush_back (id_type iid)
void reserve (size_t isize, size_t dsize)
void resize (size_t isize, size_t dsize)
size_type size () const
int subdetId () const
void swap (DetSetVector &rh)
void swap (IdContainer &iic, DataContainer &idc)
void update (Item const &item) const
 ~DetSetVector ()

Private Member Functions

ItemaddItem (id_type iid, size_type isize)
void updateImpl (Item &item)

Private Attributes

DataContainer m_data
IdContainer m_ids
int m_subdetId

Friends

class FastFiller
class FindForDetSetVector

Detailed Description

template<typename T>
class edmNew::DetSetVector< T >

an optitimized container that linearized a "map of vector". It corresponds to a set of variable size array of T each belonging to a "Det" identified by an 32bit id

FIXME interface to be finalized once use-cases fully identified

although it is sorted internally it is strongly adviced to fill it already sorted....

Definition at line 66 of file DetSetVectorNew.h.


Member Typedef Documentation

template<typename T>
typedef std::vector<data_type>::const_iterator edmNew::DetSetVector< T >::const_DataIter

Definition at line 87 of file DetSetVectorNew.h.

template<typename T>
typedef IdContainer::const_iterator edmNew::DetSetVector< T >::const_IdIter

Definition at line 86 of file DetSetVectorNew.h.

template<typename T>
typedef boost::transform_iterator<IterHelp,const_IdIter> edmNew::DetSetVector< T >::const_iterator

Definition at line 106 of file DetSetVectorNew.h.

template<typename T>
typedef std::pair<const_IdIter,const_DataIter> edmNew::DetSetVector< T >::const_IterPair

Definition at line 88 of file DetSetVectorNew.h.

template<typename T>
typedef T edmNew::DetSetVector< T >::data_type

Definition at line 72 of file DetSetVectorNew.h.

template<typename T>
typedef std::vector<data_type> edmNew::DetSetVector< T >::DataContainer

Definition at line 82 of file DetSetVectorNew.h.

template<typename T>
typedef std::vector<data_type>::iterator edmNew::DetSetVector< T >::DataIter

Definition at line 84 of file DetSetVectorNew.h.

template<typename T>
typedef edmNew::DetSet<T> edmNew::DetSetVector< T >::DetSet

Definition at line 74 of file DetSetVectorNew.h.

template<typename T>
typedef dslv::LazyGetter<T> edmNew::DetSetVector< T >::Getter

Definition at line 75 of file DetSetVectorNew.h.

template<typename T>
typedef unsigned int edmNew::DetSetVector< T >::id_type

Reimplemented from edmNew::dstvdetails::DetSetVectorTrans.

Definition at line 71 of file DetSetVectorNew.h.

template<typename T>
typedef std::vector<Item> edmNew::DetSetVector< T >::IdContainer

Definition at line 81 of file DetSetVectorNew.h.

template<typename T>
typedef IdContainer::iterator edmNew::DetSetVector< T >::IdIter

Definition at line 83 of file DetSetVectorNew.h.

template<typename T>
typedef Trans::Item edmNew::DetSetVector< T >::Item

Definition at line 69 of file DetSetVectorNew.h.

template<typename T>
typedef std::pair<IdIter,DataIter> edmNew::DetSetVector< T >::IterPair

Definition at line 85 of file DetSetVectorNew.h.

template<typename T>
typedef id_type edmNew::DetSetVector< T >::key_type

Definition at line 78 of file DetSetVectorNew.h.

template<typename T>
typedef std::pair<const_iterator,const_iterator> edmNew::DetSetVector< T >::Range

Definition at line 107 of file DetSetVectorNew.h.

template<typename T>
typedef edm::refhelper::FindForNewDetSetVector<data_type> edmNew::DetSetVector< T >::RefFinder

Definition at line 90 of file DetSetVectorNew.h.

template<typename T>
typedef edmNew::DetSetVector<T> edmNew::DetSetVector< T >::self

Definition at line 73 of file DetSetVectorNew.h.

template<typename T>
typedef unsigned int edmNew::DetSetVector< T >::size_type

Reimplemented from edmNew::dstvdetails::DetSetVectorTrans.

Definition at line 70 of file DetSetVectorNew.h.

template<typename T>
typedef dstvdetails::DetSetVectorTrans edmNew::DetSetVector< T >::Trans

Definition at line 68 of file DetSetVectorNew.h.

template<typename T>
typedef DetSet edmNew::DetSetVector< T >::value_type

Definition at line 77 of file DetSetVectorNew.h.


Constructor & Destructor Documentation

template<typename T>
edmNew::DetSetVector< T >::DetSetVector ( int  isubdet = 0) [inline, explicit]

Definition at line 181 of file DetSetVectorNew.h.

                                         :
      m_subdetId(isubdet) {}
template<typename T >
edmNew::DetSetVector< T >::DetSetVector ( boost::shared_ptr< dslv::LazyGetter< T > >  iGetter,
const std::vector< det_id_type > &  iDets,
int  isubdet = 0 
) [inline]

Definition at line 389 of file DetSetVectorNew.h.

References edmNew::dstvdetails::DetSetVectorTrans::getter, and edmNew::DetSetVector< T >::m_ids.

                                                   :  
    m_subdetId(isubdet) {
    getter=iGetter;

    m_ids.reserve(iDets.size());
    det_id_type sanityCheck = 0;
    for(std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end();
        itDetId != itDetIdEnd;
        ++itDetId) {
      assert(sanityCheck < *itDetId && "vector of det_id_type was not ordered");
      sanityCheck = *itDetId;
      m_ids.push_back(*itDetId);
    }
  }
template<typename T>
edmNew::DetSetVector< T >::~DetSetVector ( ) [inline]

Definition at line 188 of file DetSetVectorNew.h.

                    {
      // delete content if T is pointer...
    }

Member Function Documentation

template<typename T>
Item& edmNew::DetSetVector< T >::addItem ( id_type  iid,
size_type  isize 
) [inline, private]

Definition at line 245 of file DetSetVectorNew.h.

References edmNew::dstvdetails::errorIdExists(), edmNew::DetSetVector< T >::m_data, edmNew::DetSetVector< T >::m_ids, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by edmNew::DetSetVector< T >::insert(), and edmNew::DetSetVector< T >::push_back().

                                                  {
      Item it(iid,size_type(m_data.size()),isize);
      IdIter p = std::lower_bound(m_ids.begin(),
                                  m_ids.end(),
                                  it);
      if (p!=m_ids.end() && !(it<*p)) dstvdetails::errorIdExists(iid);
      return *m_ids.insert(p,it);
    }
template<typename T>
const_iterator edmNew::DetSetVector< T >::begin ( void  ) const [inline]
template<typename T>
data_type const* edmNew::DetSetVector< T >::data ( size_t  cell) const [inline]
template<typename T>
DataContainer const& edmNew::DetSetVector< T >::data ( ) const [inline]

Definition at line 353 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data.

{ return  m_data;}
template<typename T>
size_type edmNew::DetSetVector< T >::dataSize ( ) const [inline]
template<typename T>
size_type edmNew::DetSetVector< T >::detsetSize ( size_t  cell) const [inline]

Definition at line 340 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_ids.

{ return  m_ids[cell].size; }
template<typename T>
bool edmNew::DetSetVector< T >::empty ( ) const [inline]

Definition at line 323 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_ids.

Referenced by MeasurementTrackerImpl::updatePixels().

{ return m_ids.empty();}
template<typename T>
const_iterator edmNew::DetSetVector< T >::end ( void  ) const [inline]
template<typename T>
template<typename CMP >
Range edmNew::DetSetVector< T >::equal_range ( id_type  i,
CMP  cmp 
) const [inline]

Definition at line 313 of file DetSetVectorNew.h.

References i, edmNew::DetSetVector< T >::m_ids, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by edmNew::DetSetVector< T >::findItem().

                                                {
      std::pair<const_IdIter,const_IdIter> p =
        std::equal_range(m_ids.begin(),m_ids.end(),i,cmp);
      return  Range(boost::make_transform_iterator(p.first,IterHelp(*this)),
                    boost::make_transform_iterator(p.second,IterHelp(*this))
                    );
    }
template<typename T>
bool edmNew::DetSetVector< T >::exists ( id_type  i) const [inline]

Definition at line 261 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::findItem(), and edmNew::DetSetVector< T >::m_ids.

                                  {
      return  findItem(i)!=m_ids.end(); 
    }
template<typename T>
const_iterator edmNew::DetSetVector< T >::find ( id_type  i) const [inline]
template<typename T>
const_IdIter edmNew::DetSetVector< T >::findItem ( id_type  i) const [inline]
template<typename T>
id_type edmNew::DetSetVector< T >::id ( size_t  cell) const [inline]
template<typename T>
DetSet edmNew::DetSetVector< T >::insert ( id_type  iid,
data_type const *  idata,
size_type  isize 
) [inline]

Definition at line 214 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::addItem(), edmNew::copy(), edmNew::DetSetVector< T >::item(), edmNew::DetSetVector< T >::m_data, and edmNew::dstvdetails::DetSetVectorTrans::Item::offset.

                                                                         {
      Item & item = addItem(iid,isize);
      m_data.resize(m_data.size()+isize);
      std::copy(idata,idata+isize,m_data.begin()+item.offset);
     return DetSet(*this,item);
    }
template<typename T>
DetSet edmNew::DetSetVector< T >::insert ( id_type  iid,
size_type  isize 
) [inline]

Definition at line 221 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::addItem(), edmNew::DetSetVector< T >::item(), and edmNew::DetSetVector< T >::m_data.

                                                {
      Item & item = addItem(iid,isize);
      m_data.resize(m_data.size()+isize);
      return DetSet(*this,item);
    }
template<typename T>
bool edmNew::DetSetVector< T >::isValid ( id_type  i) const [inline]

Definition at line 265 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::findItem(), edmNew::DetSetVector< T >::m_ids, and AlCaHLTBitMon_ParallelJobs::p.

                                  {
      const_IdIter p = findItem(i);
      return p!=m_ids.end() && (*p).offset!=-1;
    }
template<typename T>
Item const& edmNew::DetSetVector< T >::item ( size_t  cell) const [inline]

Definition at line 346 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_ids.

Referenced by edmNew::DetSetVector< T >::insert().

                                         {
      return m_ids[cell];
    }
template<typename T>
data_type edmNew::DetSetVector< T >::operator() ( size_t  cell,
size_t  frame 
) const [inline]

Definition at line 332 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data, and edmNew::DetSetVector< T >::m_ids.

                                                          {
      return m_data[m_ids[cell].offset+frame];
    }
template<typename T>
DetSet edmNew::DetSetVector< T >::operator[] ( id_type  i) const [inline]
template<typename T>
void edmNew::DetSetVector< T >::pop_back ( id_type  iid) [inline]

Definition at line 233 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::findItem(), edmNew::DetSetVector< T >::m_data, edmNew::DetSetVector< T >::m_ids, and AlCaHLTBitMon_ParallelJobs::p.

                               {
      const_IdIter p = findItem(iid);
      if (p==m_ids.end()) return; //bha!
      // sanity checks...  (shall we throw or assert?)
      if ((*p).size>0&& (*p).offset>-1 && 
          m_data.size()==(*p).offset+(*p).size)
        m_data.resize((*p).offset);
      m_ids.erase( m_ids.begin()+(p-m_ids.begin()));
    }
template<typename T>
Item& edmNew::DetSetVector< T >::push_back ( id_type  iid) [inline]

Definition at line 228 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::addItem().

                                  {
      return addItem(iid,0);
    }
template<typename T>
void edmNew::DetSetVector< T >::reserve ( size_t  isize,
size_t  dsize 
) [inline]

Definition at line 203 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data, and edmNew::DetSetVector< T >::m_ids.

                                             {
      m_ids.reserve(isize);
      m_data.reserve(dsize);
    }
template<typename T>
void edmNew::DetSetVector< T >::resize ( size_t  isize,
size_t  dsize 
) [inline]

Definition at line 208 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data, and edmNew::DetSetVector< T >::m_ids.

                                            {
      m_ids.resize(isize);
      m_data.resize(dsize);
    }
template<typename T>
size_type edmNew::DetSetVector< T >::size ( void  ) const [inline]
template<typename T>
int edmNew::DetSetVector< T >::subdetId ( ) const [inline]

Definition at line 321 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_subdetId.

{ return m_subdetId; }
template<typename T>
void edmNew::DetSetVector< T >::swap ( DetSetVector< T > &  rh) [inline]
template<typename T>
void edmNew::DetSetVector< T >::swap ( IdContainer iic,
DataContainer idc 
) [inline]
template<typename T>
void edmNew::DetSetVector< T >::update ( Item const &  item) const [inline]

Definition at line 356 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::updateImpl().

                                         {
      const_cast<self*>(this)->updateImpl(const_cast<Item&>(item));
    }
template<typename T >
void edmNew::DetSetVector< T >::updateImpl ( Item item) [inline, private]

Definition at line 407 of file DetSetVectorNew.h.

References alignCSCRings::ff, and edmNew::dstvdetails::DetSetVectorTrans::Item::offset.

Referenced by edmNew::DetSetVector< T >::update().

                                                      {
    // no getter or already updated
    if (getter.empty() || item.offset!=-1) return;
    item.offset = int(m_data.size());
    FastFiller ff(*this,item);
    (*boost::any_cast<boost::shared_ptr<Getter> >(&getter))->fill(ff);
  }

Friends And Related Function Documentation

template<typename T>
friend class FastFiller [friend]

Definition at line 170 of file DetSetVectorNew.h.

template<typename T>
friend class FindForDetSetVector [friend]

Definition at line 179 of file DetSetVectorNew.h.


Member Data Documentation

template<typename T>
DataContainer edmNew::DetSetVector< T >::m_data [private]
template<typename T>
IdContainer edmNew::DetSetVector< T >::m_ids [private]
template<typename T>
int edmNew::DetSetVector< T >::m_subdetId [private]