66 Warning(
"TObjArray",
"size (%d) < 0",
s);
80 Init(
a.fSize,
a.fLowerBound);
115 Init(
a.fSize,
a.fLowerBound);
135 if (j >= 0 && j <
fSize) {
197 Error(
"AddBefore",
"before not found, object not added");
223 Error(
"AddAfter",
"after not found, object not added");
239 Error(
"AddAt",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
257 if (!
BoundsOk(
"AddAt", idx))
return;
274 for (i = 0; i <
fSize; i++)
296 if (idx == -1 || idx ==
fSize-1)
return 0;
311 if (idx == -1 || idx == 0)
return 0;
348 for ( ; j <
fSize; j++)
391 Error (
"Expand",
"newSize must be positive (%d)", newSize);
394 if (newSize ==
fSize)
396 if (newSize <
fSize) {
400 Error (
"Expand",
"expand would cut off nonempty entries at %d", j);
419 for (
Int_t i = 0; i < nobjects; ++i) {
421 if (obj && 0==strcmp(
name, obj->
GetName()))
return obj;
438 for (
Int_t i = 0; i < nobjects; ++i) {
440 if (obj && obj->
IsEqual(iobj))
return obj;
455 TObject::Streamer(
b);
466 for (
Int_t i = 0; i < nobjects; i++) {
474 b.CheckByteCount(R__s, R__c,TObjArray::IsA());
478 R__c =
b.WriteVersion(TObjArray::IsA(),
kTRUE);
479 TObject::Streamer(
b);
485 for (
Int_t i = 0; i < nobjects; i++) {
488 b.SetByteCount(R__c,
kTRUE);
594 return &
fCont[index];
611 for (i = 0; i <
fSize; i++)
615 for (i = 0; i <
fSize; i++)
659 Error(where,
"index %d out of bounds (size: %d, this: 0x%lx)", i,
fSize, (
Long_t)
this);
676 for (
int i = 0; i <
fSize; i++) {
695 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
726 if (idx == -1)
return 0;
744 if (!
BoundsOk(
"RemoveRange", idx1))
return;
745 if (!
BoundsOk(
"RemoveRange", idx2))
return;
762 if (idx1 < fLast || fLast > idx2)
return;
778 if (last == -2 || last == -1)
798 for (
Int_t i = 0; i < ntimes; i++) {
805 if (k == j)
continue;
825 Error(
"Sort",
"objects in array are not sortable");
844 Int_t base, position, last, result = 0;
850 Error(
"BinarySearch",
"array must first be sorted");
857 while (last >= base) {
858 position = (base+last) / 2;
859 op2 =
fCont[position];
860 if (op2 && (result = op->
Compare(op2)) == 0)
862 if (!op2 || result < 0)
937 if (fCursor < fArray->Capacity()) {
990 return (((
fCurCursor >= 0) && (fCurCursor < fArray->Capacity())) ?
#define R__unlikely(expr)
#define R__COLLECTION_READ_LOCKGUARD(mutex)
const Bool_t kIterForward
#define R__COLLECTION_WRITE_LOCKGUARD(mutex)
Buffer base class used for serializing objects.
Bool_t IsSortable() const
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
Iterator abstract base class.
Iterator of object array.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
void Reset()
Reset array iterator.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
TObject * operator*() const
Return current object or nullptr.
TObject * Next()
Return next object in array. Returns 0 when no more objects in array.
virtual Int_t AddAtFree(TObject *obj)
Return the position of the new object.
TObjArray & operator=(const TObjArray &)
Assignment operator. Note, unsets the kIsOwner flag.
Int_t IndexOf(const TObject *obj) const
Int_t GetEntriesFast() const
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
Int_t GetEntriesUnsafe() const
Return the number of objects in array (i.e.
virtual TObject *& operator[](Int_t i)
Return the object at position i.
TObject ** GetObjectRef() const
virtual ~TObjArray()
Delete an array.
void Init(Int_t s, Int_t lowerBound)
Initialize a TObjArray.
virtual void Sort(Int_t upto=kMaxInt)
If objects in array are sortable (i.e.
virtual void AddLast(TObject *obj)
Add object in the next empty slot in the array.
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
virtual void AddAfter(const TObject *after, TObject *obj)
Add object in the slot after object after.
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
virtual void Compress()
Remove empty slots from array.
Bool_t BoundsOk(const char *where, Int_t at) const
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual void Clear(Option_t *option="")
Remove all objects from the array.
Bool_t OutOfBoundsError(const char *where, Int_t i) const
Generate an out-of-bounds error. Always returns false.
virtual Int_t BinarySearch(TObject *obj, Int_t upto=kMaxInt)
Find object using a binary search.
TObject * After(const TObject *obj) const
Return the object after obj. Returns 0 if obj is last object.
TObject * First() const
Return the object in the first slot.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
virtual void AddBefore(const TObject *before, TObject *obj)
Add object in the slot before object before.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Int_t fLowerBound
Array contents.
Int_t GetAbsLast() const
Return absolute index to last object in array.
void SetLast(Int_t last)
Set index of last object in array, effectively truncating the array.
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns an array iterator.
virtual void Randomize(Int_t ntimes=1)
Randomize objects inside the array, i.e.
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Int_t GetLast() const
Return index of last object in array.
TObject * Before(const TObject *obj) const
Return the object before obj. Returns 0 if obj is first object.
virtual TObject * Remove(TObject *obj)
Remove object from array.
virtual void AddFirst(TObject *obj)
Add object in the first slot of the array.
virtual void RemoveRange(Int_t idx1, Int_t idx2)
Remove objects from index idx1 to idx2 included.
TObjArray(Int_t s=TCollection::kInitCapacity, Int_t lowerBound=0)
Create an object array.
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
friend class TObjArrayIter
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
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).
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
@ kNotDeleted
object has not been deleted
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.
Sequenceable collection abstract base class.
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().
R__EXTERN TVirtualRWMutex * gCoreMutex
static constexpr double s
Short_t Max(Short_t a, Short_t b)
Short_t Min(Short_t a, Short_t b)