1 #ifndef Fireworks_Core_FWItemRandomAccessor_h
2 #define Fireworks_Core_FWItemRandomAccessor_h
32 const void *
data()
const override;
33 const TClass *
type()
const override;
39 void reset()
override;
71 template <
class C,
class V =
typename C::value_type>
85 return &(reinterpret_cast<container_type *>(
getDataPtr())->operator[](iIndex));
88 unsigned int size()
const override {
91 return reinterpret_cast<const container_type *>(
getDataPtr())->size();
102 template <
class C,
class COLL =
typename C::value_type,
class V =
typename COLL::value_type>
117 size_t collectionOffset = 0;
118 for (
typename container_type::const_iterator ci =
c->begin(), ce =
c->end(); ci != ce; ++ci) {
119 size_t i = iIndex - collectionOffset;
121 return &(ci->operator[](
i));
122 collectionOffset += ci->size();
128 unsigned int size()
const override {
132 size_t finalSize = 0;
134 for (
typename container_type::const_iterator
i =
c->begin(),
e =
c->end();
i !=
e; ++
i)
135 finalSize +=
i->size();
143 template <
class C,
class COLL =
typename C::value_type,
class V =
typename COLL::value_type>
161 return &(
c->data().operator[](iIndex));
164 unsigned int size()
const override {
168 return c->dataSize();
172 template <
class C,
class R =
typename C::Range,
class V =
typename R::value_type>
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;
192 collectionOffset += ci->size();
198 unsigned int size()
const override {
202 size_t finalSize = 0;
204 for (
typename range_type::const_iterator ci =
c->begin(), ce =
c->end(); ci != ce; ++ci)
211 template <
class C,
class V>
225 size_t collectionOffset = 0;
227 for (
typename container_type::DigiRangeIterator ci =
c->begin(), ce =
c->end(); ci != ce; ++ci) {
228 int i = iIndex - collectionOffset;
233 return &(*(vt.second.first +
i));
234 collectionOffset +=
std::distance(vt.second.first, vt.second.second);
240 unsigned int size()
const override {
244 size_t finalSize = 0;
246 for (
typename container_type::DigiRangeIterator ci =
c->begin(), ce =
c->end(); ci != ce; ++ci) {
248 finalSize +=
std::distance(vt.second.first, vt.second.second);
270 return &(
c->at(0, iIndex));
273 unsigned int size()
const override {