12 #ifndef ROOT_TCollectionProxyInfo 13 #define ROOT_TCollectionProxyInfo 24 #include <forward_list> 31 #define TYPENAME typename 34 #define TYPENAME typename 56 static const UInt_t fgIteratorArenaSize = 16;
66 static void*
get(
typename Cont_t::iterator &iter) {
67 return (
void*)&(*iter);
71 template <
typename Cont_t,
typename value_ptr>
struct IteratorValue<Cont_t, value_ptr*> {
72 static void*
get(
typename Cont_t::iterator &iter) {
73 return (
void*)(*iter);
84 template <
typename Cont_t,
bool large = false>
90 PCont_t
c = PCont_t(coll);
91 new (*begin_arena) iterator(c->begin());
92 new (*end_arena) iterator(c->end());
94 static void*
copy(
void *dest_arena,
const void *source_ptr) {
95 iterator *source = (iterator *)(source_ptr);
96 new (dest_arena) iterator(*source);
99 static void*
next(
void *iter_loc,
const void *end_loc) {
100 iterator *end = (iterator *)(end_loc);
101 iterator *iter = (iterator *)(iter_loc);
110 iterator *start = (iterator *)(iter_ptr);
114 iterator *start = (iterator *)(begin_ptr);
115 iterator *end = (iterator *)(end_ptr);
131 PCont_t
c = PCont_t(coll);
137 *begin_arena = &(*c->begin());
138 #ifdef R__VISUAL_CPLUSPLUS 139 *end_arena = &(*(c->end()-1)) + 1;
142 *end_arena = &(*c->end());
145 static void*
copy(
void *
dest,
const void *source) {
146 *(
void**)dest = *(
void**)(
const_cast<void*
>(source));
149 static void*
next(
void * ,
const void * ) {
158 R__ASSERT(0 &&
"Intentionally not implemented, do not use.");
169 template <
typename Cont_t>
struct Iterators<Cont_t, true > {
174 PCont_t
c = PCont_t(coll);
175 *begin_arena =
new iterator(c->begin());
176 *end_arena =
new iterator(c->end());
178 static void*
copy(
void * ,
const void *source_ptr) {
179 iterator *source = (iterator *)(source_ptr);
180 void *iter =
new iterator(*source);
183 static void*
next(
void *iter_loc,
const void *end_loc) {
184 iterator *end = (iterator *)(end_loc);
185 iterator *iter = (iterator *)(iter_loc);
194 iterator *start = (iterator *)(begin_ptr);
198 iterator *start = (iterator *)(begin_ptr);
199 iterator *end = (iterator *)(end_ptr);
219 EnvironBase() : fIdx(0), fSize(0), fObject(0), fStart(0), fTemp(0), fUseTemp(
kFALSE), fRefCount(1), fSpace(0)
258 return const_cast<void*
>(
reinterpret_cast<const void*
>(&ref));
271 template <
class T,
class ALLOCATOR>
272 static size_t GetContainerSize(
const std::forward_list<T,ALLOCATOR>&
c) {
return std::distance(c.begin(),c.end());}
285 :
public Address<TYPENAME T::const_reference>
297 static inline PCont_t
object(
void* ptr) {
298 return PCont_t(PEnv_t(ptr)->fObject);
301 PEnv_t
e = PEnv_t(env);
302 e->
fSize = SfinaeHelper::GetContainerSize(*PCont_t(e->
fObject));
306 object(env)->clear();
310 PEnv_t
e = PEnv_t(env);
314 ::new(e->buff) Iter_t(c->begin());
317 e->
fSize = SfinaeHelper::GetContainerSize(*c);
323 PEnv_t
e = PEnv_t(env);
327 if ( e->
iter() == c->end() )
return 0;
332 PValue_t
m = PValue_t(what);
333 for (
size_t i=0; i<size; ++i, ++
m)
337 static void*
collect(
void *coll,
void *array) {
338 PCont_t
c = PCont_t(coll);
339 PValue_t
m = PValue_t(array);
340 for (Iter_t i=c->begin(); i != c->end(); ++i, ++
m )
341 ::
new(m) Value_t(*i);
345 PValue_t
m = PValue_t(what);
346 for (
size_t i=0; i < size; ++i, ++
m )
350 static const bool fgLargeIterator =
sizeof(
typename Cont_t::iterator) > fgIteratorArenaSize;
373 PCont_t
c = PCont_t(obj);
376 static void*
feed(
void *from,
void *to,
size_t size) {
377 PCont_t
c = PCont_t(to);
378 PValue_t
m = PValue_t(from);
379 for (
size_t i=0; i<size; ++i, ++
m)
406 PCont_t
c = PCont_t(obj);
409 static void*
feed(
void *from,
void *to,
size_t size) {
410 PCont_t
c = PCont_t(to);
411 if (size==0)
return 0;
412 PValue_t
m = &(PValue_t(from)[size-1]);
414 for (
size_t i=0; i<size; ++i, --
m){
441 static void*
feed(
void *from,
void *to,
size_t size) {
442 PCont_t
c = PCont_t(to);
443 PValue_t
m = PValue_t(from);
444 for (
size_t i=0; i<size; ++i, ++
m)
473 static void*
feed(
void *from,
void *to,
size_t size) {
474 PCont_t
c = PCont_t(to);
475 PValue_t
m = PValue_t(from);
476 for (
size_t i=0; i<size; ++i, ++
m)
484 return ((
char*)&((PValue_t(0x1000))->
second)) - ((
char*)PValue_t(0x1000));
494 void* (*fSizeFunc)(
void*);
495 void (*fResizeFunc)(
void*,size_t);
496 void* (*fClearFunc)(
void*);
497 void* (*fFirstFunc)(
void*);
498 void* (*fNextFunc)(
void*);
499 void* (*fConstructFunc)(
void*,size_t);
500 void (*fDestructFunc)(
void*,size_t);
501 void* (*fFeedFunc)(
void*,
void*,size_t);
502 void* (*fCollectFunc)(
void*,
void*);
503 void* (*fCreateEnv)();
511 void* (*fCopyIterator)(
void *
dest,
const void *source);
516 void* (*fNext)(
void *iter,
const void *end);
522 void (*fDeleteSingleIterator)(
void *iter);
523 void (*fDeleteTwoIterators)(
void *begin,
void *end);
532 void* (*size_func)(
void*),
533 void (*resize_func)(
void*,
size_t),
534 void* (*clear_func)(
void*),
535 void* (*first_func)(
void*),
536 void* (*next_func)(
void*),
537 void* (*construct_func)(
void*,
size_t),
538 void (*destruct_func)(
void*,
size_t),
539 void* (*feed_func)(
void*,
void*,
size_t),
540 void* (*collect_func)(
void*,
void*),
541 void* (*create_env)(),
542 void (*getIterators)(
void *collection,
void **begin_arena,
void **end_arena,
TVirtualCollectionProxy *proxy) = 0,
543 void* (*copyIterator)(
void *dest,
const void *source) = 0,
544 void* (*next)(
void *iter,
const void *end) = 0,
545 void (*deleteSingleIterator)(
void *iter) = 0,
546 void (*deleteTwoIterators)(
void *begin,
void *end) = 0
548 fInfo(info), fIterSize(iter_size), fValueDiff(value_diff),
549 fValueOffset(value_offset),
550 fSizeFunc(size_func),fResizeFunc(resize_func),fClearFunc(clear_func),
551 fFirstFunc(first_func),fNextFunc(next_func),fConstructFunc(construct_func),
552 fDestructFunc(destruct_func),fFeedFunc(feed_func),fCollectFunc(collect_func),
553 fCreateEnv(create_env),
554 fCreateIterators(getIterators),fCopyIterator(copyIterator),fNext(next),
555 fDeleteSingleIterator(deleteSingleIterator),fDeleteTwoIterators(deleteTwoIterators)
582 T::Iterators_t::create,
583 T::Iterators_t::copy,
584 T::Iterators_t::next,
585 T::Iterators_t::destruct1,
586 T::Iterators_t::destruct2);
620 typedef std::vector<Bool_t>::iterator
Iter_t;
621 typedef std::vector<Bool_t>::value_type
Value_t;
629 static inline PCont_t
object(
void* ptr) {
630 return PCont_t(PEnv_t(ptr)->fObject);
633 PEnv_t
e = PEnv_t(env);
638 object(env)->clear();
642 PEnv_t
e = PEnv_t(env);
646 ::new(e->buff) Iter_t(c->begin());
649 e->
fSize = c->size();
653 PEnv_t
e = PEnv_t(env);
663 static void*
collect(
void *coll,
void *array) {
664 PCont_t
c = PCont_t(coll);
665 PValue_t
m = PValue_t(array);
666 for (Iter_t i=c->begin(); i != c->end(); ++i, ++
m )
667 ::
new(m) Value_t(*i);
681 PCont_t
c = PCont_t(coll);
682 new (*begin_arena) iterator(c->begin());
683 new (*end_arena) iterator(c->end());
685 static void*
copy(
void *dest_arena,
const void *source_ptr) {
686 const iterator *source = (
const iterator *)(source_ptr);
687 new (dest_arena) iterator(*source);
690 static void*
next(
void *iter_loc,
const void *end_loc) {
691 const iterator *end = (
const iterator *)(end_loc);
692 iterator *iter = (iterator *)(iter_loc);
702 iterator *start = (iterator *)(iter_ptr);
706 iterator *start = (iterator *)(begin_ptr);
707 iterator *end = (iterator *)(end_ptr);
726 PCont_t
c = PCont_t(obj);
729 static void*
feed(
void* from,
void *to,
size_t size) {
730 PCont_t
c = PCont_t(to);
731 PValue_t
m = PValue_t(from);
732 for (
size_t i=0; i<size; ++i, ++
m)
759 static inline PCont_t
object(
void* ptr) {
760 return PCont_t(PEnv_t(ptr)->fObject);
763 PEnv_t
e = PEnv_t(env);
768 object(env)->reset();
772 PEnv_t
e = PEnv_t(env);
776 e->
fSize = c->size();
780 PEnv_t
e = PEnv_t(env);
790 static void*
collect(
void *coll,
void *array) {
791 PCont_t
c = PCont_t(coll);
792 PValue_t
m = PValue_t(array);
793 for (
size_t i=0; i != c->size(); ++i, ++
m )
805 union PtrSize_t {
size_t fIndex;
void *fAddress; };
813 iterator *begin =
new (*begin_arena) iterator;
814 begin->first.fIndex = 0;
815 begin->second =
false;
816 iterator *end =
new (*end_arena) iterator;
817 end->first.fAddress = coll;
820 static void*
copy(
void *dest_arena,
const void *source_ptr) {
821 const iterator *source = (
const iterator *)(source_ptr);
822 new (dest_arena) iterator(*source);
825 static void*
next(
void *iter_loc,
const void *end_loc) {
826 const iterator *end = (
const iterator *)(end_loc);
827 PCont_t
c = (PCont_t)end->first.fAddress;
828 iterator *iter = (iterator *)(iter_loc);
829 if (iter->first.fIndex != c->size()) {
830 iter->second = c->test(iter->first.fIndex);
831 ++(iter->first.fIndex);
833 return &(iter->second);
836 iterator *start = (iterator *)(iter_ptr);
840 iterator *start = (iterator *)(begin_ptr);
841 iterator *end = (iterator *)(end_ptr);
849 template <
typename Bitset_t>
862 static void*
feed(
void *from,
void *to,
size_t size) {
865 for (
size_t i=0; i<size; ++i, ++
m)
877 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)
Namespace for new ROOT classes and functions.
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 constexpr double second
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 *)
Binding & operator=(OUT(*fun)(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)