CMS 3D CMS Logo

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

Static Public Member Functions

static const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 

Additional Inherited Members

- Protected Member Functions inherited from FWItemRandomAccessorBase
 FWItemRandomAccessorBase (const TClass *type, const std::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 173 of file FWItemRandomAccessor.h.

Member Typedef Documentation

◆ container_type

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 175 of file FWItemRandomAccessor.h.

◆ range_type

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 176 of file FWItemRandomAccessor.h.

◆ value_type

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 177 of file FWItemRandomAccessor.h.

Constructor & Destructor Documentation

◆ FWItemRangeAccessor()

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 179 of file FWItemRandomAccessor.h.

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

Member Function Documentation

◆ classPurpose()

template<class C , class R = typename C::Range, class V = typename R::value_type>
static const std::string& FWItemRangeAccessor< C, R, V >::classPurpose ( )
static

◆ classRegisterTypeName()

template<class C , class R = typename C::Range, class V = typename R::value_type>
static const std::string& FWItemRangeAccessor< C, R, V >::classRegisterTypeName ( )
static

◆ classTypeName()

template<class C , class R = typename C::Range, class V = typename R::value_type>
static const std::string& FWItemRangeAccessor< C, R, V >::classTypeName ( )
static

◆ modelData()

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

Implements FWItemAccessorBase.

Definition at line 183 of file FWItemRandomAccessor.h.

183  {
184  if (!getDataPtr())
185  return nullptr;
186  const container_type *c = reinterpret_cast<const container_type *>(getDataPtr());
187  size_t collectionOffset = 0;
188  for (typename container_type::const_iterator ci = c->begin(), ce = c->end(); ci != ce; ++ci) {
189  size_t i = iIndex - collectionOffset;
190  if (i < std::distance(ci->first, ci->second))
191  return &(*(ci + i));
192  collectionOffset += ci->size();
193  }
194 
195  return nullptr;
196  }

References c, HLT_FULL_cff::distance, FWItemRandomAccessorBase::getDataPtr(), and mps_fire::i.

◆ purpose()

template<class C , class R = typename C::Range, class V = typename R::value_type>
const std::string& FWItemRangeAccessor< C, R, V >::purpose ( ) const
inline

Definition at line 181 of file FWItemRandomAccessor.h.

183 {

◆ size()

template<class C , class R = typename C::Range, class V = typename R::value_type>
unsigned int FWItemRangeAccessor< C, R, V >::size ( void  ) const
inlineoverridevirtual

Implements FWItemAccessorBase.

Definition at line 198 of file FWItemRandomAccessor.h.

198  {
199  if (!getDataPtr())
200  return 0;
201  const container_type *c = reinterpret_cast<const container_type *>(getDataPtr());
202  size_t finalSize = 0;
203 
204  for (typename range_type::const_iterator ci = c->begin(), ce = c->end(); ci != ce; ++ci)
205  finalSize += std::distance(ci->first, ci->second);
206 
207  return finalSize;
208  }

References c, HLT_FULL_cff::distance, and FWItemRandomAccessorBase::getDataPtr().

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ typeName()

template<class C , class R = typename C::Range, class V = typename R::value_type>
const std::string& FWItemRangeAccessor< C, R, V >::typeName ( ) const
inline

Definition at line 181 of file FWItemRandomAccessor.h.

183 {
mps_fire.i
i
Definition: mps_fire.py:428
FWItemRangeAccessor::container_type
C container_type
Definition: FWItemRandomAccessor.h:175
FWItemRandomAccessorBase::getDataPtr
void * getDataPtr() const
Definition: FWItemRandomAccessor.cc:66
FWItemRandomAccessorBase::FWItemRandomAccessorBase
FWItemRandomAccessorBase(const TClass *type, const std::type_info &modelTypeName)
Definition: FWItemRandomAccessor.cc:24
FWItemRangeAccessor::value_type
V value_type
Definition: FWItemRandomAccessor.h:177
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7746