#include <FWItemRandomAccessor.h>
Public Types | |
typedef COLL | collection_type |
typedef V | collection_value_type |
typedef C | container_type |
Public Member Functions | |
FWItemDetSetAccessor (const TClass *iClass) | |
const void * | modelData (int iIndex) const |
REGISTER_FWITEMACCESSOR_METHODS () | |
unsigned int | size () const |
Generic class for creating accessors for containers which are implemented as a container of containers. This for example includes `DetSetVector` hence the name. Both the outer and the inner containers must follow the Random Access Container model and in particular must have a size() method. The outer collection must be iterable, while the inner collections must have an array subscript operator.
Definition at line 109 of file FWItemRandomAccessor.h.
typedef COLL FWItemDetSetAccessor< C, COLL, V >::collection_type |
Definition at line 113 of file FWItemRandomAccessor.h.
typedef V FWItemDetSetAccessor< C, COLL, V >::collection_value_type |
Definition at line 114 of file FWItemRandomAccessor.h.
typedef C FWItemDetSetAccessor< C, COLL, V >::container_type |
Definition at line 112 of file FWItemRandomAccessor.h.
FWItemDetSetAccessor< C, COLL, V >::FWItemDetSetAccessor | ( | const TClass * | iClass | ) | [inline] |
Definition at line 116 of file FWItemRandomAccessor.h.
: FWItemRandomAccessorBase(iClass, typeid(collection_value_type)) {}
const void* FWItemDetSetAccessor< C, COLL, V >::modelData | ( | int | iIndex | ) | const [inline, virtual] |
Implements FWItemAccessorBase.
Definition at line 122 of file FWItemRandomAccessor.h.
References trackerHits::c, FWItemRandomAccessorBase::getDataPtr(), i, and FWItemDetSetAccessor< C, COLL, V >::size().
{ 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 < ci->size()) return &(ci->operator[](i)); collectionOffset += ci->size(); } return 0; }
FWItemDetSetAccessor< C, COLL, V >::REGISTER_FWITEMACCESSOR_METHODS | ( | ) |
unsigned int FWItemDetSetAccessor< C, COLL, V >::size | ( | void | ) | const [inline, virtual] |
Implements FWItemAccessorBase.
Definition at line 139 of file FWItemRandomAccessor.h.
References trackerHits::c, alignCSCRings::e, FWItemRandomAccessorBase::getDataPtr(), and i.
Referenced by FWItemDetSetAccessor< C, COLL, V >::modelData().
{ if (!getDataPtr()) return 0; const container_type *c = reinterpret_cast<const container_type*>(getDataPtr()); size_t finalSize = 0; for (typename container_type::const_iterator i = c->begin(), e = c->end(); i != e; ++i) finalSize += i->size(); return finalSize; }