12 #ifndef ROOT_TVirtualCollectionIterators 13 #define ROOT_TVirtualCollectionIterators 21 #ifndef ROOT_TVirtualCollectionProxy 59 ::Fatal(
"TIterators::TIterators",
"Created with out a collection proxy!\n");
63 TVirtualCollectionIterators(CreateIterators_t creator, DeleteTwoIterators_t destruct) : fBegin( &(fBeginBuffer[0]) ), fEnd(&(fEndBuffer[0])), fCreateIterators(creator), fDeleteTwoIterators(destruct)
79 if (fBegin != &(fBeginBuffer[0])) {
100 fIterators(proxy,read_from_file)
114 virtual void *Next() = 0;
118 virtual operator bool()
const = 0;
135 fNext( proxy->GetFunctionNext(read_from_file) ),
143 fCurrent = fNext(fIterators.fBegin,fIterators.fEnd);
149 operator bool()
const {
return fStarted ? fCurrent != 0 :
kTRUE; }
159 if ((
bool)*
this)
return fHasPointer ? *(
void**)fIterators.fBegin : fIterators.fBegin;
166 fIncrement(proxy->GetIncrement()),
167 fHasPointer(proxy->HasPointers())
172 if ( ! (
bool)*
this )
return 0;
173 void *
result = GetValue();
174 fIterators.fBegin = ((
char*)fIterators.fBegin) + fIncrement;
180 operator bool()
const {
return fIterators.fBegin != fIterators.fEnd; }
244 fBegin( &(fRawBeginBuffer[0]) ),
245 fEnd( &(fRawEndBuffer[0]) )
257 ::Fatal(
"TIterators::TIterators",
"Created with out a collection proxy!\n");
265 fBegin = &(fRawBeginBuffer[0]);
266 fEnd = &(fRawEndBuffer[0]);
268 if (fBegin != &(fRawBeginBuffer[0])) {
286 static void *
Next(
void *iter,
const void *end)
291 void **ptr = (
void**)internal_iter->
fNext(internal_iter->
fIter,internal_end->
fIter);
309 void *newiter = internal_source->
fCopy(dest,internal_source->
fIter);
310 if (newiter == dest) {
313 internal_dest->
fIter = newiter;
314 return internal_dest;
356 std::vector<char> *vec = (std::vector<char>*)collection;
362 fBegin= &(*vec->begin());
363 #ifdef R__VISUAL_CPLUSPLUS 364 fEnd = &(*(vec->end()-1)) + 1;
367 fEnd = &(*vec->end());
373 #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
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()