library: libCore
#include "TObjArray.h"

TObjArray


class description - header file - source file
viewCVS header - viewCVS source

class TObjArray: public TSeqCollection

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TObjArray(const TObjArray& a)
TObjArray(Int_t s = TCollection::kInitCapacity, Int_t lowerBound = 0)
virtual~TObjArray()
voidTObject::AbstractMethod(const char* method) const
virtual voidAdd(TObject* obj)
virtual voidAddAfter(const TObject* after, TObject* obj)
virtual voidTCollection::AddAll(const TCollection* col)
virtual voidAddAt(TObject* obj, Int_t idx)
virtual voidAddAtAndExpand(TObject* obj, Int_t idx)
virtual Int_tAddAtFree(TObject* obj)
virtual voidAddBefore(const TObject* before, TObject* obj)
virtual voidAddFirst(TObject* obj)
virtual voidAddLast(TObject* obj)
voidTCollection::AddVector(TObject* obj1)
virtual TObject*After(const TObject* obj) const
virtual voidTObject::AppendPad(Option_t* option = "")
Bool_tTCollection::AssertClass(TClass* cl) const
virtual TObject*At(Int_t i) const
virtual TObject*Before(const TObject* obj) const
virtual Int_tBinarySearch(TObject* obj, Int_t upto = kMaxInt)
virtual voidTCollection::Browse(TBrowser* b)
Int_tTCollection::Capacity() const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* option = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTCollection::Compare(const TObject* obj) const
virtual voidCompress()
Bool_tTCollection::Contains(const char* name) const
Bool_tTCollection::Contains(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidDelete(Option_t* option = "")
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTCollection::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTCollection::Dump() const
static voidTCollection::EmptyGarbageCollection()
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidExpand(Int_t newSize)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*FindObject(const char* name) const
virtual TObject*FindObject(const TObject* obj) const
virtual TObject*First() const
static voidTCollection::GarbageCollect(TObject* obj)
static TCollection*TCollection::GetCurrentCollection()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tGetEntries() const
Int_tGetEntriesFast() const
virtual const char*TObject::GetIconName() const
Int_tGetLast() const
virtual const char*TCollection::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
virtual TObject**GetObjectRef(const TObject* obj) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual Int_tTCollection::GetSize() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Int_tTCollection::GrowBy(Int_t delta) const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTCollection::Hash() const
virtual Int_tIndexOf(const TObject* obj) const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tTCollection::IsArgNull(const char* where, const TObject* obj) const
virtual Bool_tIsEmpty() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTCollection::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tTCollection::IsOwner() const
virtual Bool_tTCollection::IsSortable() const
virtual Bool_tTSeqCollection::IsSorted() const
Bool_tTObject::IsZombie() const
virtual TObject*Last() const
Int_tTSeqCollection::LastIndex() const
Int_tLowerBound() const
virtual voidTCollection::ls(Option_t* option = "") const
virtual TIterator*MakeIterator(Bool_t dir = kIterForward) const
virtual TIterator*TCollection::MakeReverseIterator() const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static Int_tTSeqCollection::ObjCompare(TObject* a, TObject* b)
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TObject*TCollection::operator()(const char* name) const
TObjArray&operator=(const TObjArray&)
virtual TObject*&operator[](Int_t i)
virtual TObject*operator[](Int_t i) const
virtual voidTCollection::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTCollection::Print(Option_t* wildcard = "") const
virtual voidTCollection::Print(Option_t* wildcard, Option_t* option) const
static voidTSeqCollection::QSort(TObject** a, Int_t first, Int_t last)
static voidTSeqCollection::QSort(TObject** a, TObject** b, Int_t first, Int_t last)
virtual voidRandomize(Int_t ntimes = 1)
virtual Int_tTObject::Read(const char* name)
virtual voidTCollection::RecursiveRemove(TObject* obj)
virtual TObject*Remove(TObject* obj)
virtual voidTSeqCollection::RemoveAfter(TObject* after)
voidTCollection::RemoveAll()
virtual voidTCollection::RemoveAll(TCollection* col)
virtual TObject*RemoveAt(Int_t idx)
virtual voidTSeqCollection::RemoveBefore(TObject* before)
virtual voidTSeqCollection::RemoveFirst()
virtual voidTSeqCollection::RemoveLast()
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidTCollection::SetCurrentCollection()
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
voidSetLast(Int_t last)
voidTCollection::SetName(const char* name)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTCollection::SetOwner(Bool_t enable = kTRUE)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidSort(Int_t upto = kMaxInt)
static voidTCollection::StartGarbageCollection()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TObject*UncheckedAt(Int_t i) const
voidTSeqCollection::UnSort()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTCollection::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTCollection::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
protected:
Bool_tBoundsOk(const char* where, Int_t at) const
virtual voidTSeqCollection::Changed()
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
Int_tGetAbsLast() const
voidInit(Int_t s, Int_t lowerBound)
voidTObject::MakeZombie()
Bool_tOutOfBoundsError(const char* where, Int_t i) const

Data Members

public:
enum TCollection::[unnamed] { kIsOwner
kInitCapacity
kInitHashTableCapacity
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TObject**fCont!Array contents
Int_tfLowerBoundLower bound of the array
Int_tfLastLast element in array containing an object
Bool_tTSeqCollection::fSortedtrue if collection has been sorted
TStringTCollection::fNamename of the collection
Int_tTCollection::fSizenumber of elements in collection

Class Description

                                                                      
 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).
TObjArray(const TObjArray &a)
 Create a copy of TObjArray a. Note, does not copy the kIsOwner flag.
~TObjArray()
 Delete an array. Objects are not deleted unless the TObjArray is the
 owner (set via SetOwner()).
TObjArray& operator=(const TObjArray &a)
 Assignment operator. Note, unsets the kIsOwner flag.
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 AddLast(TObject *obj)
 Add object in the next empty slot in the array. Expand the array
 if necessary.
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 AddAtAndExpand(TObject *obj, Int_t idx)
 Add object at position idx. If idx is larger than the current size
 of the array, expand the array (double its size).
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).
Int_t AddAtFree(TObject *obj)
 Return the position of the new object.
 Find the first empty cell or AddLast if there is no empty cell
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.
void Clear(Option_t *)
 Remove all objects from the array. Does not delete the objects
 unless the TObjArray is the owner (set via SetOwner()).
void Compress()
 Remove empty slots from array.
void Delete(Option_t *)
 Remove all objects from the array AND delete all heap based objects.
void Expand(Int_t newSize)
 Expand or shrink the array to newSize elements.
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 * First()
 Return the object in the first slot.
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.
TObject ** GetObjectRef(const TObject *obj)
 Return address of pointer obj. If obj is 0 returns address of container.
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 Init(Int_t s, Int_t lowerBound)
 Initialize a TObjArray.
TIterator * MakeIterator(Bool_t dir)
 Returns an array iterator.
Bool_t OutOfBoundsError(const char *where, Int_t i)
 Generate an out-of-bounds error. Always returns false.
TObject * RemoveAt(Int_t idx)
 Remove object at index idx.
TObject * Remove(TObject *obj)
 Remove object from array.
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 Randomize(Int_t ntimes)
Randomize objects inside the array, ie permute randomly objects.
fLast being the index of the last entry in the array, the following
algorithm is applied to the array.
 -for each entry j between 0 and fLast, another entry k is chosen randomly
  between 0 and fLast.
 -the objects at j and k are swapped.
 -this process is repeated ntimes (ntimes=1 by default)
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.
Bool_t BoundsOk(const char *where, Int_t at)
TObject *& operator[](Int_t i)
 Return the object at position i. Returns address at position 0
 if i is out of bounds. Result may be used as an lvalue.
TObject * operator[](Int_t i)
 Return the object at position at. Returns 0 if i is out of bounds.
TObject * At(Int_t i)
 Return the object at position i. Returns 0 if i is out of bounds.
Int_t GetEntriesFast()
{return GetAbsLast()+1;}
Bool_t IsEmpty()
{ return GetAbsLast() == -1; }
void Add(TObject *obj)
{ AddLast(obj); }
TObject * UncheckedAt(Int_t i)
{ return fCont[i-fLowerBound]; }
Int_t LowerBound()
{ return fLowerBound; }

Author: Fons Rademakers 11/09/95
Last update: root/cont:$Name: $:$Id: TObjArray.cxx,v 1.29 2006/11/11 15:21:30 brun 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.