12#ifndef ROOT_TCollectionProxyInfo
13#define ROOT_TCollectionProxyInfo
25#include <forward_list>
33 #define TYPENAME typename
36 #define TYPENAME typename
75 static void*
get(
typename Cont_t::iterator &iter) {
76 return (
void*)&(*iter);
80 template <
typename Cont_t,
typename value_ptr>
struct IteratorValue<Cont_t, value_ptr*> {
81 static void*
get(
typename Cont_t::iterator &iter) {
82 return (
void*)(*iter);
93 template <
typename Cont_t,
bool large = false>
103 static void*
copy(
void *dest_arena,
const void *source_ptr) {
108 static void*
next(
void *iter_loc,
const void *end_loc) {
134 template <
typename T>
struct Iterators<std::vector<T>, false> {
135 typedef std::vector<T> Cont_t;
137 typedef typename Cont_t::iterator
iterator;
142 *begin_arena =
nullptr;
143 *end_arena =
nullptr;
146 *begin_arena =
c->data();
147 *end_arena =
c->data() +
c->size();
149 static void*
copy(
void *
dest,
const void *source) {
150 *(
void**)
dest = *(
void**)(
const_cast<void*
>(source));
153 static void*
next(
void * ,
const void * ) {
162 R__ASSERT(0 &&
"Intentionally not implemented, do not use.");
168 static void destruct2(
void * ,
void * ) {
173 template <
typename Cont_t>
struct Iterators<Cont_t, true > {
182 static void*
copy(
void * ,
const void *source_ptr) {
187 static void*
next(
void *iter_loc,
const void *end_loc) {
262 return const_cast<void*
>(
reinterpret_cast<const void*
>(&ref));
275 template <
class T,
class ALLOCATOR>
276 static size_t GetContainerSize(
const std::forward_list<T,ALLOCATOR>&
c) {
return std::distance(
c.begin(),
c.end());}
289 :
public Address<TYPENAME T::const_reference>
320 e->fIterator =
c->begin();
322 if ( 0 ==
e->fSize )
return e->fStart =
nullptr;
323 TYPENAME T::const_reference ref = *(
e->iter());
329 for (;
e->fIdx > 0 &&
e->iter() !=
c->end(); ++(
e->iter()), --
e->fIdx){ }
331 if (
e->iter() ==
c->end() )
return nullptr;
332 TYPENAME T::const_reference ref = *(
e->iter());
337 for (
size_t i=0; i<
size; ++i, ++
m)
341 static void*
collect(
void *coll,
void *array) {
344 for (
Iter_t i=
c->begin(); i !=
c->end(); ++i, ++
m )
350 for (
size_t i=0; i <
size; ++i, ++
m )
380 static void*
feed(
void *from,
void *to,
size_t size) {
383 for (
size_t i=0; i<
size; ++i, ++
m)
413 static void*
feed(
void *from,
void *to,
size_t size) {
415 if (
size==0)
return nullptr;
418 for (
size_t i=0; i<
size; ++i, --
m){
445 static void*
feed(
void *from,
void *to,
size_t size) {
448 for (
size_t i=0; i<
size; ++i, ++
m)
477 static void*
feed(
void *from,
void *to,
size_t size) {
480 for (
size_t i=0; i<
size; ++i, ++
m)
498 void* (*fSizeFunc)(
void*);
500 void* (*fClearFunc)(
void*);
501 void* (*fFirstFunc)(
void*);
502 void* (*fNextFunc)(
void*);
503 void* (*fConstructFunc)(
void*,size_t);
505 void* (*fFeedFunc)(
void*,
void*,size_t);
506 void* (*fCollectFunc)(
void*,
void*);
507 void* (*fCreateEnv)();
515 void* (*fCopyIterator)(
void *
dest,
const void *source);
520 void* (*fNext)(
void *iter,
const void *end);
536 void* (*size_func)(
void*),
537 void (*resize_func)(
void*,
size_t),
538 void* (*clear_func)(
void*),
539 void* (*first_func)(
void*),
540 void* (*next_func)(
void*),
541 void* (*construct_func)(
void*,
size_t),
542 void (*destruct_func)(
void*,
size_t),
543 void* (*feed_func)(
void*,
void*,
size_t),
544 void* (*collect_func)(
void*,
void*),
545 void* (*create_env)(),
546 void (*getIterators)(
void *collection,
void **begin_arena,
void **end_arena,
TVirtualCollectionProxy *proxy) =
nullptr,
547 void* (*copyIterator)(
void *
dest,
const void *source) =
nullptr,
548 void* (*next)(
void *iter,
const void *end) =
nullptr,
549 void (*deleteSingleIterator)(
void *iter) =
nullptr,
550 void (*deleteTwoIterators)(
void *begin,
void *end) =
nullptr
574 (((
char*)&
p->second)-((
char*)&
p->first)),
586 T::Iterators_t::create,
587 T::Iterators_t::copy,
588 T::Iterators_t::next,
589 T::Iterators_t::destruct1,
590 T::Iterators_t::destruct2);
604 (((
char*)&
p->second)-((
char*)&
p->first)),
625 typedef std::vector<Bool_t, A>
Cont_t;
626 typedef typename Cont_t::iterator
Iter_t;
627 typedef typename Cont_t::value_type
Value_t;
628 typedef Environ<Iter_t>
Env_t;
638 static void*
size(
void* env) {
643 static void*
clear(
void* env) {
647 static void*
first(
void* env) {
654 e->fIterator =
c->begin();
655 e->fSize =
c->size();
658 static void*
next(
void* env) {
661 for (;
e->fIdx > 0 &&
e->iter() !=
c->end(); ++(
e->iter()), --
e->fIdx){ }
669 static void*
collect(
void *coll,
void *array) {
672 for (
Iter_t i=
c->begin(); i !=
c->end(); ++i, ++
m )
676 static void destruct(
void*,
size_t) {
684 typedef typename Cont_t::iterator iterator;
687 PCont_t
c = PCont_t(coll);
688 new (*begin_arena) iterator(
c->begin());
689 new (*end_arena) iterator(
c->end());
691 static void* copy(
void *dest_arena,
const void *source_ptr) {
692 const iterator *source = (
const iterator *)(source_ptr);
693 new (dest_arena) iterator(*source);
696 static void* next(
void *,
const void *) {
697 R__ASSERT(
false &&
"Intentionally not implemented, should use VectorLooper or similar for vector<bool>.");
700 static void destruct1(
void *iter_ptr) {
701 iterator *
start = (iterator *)(iter_ptr);
704 static void destruct2(
void *begin_ptr,
void *end_ptr) {
705 iterator *
start = (iterator *)(begin_ptr);
706 iterator *
end = (iterator *)(end_ptr);
715 template <
class A>
struct TCollectionProxyInfo::Pushback<std::vector<Bool_t, A> > :
public TCollectionProxyInfo::Type<std::vector<Bool_t, A> > {
716 typedef std::vector<Bool_t, A>
Cont_t;
717 typedef typename Cont_t::iterator
Iter_t;
718 typedef typename Cont_t::value_type
Value_t;
719 typedef Environ<Iter_t>
Env_t;
724 static void resize(
void* obj,
size_t n) {
728 static void*
feed(
void* from,
void *to,
size_t size) {
731 for (
size_t i=0; i<
size; ++i, ++
m)
741 template <
class A>
struct TCollectionProxyInfo::Address<std::vector<Bool_t, A>> {
743 static void*
address(
typename std::vector<Bool_t, A>::const_reference) {
744 R__ASSERT(
false &&
"Intentionally not implemented, should use VectorLooper or other functions specialized for "
745 "vector<bool> instead");
777 e->fIterator.first = 0;
778 e->fIterator.second =
c->size() > 0 ?
c->test(
e->fIterator.first) : false ;
779 e->fSize =
c->size();
780 return &(
e->fIterator.second);
785 for (;
e->fIdx > 0 &&
e->fIterator.first !=
c->size(); ++(
e->fIterator.first), --
e->fIdx){ }
786 e->fIterator.second = (
e->fIterator.first !=
c->size()) ?
c->test(
e->fIterator.first) :
false;
787 return &(
e->fIterator.second);
793 static void*
collect(
void *coll,
void *array) {
796 for (
size_t i=0; i !=
c->size(); ++i, ++
m )
808 union PtrSize_t {
size_t fIndex;
void *
fAddress; };
817 begin->first.fIndex = 0;
818 begin->second =
false;
820 end->first.fAddress = coll;
823 static void*
copy(
void *dest_arena,
const void *source_ptr) {
828 static void*
next(
void *iter_loc,
const void *end_loc) {
832 if (iter->first.fIndex !=
c->size()) {
833 iter->second =
c->test(iter->first.fIndex);
834 ++(iter->first.fIndex);
835 return &(iter->second);
854 template <
typename Bitset_t>
867 static void*
feed(
void *from,
void *to,
size_t size) {
870 for (
size_t i=0; i<
size; ++i, ++
m)
882using namespace Detail;
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
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)
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)=nullptr, void *(*copyIterator)(void *dest, const void *source)=nullptr, void *(*next)(void *iter, const void *end)=nullptr, void(*deleteSingleIterator)(void *iter)=nullptr, void(*deleteTwoIterators)(void *begin, void *end)=nullptr)
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
A "std::vector"-like collection of values implementing handy operation to analyse them.
Defines a common interface to inspect/change the contents of an object that represents a collection.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
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 & operator=(const PairHolder &)=delete
PairHolder(const PairHolder &c)
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)