66 Warning(
"TObjArray",
"size (%d) < 0", s);
131 if (j >= 0 && j <
fSize) {
187 Error(
"AddBefore",
"before not found, object not added");
191 Error(
"AddBefore",
"cannot add before lowerbound (%d)", fLowerBound);
194 AddAt(obj, idx+fLowerBound-1);
211 Error(
"AddAfter",
"after not found, object not added");
224 if (idx < fLowerBound) {
225 Error(
"AddAt",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
228 if (idx-fLowerBound >=
fSize)
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);
364 Init(fSize, fLowerBound);
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++)
565 return fLowerBound-1;
583 fLowerBound = lowerBound;
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()) {
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
ClassImp(TObjArray) TObjArray
Create an object array.
TObjArray(Int_t s=TCollection::kInitCapacity, Int_t lowerBound=0)
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.
virtual void Clear(Option_t *option="")
Remove all objects from the array.
Int_t GetLast() const
Return index of last object in 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.
Bool_t IsSortable() const
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
Int_t GetEntriesFast() const
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
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns an array iterator.
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.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Sequenceable collection abstract base class.
void SetLast(Int_t last)
Set index of last object in array, effectively truncating the array.
virtual void AddAfter(const TObject *after, TObject *obj)
Add object in the slot after object after.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
virtual ~TObjArray()
Delete an array.
void Init(TClassEdit::TInterpreterLookupHelper *helper)
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
std::map< std::string, std::string >::const_iterator iter
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.
TObject * First() const
Return the object in the first slot.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TSeqCollection * GetListOfCleanups() const
friend class TObjArrayIter
Int_t IndexOf(const TObject *obj) const
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
Bool_t TestBit(UInt_t f) const
TObject * Before(const TObject *obj) const
Return the object before obj. Returns 0 if obj is first object.
void Init(Int_t s, Int_t lowerBound)
Initialize a TObjArray.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
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.
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.
virtual const char * GetName() const
Returns name of object.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual void * ReadObjectAny(const TClass *cast)=0
TObject * operator*() const
Return current object or nullptr.
Mother of all ROOT objects.
Bool_t OutOfBoundsError(const char *where, Int_t i) const
Generate an out-of-bounds error. Always returns false.
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
TObject * After(const TObject *obj) const
Return the object after obj. Returns 0 if obj is last object.
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)
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
virtual void AddLast(TObject *obj)
Add object in the next empty slot in the array.
TObject ** GetObjectRef() const
Int_t GetAbsLast() const
Return absolute index to last object in array.
virtual void Compress()
Remove empty slots from array.
Bool_t BoundsOk(const char *where, Int_t at) const
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.