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->begin());
147#ifdef R__VISUAL_CPLUSPLUS
148 *end_arena = &(*(
c->end()-1)) + 1;
151 *end_arena = &(*
c->end());
154 static void*
copy(
void *
dest,
const void *source) {
155 *(
void**)
dest = *(
void**)(
const_cast<void*
>(source));
158 static void*
next(
void * ,
const void * ) {
167 R__ASSERT(0 &&
"Intentionally not implemented, do not use.");
173 static void destruct2(
void * ,
void * ) {
178 template <
typename Cont_t>
struct Iterators<Cont_t, true > {
187 static void*
copy(
void * ,
const void *source_ptr) {
192 static void*
next(
void *iter_loc,
const void *end_loc) {
267 return const_cast<void*
>(
reinterpret_cast<const void*
>(&ref));
280 template <
class T,
class ALLOCATOR>
281 static size_t GetContainerSize(
const std::forward_list<T,ALLOCATOR>&
c) {
return std::distance(
c.begin(),
c.end());}
294 :
public Address<TYPENAME T::const_reference>
325 e->fIterator =
c->begin();
327 if ( 0 ==
e->fSize )
return e->fStart =
nullptr;
328 TYPENAME T::const_reference ref = *(
e->iter());
334 for (;
e->fIdx > 0 &&
e->iter() !=
c->end(); ++(
e->iter()), --
e->fIdx){ }
336 if (
e->iter() ==
c->end() )
return nullptr;
337 TYPENAME T::const_reference ref = *(
e->iter());
342 for (
size_t i=0; i<
size; ++i, ++
m)
346 static void*
collect(
void *coll,
void *array) {
349 for (
Iter_t i=
c->begin(); i !=
c->end(); ++i, ++
m )
355 for (
size_t i=0; i <
size; ++i, ++
m )
385 static void*
feed(
void *from,
void *to,
size_t size) {
388 for (
size_t i=0; i<
size; ++i, ++
m)
418 static void*
feed(
void *from,
void *to,
size_t size) {
420 if (
size==0)
return nullptr;
423 for (
size_t i=0; i<
size; ++i, --
m){
450 static void*
feed(
void *from,
void *to,
size_t size) {
453 for (
size_t i=0; i<
size; ++i, ++
m)
482 static void*
feed(
void *from,
void *to,
size_t size) {
485 for (
size_t i=0; i<
size; ++i, ++
m)
503 void* (*fSizeFunc)(
void*);
505 void* (*fClearFunc)(
void*);
506 void* (*fFirstFunc)(
void*);
507 void* (*fNextFunc)(
void*);
508 void* (*fConstructFunc)(
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);
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) =
nullptr,
552 void* (*copyIterator)(
void *
dest,
const void *source) =
nullptr,
553 void* (*next)(
void *iter,
const void *end) =
nullptr,
554 void (*deleteSingleIterator)(
void *iter) =
nullptr,
555 void (*deleteTwoIterators)(
void *begin,
void *end) =
nullptr
579 (((
char*)&
p->second)-((
char*)&
p->first)),
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);
609 (((
char*)&
p->second)-((
char*)&
p->first)),
630 typedef std::vector<Bool_t, A>
Cont_t;
631 typedef typename Cont_t::iterator
Iter_t;
632 typedef typename Cont_t::value_type
Value_t;
633 typedef Environ<Iter_t>
Env_t;
643 static void*
size(
void* env) {
648 static void*
clear(
void* env) {
652 static void*
first(
void* env) {
659 e->fIterator =
c->begin();
660 e->fSize =
c->size();
663 static void*
next(
void* env) {
666 for (;
e->fIdx > 0 &&
e->iter() !=
c->end(); ++(
e->iter()), --
e->fIdx){ }
674 static void*
collect(
void *coll,
void *array) {
677 for (
Iter_t i=
c->begin(); i !=
c->end(); ++i, ++
m )
681 static void destruct(
void*,
size_t) {
689 typedef typename Cont_t::iterator iterator;
692 PCont_t
c = PCont_t(coll);
693 new (*begin_arena) iterator(
c->begin());
694 new (*end_arena) iterator(
c->end());
696 static void* copy(
void *dest_arena,
const void *source_ptr) {
697 const iterator *source = (
const iterator *)(source_ptr);
698 new (dest_arena) iterator(*source);
701 static void* next(
void *,
const void *) {
702 R__ASSERT(
false &&
"Intentionally not implemented, should use VectorLooper or similar for vector<bool>.");
705 static void destruct1(
void *iter_ptr) {
706 iterator *
start = (iterator *)(iter_ptr);
709 static void destruct2(
void *begin_ptr,
void *end_ptr) {
710 iterator *
start = (iterator *)(begin_ptr);
711 iterator *
end = (iterator *)(end_ptr);
720 template <
class A>
struct TCollectionProxyInfo::Pushback<std::vector<Bool_t, A> > :
public TCollectionProxyInfo::Type<std::vector<Bool_t, A> > {
721 typedef std::vector<Bool_t, A>
Cont_t;
722 typedef typename Cont_t::iterator
Iter_t;
723 typedef typename Cont_t::value_type
Value_t;
724 typedef Environ<Iter_t>
Env_t;
729 static void resize(
void* obj,
size_t n) {
733 static void*
feed(
void* from,
void *to,
size_t size) {
736 for (
size_t i=0; i<
size; ++i, ++
m)
746 template <
class A>
struct TCollectionProxyInfo::Address<std::vector<Bool_t, A>> {
748 static void*
address(
typename std::vector<Bool_t, A>::const_reference) {
749 R__ASSERT(
false &&
"Intentionally not implemented, should use VectorLooper or other functions specialized for "
750 "vector<bool> instead");
782 e->fIterator.first = 0;
783 e->fIterator.second =
c->size() > 0 ?
c->test(
e->fIterator.first) : false ;
784 e->fSize =
c->size();
785 return &(
e->fIterator.second);
790 for (;
e->fIdx > 0 &&
e->fIterator.first !=
c->size(); ++(
e->fIterator.first), --
e->fIdx){ }
791 e->fIterator.second = (
e->fIterator.first !=
c->size()) ?
c->test(
e->fIterator.first) :
false;
792 return &(
e->fIterator.second);
798 static void*
collect(
void *coll,
void *array) {
801 for (
size_t i=0; i !=
c->size(); ++i, ++
m )
813 union PtrSize_t {
size_t fIndex;
void *
fAddress; };
822 begin->first.fIndex = 0;
823 begin->second =
false;
825 end->first.fAddress = coll;
828 static void*
copy(
void *dest_arena,
const void *source_ptr) {
833 static void*
next(
void *iter_loc,
const void *end_loc) {
837 if (iter->first.fIndex !=
c->size()) {
838 iter->second =
c->test(iter->first.fIndex);
839 ++(iter->first.fIndex);
841 return &(iter->second);
857 template <
typename Bitset_t>
870 static void*
feed(
void *from,
void *to,
size_t size) {
873 for (
size_t i=0; i<
size; ++i, ++
m)
885using namespace Detail;
RooAbsTestStatistic * create(const char *name, const char *title, RooAbsReal &real, RooAbsData &adata, const RooArgSet &projDeps, RooAbsTestStatistic::Configuration const &cfg) override
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 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.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
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)
#define dest(otri, vertexptr)