66 Warning(
"TObjArray",
"size (%d) < 0", s);
131 if (j >= 0 && j <
fSize) {
187 Error(
"AddBefore",
"before not found, object not added");
211 Error(
"AddAfter",
"after not found, object not added");
225 Error(
"AddAt",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
241 if (!
BoundsOk(
"AddAt", idx))
return;
256 for (i = 0; i <
fSize; i++)
276 if (idx == -1 || idx ==
fSize-1)
return 0;
289 if (idx == -1 || idx == 0)
return 0;
322 for ( ; j <
fSize; j++)
343 const char *noreg =
"noregistration";
347 needRegister = needRegister && !
gROOT->GetListOfCleanups()->FindObject(
this);
351 gROOT->GetListOfCleanups()->Add(
this);
373 Error (
"Expand",
"newSize must be positive (%d)", newSize);
376 if (newSize ==
fSize)
378 if (newSize <
fSize) {
382 Error (
"Expand",
"expand would cut off nonempty entries at %d", j);
399 for (
Int_t i = 0; i < nobjects; ++i) {
401 if (obj && 0==strcmp(name, obj->
GetName()))
return obj;
416 for (
Int_t i = 0; i < nobjects; ++i) {
418 if (obj && obj->
IsEqual(iobj))
return obj;
426 void TObjArray::Streamer(
TBuffer &
b)
433 TObject::Streamer(b);
444 for (
Int_t i = 0; i < nobjects; i++) {
455 TObject::Streamer(b);
461 for (
Int_t i = 0; i < nobjects; i++) {
542 return &
fCont[index];
556 for (i = 0; i <
fSize; i++)
560 for (i = 0; i <
fSize; i++)
601 Error(where,
"index %d out of bounds (size: %d, this: 0x%lx)", i,
fSize, (
Long_t)
this);
613 for (
int i = 0; i <
fSize; i++) {
632 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
659 if (idx == -1)
return 0;
677 if (!
BoundsOk(
"RemoveRange", idx1))
return;
678 if (!
BoundsOk(
"RemoveRange", idx2))
return;
693 if (idx1 < fLast || fLast > idx2)
return;
707 if (last == -2 || last == -1)
725 for (
Int_t i = 0; i < ntimes; i++) {
732 if (k == j)
continue;
750 Error(
"Sort",
"objects in array are not sortable");
773 Error(
"BinarySearch",
"array must first be sorted");
780 while (last >= base) {
781 position = (base+last) / 2;
782 op2 =
fCont[position];
783 if (op2 && (result = op->
Compare(op2)) == 0)
785 if (!op2 || result < 0)
860 if (fCursor < fArray->Capacity()) {
894 const TObjArrayIter &iter(dynamic_cast<const TObjArrayIter &>(aIter));
913 return (((
fCurCursor >= 0) && (fCurCursor < fArray->Capacity())) ?
static void Dealloc(void *ptr)
De-allocate block of memory, that was allocated via TStorage::Alloc().
virtual TObject * Remove(TObject *obj)=0
object has not been deleted
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.
TSeqCollection * GetListOfCleanups() const
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.
Bool_t TestBit(UInt_t f) const
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.
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.
R__EXTERN TVirtualMutex * gROOTMutex
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.
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
Bool_t OutOfBoundsError(const char *where, Int_t i) const
Generate an out-of-bounds error. Always returns false.
virtual ~TObjArray()
Delete an array.
void Init(TClassEdit::TInterpreterLookupHelper *helper)
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.
void Reset()
Reset array iterator.
const Bool_t kIterForward
virtual Int_t BinarySearch(TObject *obj, Int_t upto=kMaxInt)
Find object using a binary search.
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.
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)
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.
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
#define R__LOCKGUARD2(mutex)
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.
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.
virtual void Compress()
Remove empty slots from array.
Bool_t IsSortable() const
virtual const char * GetName() const
Returns name of object.
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.