66 Warning(
"TObjArray",
"size (%d) < 0", s);
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;
448 void TObjArray::Streamer(
TBuffer &
b)
455 TObject::Streamer(b);
466 for (
Int_t i = 0; i < nobjects; i++) {
479 TObject::Streamer(b);
485 for (
Int_t i = 0; i < nobjects; i++) {
579 return &
fCont[index];
596 for (i = 0; i <
fSize; i++)
600 for (i = 0; i <
fSize; i++)
644 Error(where,
"index %d out of bounds (size: %d, this: 0x%lx)", i,
fSize, (
Long_t)
this);
661 for (
int i = 0; i <
fSize; i++) {
680 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
711 if (idx == -1)
return 0;
729 if (!
BoundsOk(
"RemoveRange", idx1))
return;
730 if (!
BoundsOk(
"RemoveRange", idx2))
return;
747 if (idx1 < fLast || fLast > idx2)
return;
763 if (last == -2 || last == -1)
783 for (
Int_t i = 0; i < ntimes; i++) {
790 if (k == j)
continue;
810 Error(
"Sort",
"objects in array are not sortable");
829 Int_t base, position, last, result = 0;
835 Error(
"BinarySearch",
"array must first be sorted");
842 while (last >= base) {
843 position = (base+last) / 2;
844 op2 =
fCont[position];
845 if (op2 && (result = op->
Compare(op2)) == 0)
847 if (!op2 || result < 0)
922 if (fCursor < fArray->Capacity()) {
956 const TObjArrayIter &iter(dynamic_cast<const TObjArrayIter &>(aIter));
975 return (((
fCurCursor >= 0) && (fCurCursor < fArray->Capacity())) ?
static void Dealloc(void *ptr)
De-allocate block of memory, that was allocated via TStorage::Alloc().
TObjArray(Int_t s=TCollection::kInitCapacity, Int_t lowerBound=0)
Create an object array.
virtual Int_t AddAtFree(TObject *obj)
Return the position of the new object.
virtual void Sort(Int_t upto=kMaxInt)
If objects in array are sortable (i.e.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
virtual void Clear(Option_t *option="")
Remove all objects from the array.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual TObject * Remove(TObject *obj)
Remove object from array.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Randomize(Int_t ntimes=1)
Randomize objects inside the array, i.e.
Short_t Min(Short_t a, Short_t b)
Iterator of object array.
virtual void AddFirst(TObject *obj)
Add object in the first slot of the array.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
TObject ** GetObjectRef() const
Iterator abstract base class.
virtual void RemoveRange(Int_t idx1, Int_t idx2)
Remove objects from index idx1 to idx2 included.
virtual TObject *& operator[](Int_t i)
Return the object at position i.
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
Sequenceable collection abstract base class.
void SetLast(Int_t last)
Set index of last object in array, effectively truncating the array.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
virtual void AddAfter(const TObject *after, TObject *obj)
Add object in the slot after object after.
Bool_t OutOfBoundsError(const char *where, Int_t i) const
Generate an out-of-bounds error. Always returns false.
virtual ~TObjArray()
Delete an array.
TObjArray & operator=(const TObjArray &)
Assignment operator. Note, unsets the kIsOwner flag.
TObject * Next()
Return next object in array. Returns 0 when no more objects in array.
#define R__COLLECTION_READ_LOCKGUARD(mutex)
void Reset()
Reset array iterator.
R__EXTERN TVirtualRWMutex * gCoreMutex
const Bool_t kIterForward
virtual Int_t BinarySearch(TObject *obj, Int_t upto=kMaxInt)
Find object using a binary search.
object has not been deleted
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
TObject * First() const
Return the object in the first slot.
Int_t GetLast() const
Return index of last object in array.
friend class TObjArrayIter
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
R__ALWAYS_INLINE Bool_t IsOnHeap() const
Int_t GetEntriesFast() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void Init(Int_t s, Int_t lowerBound)
Initialize a TObjArray.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
void Reset(Detail::TBranchProxy *x)
static void QSort(TObject **a, Int_t first, Int_t last)
Sort array of TObject pointers using a quicksort algorithm.
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
Int_t fLowerBound
Array contents.
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.
Bool_t BoundsOk(const char *where, Int_t at) const
Int_t GetAbsLast() const
Return absolute index to last object in array.
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns an array iterator.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
Int_t IndexOf(const TObject *obj) const
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
static constexpr double s
virtual void * ReadObjectAny(const TClass *cast)=0
TObject * Before(const TObject *obj) const
Return the object before obj. Returns 0 if obj is first object.
Mother of all ROOT objects.
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
TObject * operator*() const
Return current object or nullptr.
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Short_t Max(Short_t a, Short_t b)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Int_t GetEntries() const
Return the number of objects in array (i.e.
TObject * After(const TObject *obj) const
Return the object after obj. Returns 0 if obj is last object.
virtual void AddLast(TObject *obj)
Add object in the next empty slot in the array.
#define R__COLLECTION_WRITE_LOCKGUARD(mutex)
virtual void Compress()
Remove empty slots from array.
Bool_t IsSortable() const
virtual const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual void AddBefore(const TObject *before, TObject *obj)
Add object in the slot before object before.