CMS 3D CMS Logo

Public Types | Public Member Functions

FWItemRangeAccessor< C, R, V > Class Template Reference

#include <FWItemRandomAccessor.h>

Inheritance diagram for FWItemRangeAccessor< C, R, V >:
FWItemRandomAccessorBase FWItemAccessorBase

List of all members.

Public Types

typedef C container_type
typedef R range_type
typedef V value_type

Public Member Functions

 FWItemRangeAccessor (const TClass *iClass)
const void * modelData (int iIndex) const
 REGISTER_FWITEMACCESSOR_METHODS ()
unsigned int size () const

Detailed Description

template<class C, class R = typename C::Range, class V = typename R::value_type>
class FWItemRangeAccessor< C, R, V >

Definition at line 190 of file FWItemRandomAccessor.h.


Member Typedef Documentation

template<class C , class R = typename C::Range, class V = typename R::value_type>
typedef C FWItemRangeAccessor< C, R, V >::container_type

Definition at line 193 of file FWItemRandomAccessor.h.

template<class C , class R = typename C::Range, class V = typename R::value_type>
typedef R FWItemRangeAccessor< C, R, V >::range_type

Definition at line 194 of file FWItemRandomAccessor.h.

template<class C , class R = typename C::Range, class V = typename R::value_type>
typedef V FWItemRangeAccessor< C, R, V >::value_type

Definition at line 195 of file FWItemRandomAccessor.h.


Constructor & Destructor Documentation

template<class C , class R = typename C::Range, class V = typename R::value_type>
FWItemRangeAccessor< C, R, V >::FWItemRangeAccessor ( const TClass *  iClass) [inline]

Definition at line 197 of file FWItemRandomAccessor.h.

      : FWItemRandomAccessorBase(iClass, typeid(value_type))
      {}

Member Function Documentation

template<class C , class R = typename C::Range, class V = typename R::value_type>
const void* FWItemRangeAccessor< C, R, V >::modelData ( int  iIndex) const [inline, virtual]

Implements FWItemAccessorBase.

Definition at line 203 of file FWItemRandomAccessor.h.

References trackerHits::c, FWItemRandomAccessorBase::getDataPtr(), and i.

      {
         if (!getDataPtr())
            return 0;
         const container_type *c = reinterpret_cast<const container_type*>(getDataPtr());
         size_t collectionOffset = 0;
         for (typename container_type::const_iterator ci = c->begin(), ce = c->end(); ci != ce; ++ci)
         {
            size_t i = iIndex - collectionOffset;
            if (i < std::distance(ci->first, ci->second))
               return &(*(ci + i));
            collectionOffset += ci->size();
         }

         return 0;
      }
template<class C , class R = typename C::Range, class V = typename R::value_type>
FWItemRangeAccessor< C, R, V >::REGISTER_FWITEMACCESSOR_METHODS ( )
template<class C , class R = typename C::Range, class V = typename R::value_type>
unsigned int FWItemRangeAccessor< C, R, V >::size ( void  ) const [inline, virtual]

Implements FWItemAccessorBase.

Definition at line 220 of file FWItemRandomAccessor.h.

References trackerHits::c, and FWItemRandomAccessorBase::getDataPtr().

      {
         if (!getDataPtr())
            return 0;
         const container_type *c = reinterpret_cast<const container_type*>(getDataPtr());
         size_t finalSize = 0;

         for (typename range_type::const_iterator ci = c->begin(), ce = c->end(); ci != ce; ++ci)
            finalSize += std::distance(ci->first, ci->second);

         return finalSize;
      }