12#ifndef ROOT_TCollectionProxyInfo
13#define ROOT_TCollectionProxyInfo
24#include <forward_list>
31 #define TYPENAME typename
34 #define TYPENAME typename
67 static void*
get(
typename Cont_t::iterator &iter) {
68 return (
void*)&(*iter);
72 template <
typename Cont_t,
typename value_ptr>
struct IteratorValue<Cont_t, value_ptr*> {
73 static void*
get(
typename Cont_t::iterator &iter) {
74 return (
void*)(*iter);
85 template <
typename Cont_t,
bool large = false>
95 static void*
copy(
void *dest_arena,
const void *source_ptr) {
100 static void*
next(
void *iter_loc,
const void *end_loc) {
126 template <
typename T>
struct Iterators<std::vector<T>, false> {
127 typedef std::vector<T> Cont_t;
129 typedef typename Cont_t::iterator
iterator;
138 *begin_arena = &(*
c->begin());
139#ifdef R__VISUAL_CPLUSPLUS
140 *end_arena = &(*(
c->end()-1)) + 1;
143 *end_arena = &(*
c->end());
146 static void*
copy(
void *
dest,
const void *source) {
147 *(
void**)
dest = *(
void**)(
const_cast<void*
>(source));
150 static void*
next(
void * ,
const void * ) {
159 R__ASSERT(0 &&
"Intentionally not implemented, do not use.");
165 static void destruct2(
void * ,
void * ) {
170 template <
typename Cont_t>
struct Iterators<Cont_t, true > {
179 static void*
copy(
void * ,
const void *source_ptr) {
184 static void*
next(
void *iter_loc,
const void *end_loc) {
259 return const_cast<void*
>(
reinterpret_cast<const void*
>(&ref));
272 template <
class T,
class ALLOCATOR>
273 static size_t GetContainerSize(
const std::forward_list<T,ALLOCATOR>&
c) {
return std::distance(
c.begin(),
c.end());}
286 :
public Address<TYPENAME T::const_reference>
317 e->fIterator =
c->begin();
319 if ( 0 ==
e->fSize )
return e->fStart = 0;
320 TYPENAME T::const_reference ref = *(
e->iter());
326 for (;
e->fIdx > 0 &&
e->iter() !=
c->end(); ++(
e->iter()), --
e->fIdx){ }
328 if (
e->iter() ==
c->end() )
return 0;
329 TYPENAME T::const_reference ref = *(
e->iter());
334 for (
size_t i=0; i<
size; ++i, ++
m)
338 static void*
collect(
void *coll,
void *array) {
341 for (
Iter_t i=
c->begin(); i !=
c->end(); ++i, ++
m )
347 for (
size_t i=0; i <
size; ++i, ++
m )
377 static void*
feed(
void *from,
void *to,
size_t size) {
380 for (
size_t i=0; i<
size; ++i, ++
m)
410 static void*
feed(
void *from,
void *to,
size_t size) {
412 if (
size==0)
return 0;
415 for (
size_t i=0; i<
size; ++i, --
m){
442 static void*
feed(
void *from,
void *to,
size_t size) {
445 for (
size_t i=0; i<
size; ++i, ++
m)
474 static void*
feed(
void *from,
void *to,
size_t size) {
477 for (
size_t i=0; i<
size; ++i, ++
m)
495 void* (*fSizeFunc)(
void*);
497 void* (*fClearFunc)(
void*);
498 void* (*fFirstFunc)(
void*);
499 void* (*fNextFunc)(
void*);
500 void* (*fConstructFunc)(
void*,size_t);
502 void* (*fFeedFunc)(
void*,
void*,size_t);
503 void* (*fCollectFunc)(
void*,
void*);
504 void* (*fCreateEnv)();
512 void* (*fCopyIterator)(
void *
dest,
const void *source);
517 void* (*fNext)(
void *iter,
const void *end);
533 void* (*size_func)(
void*),
534 void (*resize_func)(
void*,
size_t),
535 void* (*clear_func)(
void*),
536 void* (*first_func)(
void*),
537 void* (*next_func)(
void*),
538 void* (*construct_func)(
void*,
size_t),
539 void (*destruct_func)(
void*,
size_t),
540 void* (*feed_func)(
void*,
void*,
size_t),
541 void* (*collect_func)(
void*,
void*),
542 void* (*create_env)(),
543 void (*getIterators)(
void *collection,
void **begin_arena,
void **end_arena,
TVirtualCollectionProxy *proxy) = 0,
544 void* (*copyIterator)(
void *
dest,
const void *source) = 0,
545 void* (*next)(
void *iter,
const void *end) = 0,
546 void (*deleteSingleIterator)(
void *iter) = 0,
547 void (*deleteTwoIterators)(
void *begin,
void *end) = 0
583 T::Iterators_t::create,
584 T::Iterators_t::copy,
585 T::Iterators_t::next,
586 T::Iterators_t::destruct1,
587 T::Iterators_t::destruct2);
622 typedef std::vector<Bool_t, A>
Cont_t;
623 typedef typename Cont_t::iterator
Iter_t;
624 typedef typename Cont_t::value_type
Value_t;
625 typedef Environ<Iter_t>
Env_t;
635 static void*
size(
void* env) {
640 static void*
clear(
void* env) {
644 static void*
first(
void* env) {
651 e->fIterator =
c->begin();
652 e->fSize =
c->size();
655 static void*
next(
void* env) {
658 for (;
e->fIdx > 0 &&
e->iter() !=
c->end(); ++(
e->iter()), --
e->fIdx){ }
666 static void*
collect(
void *coll,
void *array) {
669 for (
Iter_t i=
c->begin(); i !=
c->end(); ++i, ++
m )
673 static void destruct(
void*,
size_t) {
681 typedef typename Cont_t::iterator iterator;
685 new (*begin_arena) iterator(
c->begin());
686 new (*end_arena) iterator(
c->end());
688 static void* copy(
void *dest_arena,
const void *source_ptr) {
689 const iterator *source = (
const iterator *)(source_ptr);
690 new (dest_arena) iterator(*source);
693 static void*
next(
void *iter_loc,
const void *end_loc) {
694 const iterator *end = (
const iterator *)(end_loc);
695 iterator *iter = (iterator *)(iter_loc);
704 static void destruct1(
void *iter_ptr) {
705 iterator *start = (iterator *)(iter_ptr);
708 static void destruct2(
void *begin_ptr,
void *end_ptr) {
709 iterator *start = (iterator *)(begin_ptr);
710 iterator *end = (iterator *)(end_ptr);
719 template <
class A>
struct TCollectionProxyInfo::Pushback<std::vector<Bool_t, A> > :
public TCollectionProxyInfo::Type<std::vector<Bool_t, A> > {
720 typedef std::vector<Bool_t, A>
Cont_t;
721 typedef typename Cont_t::iterator
Iter_t;
722 typedef typename Cont_t::value_type
Value_t;
723 typedef Environ<Iter_t>
Env_t;
728 static void resize(
void* obj,
size_t n) {
732 static void*
feed(
void* from,
void *to,
size_t size) {
735 for (
size_t i=0; i<
size; ++i, ++
m)
745 template <
class A>
struct TCollectionProxyInfo::Address<std::vector<Bool_t, A>> {
747 static void*
address(
typename std::vector<Bool_t, A>::const_reference ref) {
781 e->fIterator.first = 0;
782 e->fIterator.second =
c->size() > 0 ?
c->test(
e->fIterator.first) : false ;
783 e->fSize =
c->size();
784 return &(
e->fIterator.second);
789 for (;
e->fIdx > 0 &&
e->fIterator.first !=
c->size(); ++(
e->fIterator.first), --
e->fIdx){ }
790 e->fIterator.second = (
e->fIterator.first !=
c->size()) ?
c->test(
e->fIterator.first) :
false;
791 return &(
e->fIterator.second);
797 static void*
collect(
void *coll,
void *array) {
800 for (
size_t i=0; i !=
c->size(); ++i, ++
m )
812 union PtrSize_t {
size_t fIndex;
void *
fAddress; };
821 begin->first.fIndex = 0;
822 begin->second =
false;
824 end->first.fAddress = coll;
827 static void*
copy(
void *dest_arena,
const void *source_ptr) {
832 static void*
next(
void *iter_loc,
const void *end_loc) {
836 if (iter->first.fIndex !=
c->size()) {
837 iter->second =
c->test(iter->first.fIndex);
838 ++(iter->first.fIndex);
840 return &(iter->second);
856 template <
typename Bitset_t>
869 static void*
feed(
void *from,
void *to,
size_t size) {
872 for (
size_t i=0; i<
size; ++i, ++
m)
884using namespace Detail;
typedef void((*Func_t)())
void *(* fCopyIterator)(void *dest, const void *source)
void *(* fConstructFunc)(void *, size_t)
void *(* fClearFunc)(void *)
static const UInt_t fgIteratorArenaSize
void *(* fFirstFunc)(void *)
void(* fDestructFunc)(void *, size_t)
void(* fDeleteTwoIterators)(void *begin, void *end)
void *(* fCollectFunc)(void *, void *)
void *(* fSizeFunc)(void *)
void *(* fNextFunc)(void *)
void *(* fFeedFunc)(void *, void *, size_t)
void(* fDeleteSingleIterator)(void *iter)
void(* fResizeFunc)(void *, size_t)
static TCollectionProxyInfo Get(const T &)
void(* fCreateIterators)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
static TCollectionProxyInfo * Generate(const T &)
Generate proxy from template.
void *(* fNext)(void *iter, const void *end)
const std::type_info & fInfo
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)
Type
enumeration specifying the integration types.
Namespace for new ROOT classes and functions.
static constexpr double second
static void * address(T ref)
EnvironBase(const EnvironBase &)
EnvironBase & operator=(const EnvironBase &)
Small helper to save proxy environment in the event of recursive calls.
Small helper to encapsulate all necessary data accesses for containers like set, multiset etc.
static void resize(void *, size_t)
static int value_offset()
static void * feed(void *from, void *to, size_t size)
static void * get(typename Cont_t::iterator &iter)
Small helper to encapsulate whether to return the value pointed to by the iterator or its address.
static void * get(typename Cont_t::iterator &iter)
Cont_t::iterator iterator
static void destruct2(void *begin_ptr, void *end_ptr)
static void * next(void *iter_loc, const void *end_loc)
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
static void destruct1(void *begin_ptr)
static void * copy(void *, const void *source_ptr)
Small helper to implement the function to create,access and destroy iterators.
static void * next(void *iter_loc, const void *end_loc)
static void * copy(void *dest_arena, const void *source_ptr)
static void destruct2(void *begin_ptr, void *end_ptr)
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
Cont_t::iterator iterator
static void destruct1(void *iter_ptr)
Small helper to encapsulate all necessary data accesses for containers like set, multiset etc.
static void resize(void *, size_t)
static int value_offset()
static void * feed(void *from, void *to, size_t size)
PairHolder(const PairHolder &c)
PairHolder & operator=(const PairHolder &)
static void resize(void *, size_t)
static void * feed(void *from, void *to, size_t size)
static int value_offset()
Small helper to encapsulate all necessary data accesses for containers like vector,...
static void resize(void *obj, size_t n)
static void * feed(void *from, void *to, size_t size)
static int value_offset()
Small helper to encapsulate all necessary data accesses for containers like forward_list.
static void resize(void *obj, size_t n)
static int value_offset()
static void * feed(void *from, void *to, size_t size)
static size_t GetContainerSize(const std::forward_list< T, ALLOCATOR > &c)
static size_t GetContainerSize(const T &c)
static void destruct2(void *begin_ptr, void *end_ptr)
static void * copy(void *dest_arena, const void *source_ptr)
static void * next(void *iter_loc, const void *end_loc)
static void create(void *coll, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
std::pair< PtrSize_t, Bool_t > iterator
static void destruct1(void *iter_ptr)
static void destruct(void *, size_t)
std::pair< size_t, Bool_t > Iter_t
static void * construct(void *, size_t)
static void * collect(void *coll, void *array)
static void * next(void *env)
static void * first(void *env)
static void * clear(void *env)
static void * size(void *env)
static PCont_t object(void *ptr)
Small helper to encapsulate basic data accesses for all STL continers.
static const bool fgLargeIterator
static void * clear(void *env)
static void destruct(void *what, size_t size)
static void * first(void *env)
static void * size(void *env)
static void * next(void *env)
static void * construct(void *what, size_t size)
Iterators< Cont_t, fgLargeIterator > Iterators_t
static PCont_t object(void *ptr)
static void * collect(void *coll, void *array)
#define dest(otri, vertexptr)