35 Warning(
"TOrdCollection",
"capacity (%d) < 0", capacity);
36 capacity = kDefaultCapacity;
37 }
else if (capacity == 0)
38 capacity = kDefaultCapacity;
115 Error(
"AddBefore",
"before not found, object not added");
136 Error(
"AddAfter",
"after not found, object not added");
152 if (idx == -1 || idx ==
fSize-1)
return 0;
175 if (idx == -1 || idx == 0)
return 0;
227 return &
fCont[index];
244 if (idx < 0 || idx >=
fSize) {
245 Error(method,
"index error (= %d) < 0 or > Size() (= %d)", idx,
fSize);
304 for (i =
fGapStart + fGapSize; i < stop; i++)
370 if (idx == -1)
return 0;
401 Error(
"Sort",
"objects in collection are not sortable");
422 Error(
"BinarySearch",
"collection must first be sorted");
430 while (last >= base) {
431 Int_t position = (base + last) / 2;
433 if ((obj2 == 0) || (result = obj->
Compare(obj2)) == 0)
506 if (fCursor < fCol->GetSize())
553 return (((
fCurCursor >= 0) && (fCurCursor < fCol->GetSize())) ?
static void Dealloc(void *ptr)
De-allocate block of memory, that was allocated via TStorage::Alloc().
void Init(Int_t capacity)
Initialize ordered collection.
void Delete(Option_t *option="")
Remove all objects from the collection AND delete all heap based objects.
TObject * After(const TObject *obj) const
Return the object after object obj.
void AddLast(TObject *obj)
Add object at the end of the collection.
TObject * operator*() const
Return current object or nullptr.
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return an ordered collection iterator.
TObject * First() const
Return the first object in the collection.
void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the collection.
Int_t PhysIndex(Int_t idx) const
Iterator abstract base class.
TObject ** GetObjectRef(const TObject *obj) const
return address of pointer obj
TObject * Next()
Return next object in collection.
void PutAt(TObject *obj, Int_t idx)
Put object at index idx. Overwrites what was at idx before.
const Bool_t kIterForward
void Reset()
Reset collection iterator.
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
~TOrdCollection()
Delete the collection.
TObject * Before(const TObject *obj) const
Returns the object before object obj.
Int_t LogIndex(Int_t idx) const
TObject * Last() const
Return the last object in the collection.
void SetCapacity(Int_t newCapacity)
Set/change ordered collection capacity.
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
TObject * RemoveAt(Int_t idx)
Remove object at index idx.
void AddFirst(TObject *obj)
Insert object at beginning of collection.
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
void Reset(Detail::TBranchProxy *x)
void Warning(const char *location, const char *msgfmt,...)
static void QSort(TObject **a, Int_t first, Int_t last)
Sort array of TObject pointers using a quicksort algorithm.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
TObject * Remove(TObject *obj)
Remove object from collection.
static void * Alloc(size_t size)
Allocate a block of memory, that later can be resized using TStorage::ReAlloc().
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
void MoveGapTo(Int_t newGapStart)
Move gap to new position.
void Sort()
If objects in collection are sortable (i.e.
Bool_t LowWaterMark() const
Int_t BinarySearch(TObject *obj)
Find object using a binary search.
Mother of all ROOT objects.
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
const TOrdCollection * fCol
Short_t Max(Short_t a, Short_t b)
void Clear(Option_t *option="")
Remove all objects from the collection.
Iterator of ordered collection.
void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the collection.
void AddAt(TObject *obj, Int_t idx)
Insert object at position idx in the collection.
Bool_t IsSortable() const
virtual Int_t GetSize() const
TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Bool_t IllegalIndex(const char *method, Int_t idx) const
Return true when index out of bounds and print error.
friend class TOrdCollectionIter