library: libCore #include "TObjArray.h" |
TObjArray
class description - header file - source file - inheritance tree (.pdf)
protected:
Bool_t BoundsOk(const char* where, Int_t at) const
Int_t GetAbsLast() const
void Init(Int_t s, Int_t lowerBound)
Bool_t OutOfBoundsError(const char* where, Int_t i) const
public:
TObjArray(Int_t s = TCollection::kInitCapacity, Int_t lowerBound = 0)
TObjArray(const TObjArray& a)
virtual ~TObjArray()
virtual void Add(TObject* obj)
virtual void AddAfter(const TObject* after, TObject* obj)
virtual void AddAt(TObject* obj, Int_t idx)
virtual void AddAtAndExpand(TObject* obj, Int_t idx)
virtual Int_t AddAtFree(TObject* obj)
virtual void AddBefore(const TObject* before, TObject* obj)
virtual void AddFirst(TObject* obj)
virtual void AddLast(TObject* obj)
virtual TObject* After(const TObject* obj) const
virtual TObject* At(Int_t i) const
virtual TObject* Before(const TObject* obj) const
virtual Int_t BinarySearch(TObject* obj, Int_t upto = kMaxInt)
static TClass* Class()
virtual void Clear(Option_t* option = "")
virtual void Compress()
virtual void Delete(Option_t* option = "")
virtual void Expand(Int_t newSize)
virtual TObject* FindObject(const char* name) const
virtual TObject* FindObject(const TObject* obj) const
virtual TObject* First() const
virtual Int_t GetEntries() const
Int_t GetEntriesFast() const
Int_t GetLast() const
virtual TObject** GetObjectRef(const TObject* obj) const
virtual Int_t IndexOf(const TObject* obj) const
virtual TClass* IsA() const
virtual Bool_t IsEmpty() const
virtual TObject* Last() const
Int_t LowerBound() const
virtual TIterator* MakeIterator(Bool_t dir = kIterForward) const
TObjArray& operator=(const TObjArray& toa)
virtual TObject*& operator[](Int_t i)
virtual TObject* operator[](Int_t i) const
virtual TObject* Remove(TObject* obj)
virtual TObject* RemoveAt(Int_t idx)
void SetLast(Int_t last)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Sort(Int_t upto = kMaxInt)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
TObject* UncheckedAt(Int_t i) const
protected:
TObject** fCont !Array contents
Int_t fLowerBound Lower bound of the array
Int_t fLast Last element in array containing an object
TObjArray
An array of TObjects. The array expands automatically when
objects are added (shrinking can be done by hand using Expand(),
how nice to have meaningful names -:)).
Use operator[] to have "real" array behaviour.
TObjArray(Int_t s, Int_t lowerBound)
Create an object array. Using s one can set the array size (default is
kInitCapacity=16) and lowerBound can be used to set the array lowerbound
index (default is 0).
void AddFirst(TObject *obj)
Add object in the first slot of the array. This will overwrite the
first element that might have been there. To have insertion semantics
use either a TList or a TOrdCollection.
void AddBefore(const TObject *before, TObject *obj)
Add object in the slot before object before. If before=0 add object
in the first slot. Note that this will overwrite any object that
might have already been in this slot. For insertion semantics use
either a TList or a TOrdCollection.
void AddAfter(const TObject *after, TObject *obj)
Add object in the slot after object after. If after=0 add object in
the last empty slot. Note that this will overwrite any object that
might have already been in this slot. For insertion semantics use
either a TList or a TOrdCollection.
void AddAt(TObject *obj, Int_t idx)
Add object at position ids. Give an error when idx is out of bounds
(i.e. the array is not expanded).
TObject * After(const TObject *obj)
Return the object after obj. Returns 0 if obj is last object.
TObject * Before(const TObject *obj)
Return the object before obj. Returns 0 if obj is first object.
TObject * FindObject(const char *name)
Find an object in this collection using its name. Requires a sequential
scan till the object has been found. Returns 0 if object with specified
name is not found.
TObject * FindObject(const TObject *iobj)
Find an object in this collection using the object's IsEqual()
member function. Requires a sequential scan till the object has
been found. Returns 0 if object is not found.
Typically this function is overridden by a more efficient version
in concrete collection classes (e.g. THashTable).
void Streamer(TBuffer &b)
Stream all objects in the array to or from the I/O buffer.
TObject * Last()
Return the object in the last filled slot. Returns 0 if no entries.
Int_t GetEntries()
Return the number of objects in array (i.e. number of non-empty slots).
Attention: use this method ONLY if you want to know the number of
non-empty slots. This function loops over the complete array and
is therefore very slow when applied in a loop. Most of the time you
better use GetEntriesFast() (only in case when there are no empty slots).
Int_t GetAbsLast()
Return absolute index to last object in array. Returns -1 in case
array is empty.
Int_t GetLast()
Return index of last object in array. Returns lowerBound-1 in case
array is empty.
Int_t IndexOf(const TObject *obj)
obj != 0 Return index of object in array.
Returns lowerBound-1 in case array doesn't contain the obj.
obj == 0 Return the index of the first empty slot.
Returns lowerBound-1 in case array doesn't contain any empty slot.
void SetLast(Int_t last)
Set index of last object in array, effectively truncating the
array. Use carefully since whenever last position has to be
recalculated, e.g. after a Remove() or Sort() it will be reset
to the last non-empty slot. If last is -2 this will force the
recalculation of the last used slot.
void Sort(Int_t upto)
If objects in array are sortable (i.e. IsSortable() returns true
for all objects) then sort array.
Int_t BinarySearch(TObject *op, Int_t upto)
Find object using a binary search. Array must first have been sorted.
Search can be limited by setting upto to desired index.
Author: Fons Rademakers 11/09/95
Last update: root/cont:$Name: $:$Id: TObjArray.cxx,v 1.26 2006/03/20 21:43:41 pcanal Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.