CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions
FWItemRangeAccessor< C, R, V > Class Template Reference

#include <FWItemRandomAccessor.h>

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

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
 
- Public Member Functions inherited from FWItemRandomAccessorBase
const void * data () const
 
bool isCollection () const
 
const TClass * modelType () const
 
virtual void reset ()
 
void setData (const edm::ObjectWithDict &)
 override if id of an object should be different than the index More...
 
const TClass * type () const
 
virtual ~FWItemRandomAccessorBase ()
 
- Public Member Functions inherited from FWItemAccessorBase
 FWItemAccessorBase ()
 
virtual ~FWItemAccessorBase ()
 

Additional Inherited Members

- Protected Member Functions inherited from FWItemRandomAccessorBase
 FWItemRandomAccessorBase (const TClass *type, const type_info &modelTypeName)
 
void * getDataPtr () const
 
- Protected Attributes inherited from FWItemRandomAccessorBase
void * m_data
 
const TClass * m_modelType
 
const TClass * m_type
 

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.

198  : FWItemRandomAccessorBase(iClass, typeid(value_type))
199  {}
FWItemRandomAccessorBase(const TClass *type, const type_info &modelTypeName)

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
inlinevirtual

Implements FWItemAccessorBase.

Definition at line 203 of file FWItemRandomAccessor.h.

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

204  {
205  if (!getDataPtr())
206  return 0;
207  const container_type *c = reinterpret_cast<const container_type*>(getDataPtr());
208  size_t collectionOffset = 0;
209  for (typename container_type::const_iterator ci = c->begin(), ce = c->end(); ci != ce; ++ci)
210  {
211  size_t i = iIndex - collectionOffset;
212  if (i < std::distance(ci->first, ci->second))
213  return &(*(ci + i));
214  collectionOffset += ci->size();
215  }
216 
217  return 0;
218  }
int i
Definition: DBlmapReader.cc:9
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
inlinevirtual

Implements FWItemAccessorBase.

Definition at line 220 of file FWItemRandomAccessor.h.

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

221  {
222  if (!getDataPtr())
223  return 0;
224  const container_type *c = reinterpret_cast<const container_type*>(getDataPtr());
225  size_t finalSize = 0;
226 
227  for (typename range_type::const_iterator ci = c->begin(), ce = c->end(); ci != ce; ++ci)
228  finalSize += std::distance(ci->first, ci->second);
229 
230  return finalSize;
231  }