12 #ifndef ROOT_TVirtualCollectionIterators 13 #define ROOT_TVirtualCollectionIterators 55 ::Fatal(
"TIterators::TIterators",
"Created with out a collection proxy!\n");
59 TVirtualCollectionIterators(CreateIterators_t creator, DeleteTwoIterators_t destruct) : fBegin( &(fBeginBuffer[0]) ), fEnd(&(fEndBuffer[0])), fCreateIterators(creator), fDeleteTwoIterators(destruct)
75 if (fBegin != &(fBeginBuffer[0])) {
96 fIterators(proxy,read_from_file)
110 virtual void *Next() = 0;
114 virtual operator bool()
const = 0;
131 fNext( proxy->GetFunctionNext(read_from_file) ),
139 fCurrent = fNext(fIterators.fBegin,fIterators.fEnd);
145 operator bool()
const {
return fStarted ? fCurrent != 0 :
kTRUE; }
155 if ((
bool)*
this)
return fHasPointer ? *(
void**)fIterators.fBegin : fIterators.fBegin;
162 fIncrement(proxy->GetIncrement()),
163 fHasPointer(proxy->HasPointers())
168 if ( ! (
bool)*
this )
return 0;
169 void *
result = GetValue();
170 fIterators.fBegin = ((
char*)fIterators.fBegin) + fIncrement;
176 operator bool()
const {
return fIterators.fBegin != fIterators.fEnd; }
240 fBegin( &(fRawBeginBuffer[0]) ),
241 fEnd( &(fRawEndBuffer[0]) )
253 ::Fatal(
"TIterators::TIterators",
"Created with out a collection proxy!\n");
261 fBegin = &(fRawBeginBuffer[0]);
262 fEnd = &(fRawEndBuffer[0]);
264 if (fBegin != &(fRawBeginBuffer[0])) {
282 static void *
Next(
void *iter,
const void *end)
287 void **ptr = (
void**)internal_iter->
fNext(internal_iter->
fIter,internal_end->
fIter);
305 void *newiter = internal_source->
fCopy(dest,internal_source->
fIter);
306 if (newiter == dest) {
309 internal_dest->
fIter = newiter;
310 return internal_dest;
352 std::vector<char> *vec = (std::vector<char>*)collection;
358 fBegin= &(*vec->begin());
359 #ifdef R__VISUAL_CPLUSPLUS 360 fEnd = &(*(vec->end()-1)) + 1;
363 fEnd = &(*vec->end());
369 #endif // ROOT_TVirtualCollectionIterators
virtual Int_t GetCollectionType() const =0
virtual void * operator*() const
virtual Next_t GetFunctionNext(Bool_t read=kTRUE)=0
TVirtualCollectionIterators()
void CreateIterators(void *collection)
void CreateIterators(void *collection, TVirtualCollectionProxy *proxy)
~TVirtualCollectionIterators()
void Fatal(const char *location, const char *msgfmt,...)
static void * CopyIterator(void *dest, const void *source)
CreateIterators_t fCreateIterators
TGenericCollectionIterator(void *collection, TVirtualCollectionProxy *proxy, Bool_t read_from_file=kTRUE)
TVirtualCollectionProxy::DeleteTwoIterators_t DeleteTwoIterators_t
TInternalIterator fEndBuffer
static void * Next(void *iter, const void *end)
RegularIterator(void *collection, TVirtualCollectionProxy *proxy, Bool_t read_from_file)
CreateIterators_t fCreateIterators
virtual void * operator*() const
TInternalIterator(const TInternalIterator &source)
TVirtualCollectionIterators(TVirtualCollectionProxy *proxy, Bool_t read_from_file=kTRUE)
TVirtualCollectionProxy::CreateIterators_t CreateIterators_t
virtual DeleteIterator_t GetFunctionDeleteIterator(Bool_t read=kTRUE)=0
TVirtualCollectionProxy::Next_t Next_t
void *(* CopyIterator_t)(void *dest, const void *source)
void CreateIterators(void *collection, TVirtualCollectionProxy *proxy)
void(* DeleteIterator_t)(void *iter)
TVirtualCollectionPtrIterators(TVirtualCollectionProxy *proxy)
static TGenericCollectionIterator * New(void *collection, TVirtualCollectionProxy *proxy)
virtual ~TGenericCollectionIterator()
TVirtualVectorIterators(TVirtualCollectionProxy *)
char fEndBuffer[TVirtualCollectionProxy::fgIteratorArenaSize]
DeleteTwoIterators_t fDeleteTwoIterators
virtual DeleteTwoIterators_t GetFunctionDeleteTwoIterators(Bool_t read=kTRUE)=0
virtual CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE)=0
TVirtualCollectionProxy::CreateIterators_t CreateIterators_t
char fBeginBuffer[TVirtualCollectionProxy::fgIteratorArenaSize]
VectorIterator(void *collection, TVirtualCollectionProxy *proxy, Bool_t read_from_file)
Small helper class to generically acquire and release iterators.
void(* CreateIterators_t)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
TTime operator*(const TTime &t1, const TTime &t2)
TInternalIterator fBeginBuffer
TVirtualCollectionProxy::CopyIterator_t Copy_t
static const Int_t fgIteratorArenaSize
TVirtualVectorIterators(CreateIterators_t)
TVirtualCollectionProxy::DeleteTwoIterators_t DeleteTwoIterators_t
TVirtualCollectionProxy::CreateIterators_t CreateIterators_t
TVirtualCollectionProxy::DeleteIterator_t Delete_t
TVirtualCollectionProxy::Next_t Next_t
static void DeleteIterator(void *iter)
virtual CopyIterator_t GetFunctionCopyIterator(Bool_t read=kTRUE)=0
Binding & operator=(OUT(*fun)(void))
TGenericCollectionIterator & operator++()
#define dest(otri, vertexptr)
DeleteTwoIterators_t fDeleteTwoIterators
void *(* Next_t)(void *iter, const void *end)
TVirtualCollectionIterators fIterators
TVirtualCollectionIterators(CreateIterators_t creator, DeleteTwoIterators_t destruct)
void(* DeleteTwoIterators_t)(void *begin, void *end)
TVirtualVectorIterators()
~TVirtualCollectionPtrIterators()