12 #ifndef ROOT_TCollectionProxyInfo 13 #define ROOT_TCollectionProxyInfo 26 #include <forward_list> 33 #define TYPENAME typename 36 #define TYPENAME typename 58 static const UInt_t fgIteratorArenaSize = 16;
68 static void*
get(
typename Cont_t::iterator &iter) {
69 return (
void*)&(*iter);
73 template <
typename Cont_t,
typename value_ptr>
struct IteratorValue<Cont_t, value_ptr*> {
74 static void*
get(
typename Cont_t::iterator &iter) {
75 return (
void*)(*iter);
86 template <
typename Cont_t,
bool large = false>
92 PCont_t
c = PCont_t(coll);
93 new (*begin_arena) iterator(c->begin());
94 new (*end_arena) iterator(c->end());
96 static void*
copy(
void *dest_arena,
const void *source_ptr) {
97 iterator *source = (iterator *)(source_ptr);
98 new (dest_arena) iterator(*source);
101 static void*
next(
void *iter_loc,
const void *end_loc) {
102 iterator *end = (iterator *)(end_loc);
103 iterator *iter = (iterator *)(iter_loc);
112 iterator *start = (iterator *)(iter_ptr);
116 iterator *start = (iterator *)(begin_ptr);
117 iterator *end = (iterator *)(end_ptr);
133 PCont_t
c = PCont_t(coll);
139 *begin_arena = &(*c->begin());
140 #ifdef R__VISUAL_CPLUSPLUS 141 *end_arena = &(*(c->end()-1)) + 1;
144 *end_arena = &(*c->end());
147 static void*
copy(
void *
dest,
const void *source) {
148 *(
void**)dest = *(
void**)(
const_cast<void*
>(source));
151 static void*
next(
void * ,
const void * ) {
160 R__ASSERT(0 &&
"Intentionally not implemented, do not use.");
171 template <
typename Cont_t>
struct Iterators<Cont_t, true > {
176 PCont_t
c = PCont_t(coll);
177 *begin_arena =
new iterator(c->begin());
178 *end_arena =
new iterator(c->end());
180 static void*
copy(
void * ,
const void *source_ptr) {
181 iterator *source = (iterator *)(source_ptr);
182 void *iter =
new iterator(*source);
185 static void*
next(
void *iter_loc,
const void *end_loc) {
186 iterator *end = (iterator *)(end_loc);
187 iterator *iter = (iterator *)(iter_loc);
196 iterator *start = (iterator *)(begin_ptr);
200 iterator *start = (iterator *)(begin_ptr);
201 iterator *end = (iterator *)(end_ptr);
222 EnvironBase() : fIdx(0), fSize(0), fObject(0), fStart(0), fTemp(0), fUseTemp(
kFALSE), fRefCount(1), fSpace(0)
249 template <
typename T>
struct Environ;
265 return const_cast<void*
>(
reinterpret_cast<const void*
>(&ref));
278 template <
class T,
class ALLOCATOR>
279 static size_t GetContainerSize(
const std::forward_list<T,ALLOCATOR>&
c) {
return std::distance(c.begin(),c.end());}
292 :
public Address<TYPENAME T::const_reference>
304 static inline PCont_t
object(
void* ptr) {
305 return PCont_t(PEnv_t(ptr)->fObject);
308 PEnv_t
e = PEnv_t(env);
309 e->
fSize = SfinaeHelper::GetContainerSize(*PCont_t(e->
fObject));
313 object(env)->clear();
317 PEnv_t
e = PEnv_t(env);
321 ::new(e->buff) Iter_t(c->begin());
324 e->
fSize = SfinaeHelper::GetContainerSize(*c);
330 PEnv_t
e = PEnv_t(env);
334 if ( e->
iter() == c->end() )
return 0;
339 PValue_t
m = PValue_t(what);
340 for (
size_t i=0; i<size; ++i, ++
m)
344 static void*
collect(
void *coll,
void *array) {
345 PCont_t
c = PCont_t(coll);
346 PValue_t
m = PValue_t(array);
347 for (Iter_t i=c->begin(); i != c->end(); ++i, ++
m )
348 ::
new(m) Value_t(*i);
352 PValue_t
m = PValue_t(what);
353 for (
size_t i=0; i < size; ++i, ++
m )
357 static const bool fgLargeIterator =
sizeof(
typename Cont_t::iterator) > fgIteratorArenaSize;
380 PCont_t
c = PCont_t(obj);
383 static void*
feed(
void *from,
void *to,
size_t size) {
384 PCont_t
c = PCont_t(to);
385 PValue_t
m = PValue_t(from);
386 for (
size_t i=0; i<size; ++i, ++
m)
413 PCont_t
c = PCont_t(obj);
416 static void*
feed(
void *from,
void *to,
size_t size) {
417 PCont_t
c = PCont_t(to);
418 if (size==0)
return 0;
419 PValue_t
m = &(PValue_t(from)[size-1]);
421 for (
size_t i=0; i<size; ++i, --
m){
448 static void*
feed(
void *from,
void *to,
size_t size) {
449 PCont_t
c = PCont_t(to);
450 PValue_t
m = PValue_t(from);
451 for (
size_t i=0; i<size; ++i, ++
m)
480 static void*
feed(
void *from,
void *to,
size_t size) {
481 PCont_t
c = PCont_t(to);
482 PValue_t
m = PValue_t(from);
483 for (
size_t i=0; i<size; ++i, ++
m)
491 return ((
char*)&((PValue_t(0x1000))->second)) - ((
char*)PValue_t(0x1000));
503 void* (*fSizeFunc)(
void*);
504 void (*fResizeFunc)(
void*,size_t);
505 void* (*fClearFunc)(
void*);
506 void* (*fFirstFunc)(
void*);
507 void* (*fNextFunc)(
void*);
508 void* (*fConstructFunc)(
void*,size_t);
509 void (*fDestructFunc)(
void*,size_t);
510 void* (*fFeedFunc)(
void*,
void*,size_t);
511 void* (*fCollectFunc)(
void*,
void*);
512 void* (*fCreateEnv)();
520 void* (*fCopyIterator)(
void *
dest,
const void *source);
525 void* (*fNext)(
void *iter,
const void *end);
531 void (*fDeleteSingleIterator)(
void *iter);
532 void (*fDeleteTwoIterators)(
void *begin,
void *end);
541 void* (*size_func)(
void*),
542 void (*resize_func)(
void*,
size_t),
543 void* (*clear_func)(
void*),
544 void* (*first_func)(
void*),
545 void* (*next_func)(
void*),
546 void* (*construct_func)(
void*,
size_t),
547 void (*destruct_func)(
void*,
size_t),
548 void* (*feed_func)(
void*,
void*,
size_t),
549 void* (*collect_func)(
void*,
void*),
550 void* (*create_env)(),
551 void (*getIterators)(
void *collection,
void **begin_arena,
void **end_arena,
TVirtualCollectionProxy *proxy) = 0,
552 void* (*copyIterator)(
void *dest,
const void *source) = 0,
553 void* (*next)(
void *iter,
const void *end) = 0,
554 void (*deleteSingleIterator)(
void *iter) = 0,
555 void (*deleteTwoIterators)(
void *begin,
void *end) = 0
557 fInfo(info), fIterSize(iter_size), fValueDiff(value_diff),
558 fValueOffset(value_offset),
559 fSizeFunc(size_func),fResizeFunc(resize_func),fClearFunc(clear_func),
560 fFirstFunc(first_func),fNextFunc(next_func),fConstructFunc(construct_func),
561 fDestructFunc(destruct_func),fFeedFunc(feed_func),fCollectFunc(collect_func),
562 fCreateEnv(create_env),
563 fCreateIterators(getIterators),fCopyIterator(copyIterator),fNext(next),
564 fDeleteSingleIterator(deleteSingleIterator),fDeleteTwoIterators(deleteTwoIterators)
591 T::Iterators_t::create,
592 T::Iterators_t::copy,
593 T::Iterators_t::next,
594 T::Iterators_t::destruct1,
595 T::Iterators_t::destruct2);
629 typedef std::vector<Bool_t>::iterator
Iter_t;
630 typedef std::vector<Bool_t>::value_type
Value_t;
638 static inline PCont_t
object(
void* ptr) {
639 return PCont_t(PEnv_t(ptr)->fObject);
642 PEnv_t
e = PEnv_t(env);
647 object(env)->clear();
651 PEnv_t
e = PEnv_t(env);
655 ::new(e->buff) Iter_t(c->begin());
658 e->
fSize = c->size();
662 PEnv_t
e = PEnv_t(env);
672 static void*
collect(
void *coll,
void *array) {
673 PCont_t
c = PCont_t(coll);
674 PValue_t
m = PValue_t(array);
675 for (Iter_t i=c->begin(); i != c->end(); ++i, ++
m )
676 ::
new(m) Value_t(*i);
691 PCont_t
c = PCont_t(coll);
692 new (*begin_arena) iterator(c->begin());
693 new (*end_arena) iterator(c->end());
695 static void*
copy(
void *dest_arena,
const void *source_ptr) {
696 const iterator *source = (
const iterator *)(source_ptr);
697 new (dest_arena) iterator(*source);
700 static void*
next(
void *iter_loc,
const void *end_loc) {
701 const iterator *end = (
const iterator *)(end_loc);
702 iterator *iter = (iterator *)(iter_loc);
712 iterator *start = (iterator *)(iter_ptr);
716 iterator *start = (iterator *)(begin_ptr);
717 iterator *end = (iterator *)(end_ptr);
736 PCont_t
c = PCont_t(obj);
739 static void*
feed(
void* from,
void *to,
size_t size) {
740 PCont_t
c = PCont_t(to);
741 PValue_t
m = PValue_t(from);
742 for (
size_t i=0; i<size; ++i, ++
m)
772 static inline PCont_t
object(
void* ptr) {
773 return PCont_t(PEnv_t(ptr)->fObject);
776 PEnv_t
e = PEnv_t(env);
781 object(env)->reset();
785 PEnv_t
e = PEnv_t(env);
789 e->
fSize = c->size();
793 PEnv_t
e = PEnv_t(env);
803 static void*
collect(
void *coll,
void *array) {
804 PCont_t
c = PCont_t(coll);
805 PValue_t
m = PValue_t(array);
806 for (
size_t i=0; i != c->size(); ++i, ++
m )
819 union PtrSize_t {
size_t fIndex;
void *fAddress; };
827 iterator *begin =
new (*begin_arena) iterator;
828 begin->first.fIndex = 0;
829 begin->second =
false;
830 iterator *end =
new (*end_arena) iterator;
831 end->first.fAddress = coll;
834 static void*
copy(
void *dest_arena,
const void *source_ptr) {
835 const iterator *source = (
const iterator *)(source_ptr);
836 new (dest_arena) iterator(*source);
839 static void*
next(
void *iter_loc,
const void *end_loc) {
840 const iterator *end = (
const iterator *)(end_loc);
841 PCont_t
c = (PCont_t)end->first.fAddress;
842 iterator *iter = (iterator *)(iter_loc);
843 if (iter->first.fIndex != c->size()) {
844 iter->second = c->test(iter->first.fIndex);
845 ++(iter->first.fIndex);
847 return &(iter->second);
850 iterator *start = (iterator *)(iter_ptr);
854 iterator *start = (iterator *)(begin_ptr);
855 iterator *end = (iterator *)(end_ptr);
863 template <
typename Bitset_t>
875 static void*
feed(
void *from,
void *to,
size_t size) {
876 PCont_t
c = PCont_t(to);
877 PValue_t
m = PValue_t(from);
878 for (
size_t i=0; i<size; ++i, ++
m)
891 using namespace Detail;
static size_t GetContainerSize(const std::forward_list< T, ALLOCATOR > &c)
std::pair< size_t, Bool_t > Iter_t
static void * copy(void *dest_arena, const void *source_ptr)
static void * first(void *env)
static int value_offset()
static void * next(void *iter_loc, const void *end_loc)
static void * copy(void *, const void *source_ptr)
Cont_t::iterator iterator
static void resize(void *obj, size_t n)
static void * next(void *iter_loc, const void *end_loc)
static void * collect(void *coll, void *array)
static PCont_t object(void *ptr)
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
static void * feed(void *from, void *to, size_t size)
static void destruct(void *, size_t)
static void resize(void *, size_t)
static void * next(void *iter_loc, const void *end_loc)
static void * size(void *env)
static PCont_t object(void *ptr)
Small helper to encapsulate all necessary data accesses for containers like set, multiset etc...
std::pair< PtrSize_t, Bool_t > iterator
static void destruct2(void *begin_ptr, void *end_ptr)
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
static void destruct2(void *begin_ptr, void *end_ptr)
static void * feed(void *from, void *to, size_t size)
static void * clear(void *env)
static void * next(void *iter_loc, const void *end_loc)
static void * next(void *env)
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
static void * next(void *, const void *)
Small helper to encapsulate basic data accesses for all STL continers.
Cont_t::iterator iterator
const std::type_info & fInfo
std::vector< Bool_t >::iterator Iter_t
std::vector< Bool_t > Cont_t
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
static int value_offset()
static void * first(void *env)
static void * next(void *env)
static void resize(void *obj, size_t n)
Small helper to implement the function to create,access and destroy iterators.
static void * address(T ref)
TCollectionProxyInfo(const std::type_info &info, size_t iter_size, size_t value_diff, int value_offset, void *(*size_func)(void *), void(*resize_func)(void *, size_t), void *(*clear_func)(void *), void *(*first_func)(void *), void *(*next_func)(void *), void *(*construct_func)(void *, size_t), void(*destruct_func)(void *, size_t), void *(*feed_func)(void *, void *, size_t), void *(*collect_func)(void *, void *), void *(*create_env)(), void(*getIterators)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)=0, void *(*copyIterator)(void *dest, const void *source)=0, void *(*next)(void *iter, const void *end)=0, void(*deleteSingleIterator)(void *iter)=0, void(*deleteTwoIterators)(void *begin, void *end)=0)
Cont_t::value_type Value_t
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
static void destruct2(void *, void *)
static void * construct(void *what, size_t size)
static void * next(void *env)
Small helper to encapsulate all necessary data accesses for containers like set, multiset etc...
static void * collect(void *coll, void *array)
static int value_offset()
static void * size(void *env)
Cont_t::iterator iterator
static void * copy(void *dest_arena, const void *source_ptr)
static void * construct(void *, size_t)
Small helper to save proxy environment in the event of recursive calls.
Small helper to encapsulate all necessary data accesses for containers like vector, list, deque.
static int value_offset()
static void * feed(void *from, void *to, size_t size)
static void * copy(void *dest, const void *source)
Iterators< Cont_t, fgLargeIterator > Iterators_t
static void destruct(void *what, size_t size)
static int value_offset()
Small helper to encapsulate all necessary data accesses for containers like forward_list.
static void destruct1(void *iter_ptr)
static void * clear(void *env)
Small helper to encapsulate whether to return the value pointed to by the iterator or its address...
static void * feed(void *from, void *to, size_t size)
static void destruct1(void *iter_ptr)
static size_t GetContainerSize(const T &c)
static void * size(void *env)
std::vector< Bool_t >::value_type Value_t
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
static TCollectionProxyInfo Get(const T &)
static void resize(void *obj, size_t n)
static int value_offset()
static void destruct(void *, size_t)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
static void destruct1(void *)
static void * construct(void *, size_t)
static void * feed(void *from, void *to, size_t size)
typedef void((*Func_t)())
static void destruct2(void *begin_ptr, void *end_ptr)
static void * first(void *env)
#define dest(otri, vertexptr)
std::vector< Bool_t > Cont_t
static void * clear(void *env)
static void * feed(void *from, void *to, size_t size)
static void destruct2(void *begin_ptr, void *end_ptr)
static void resize(void *, size_t)
static TCollectionProxyInfo * Generate(const T &)
Generate proxy from template.
static void resize(void *, size_t)
static void * collect(void *coll, void *array)
static PCont_t object(void *ptr)
static void * copy(void *dest_arena, const void *source_ptr)
PairHolder(const PairHolder &c)
Cont_t::iterator iterator
static void destruct1(void *iter_ptr)
static void destruct1(void *begin_ptr)