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 189 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 192 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 193 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 194 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 196 of file FWItemRandomAccessor.h.

197  : FWItemRandomAccessorBase(iClass, typeid(value_type))
198  {}
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 202 of file FWItemRandomAccessor.h.

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

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

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

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