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