class TCollection: public TObject


Collection abstract base class. This class describes the base
protocol all collection classes have to implement. The ROOT
collection classes always store pointers to objects that inherit
from TObject. They never adopt the objects. Therefore, it is the
user's responsability to take care of deleting the actual objects
once they are not needed anymore. In exceptional cases, when the
user is 100% sure nothing else is referencing the objects in the
collection, one can delete all objects and the collection at the
same time using the Delete() function.

Collections can be iterated using an iterator object (see
TIterator). Depending on the concrete collection class there may be
some additional methods of iterating. See the repective classes.

TCollection inherits from TObject since we want to be able to have
collections of collections.

In a later release the collections may become templatized.


/* */

Function Members (Methods)

 
    This is an abstract class, constructors will not be documented.
    Look at the header to check for available constructors.

public:
virtual~TCollection()
voidTObject::AbstractMethod(const char* method) const
virtual voidAdd(TObject* obj)
virtual voidAddAll(const TCollection* col)
voidAddVector(TObject* obj1)
virtual voidTObject::AppendPad(Option_t* option = "")
Bool_tAssertClass(TClass* cl) const
virtual voidBrowse(TBrowser* b)
Int_tCapacity() 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_tCompare(const TObject* obj) const
Bool_tContains(const char* name) const
Bool_tContains(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 voidDraw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidDump() const
static voidEmptyGarbageCollection()
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 voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*FindObject(const char* name) const
virtual TObject*FindObject(const TObject* obj) const
static voidGarbageCollect(TObject* obj)
static TCollection*GetCurrentCollection()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tGetEntries() const
virtual const char*TObject::GetIconName() const
virtual const char*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_tGetSize() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Int_tGrowBy(Int_t delta) const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tHash() 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_tIsArgNull(const char* where, const TObject* obj) const
virtual Bool_tIsEmpty() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsOwner() const
virtual Bool_tIsSortable() const
Bool_tTObject::IsZombie() const
virtual voidls(Option_t* option = "") const
virtual TIterator*MakeIterator(Bool_t dir = kIterForward) const
virtual TIterator*MakeReverseIterator() const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
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*operator()(const char* name) const
virtual voidPaint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* wildcard = "") const
virtual voidPrint(Option_t* wildcard, Option_t* option) const
virtual Int_tTObject::Read(const char* name)
virtual voidRecursiveRemove(TObject* obj)
virtual TObject*Remove(TObject* obj)
voidRemoveAll()
virtual voidRemoveAll(TCollection* col)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetCurrentCollection()
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
voidSetName(const char* name)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOwner(Bool_t enable = kTRUE)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
static voidStartGarbageCollection()
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
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tWrite(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tWrite(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
voidoperator=(const TCollection&)

Data Members

public:
enum { 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:
TStringfNamename of the collection
Int_tfSizenumber of elements in collection
private:
static TCollection*fgCurrentCollectionused by macro R__FOR_EACH
static Bool_tfgEmptyingGarbageused by garbage collector
static TObjectTable*fgGarbageCollectionused by garbage collector
static Int_tfgGarbageStackused by garbage collector

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void AddAll(const TCollection* col)
 Add all objects from collection col to this collection.
void AddVector(TObject *va_(obj1), ...)
 Add all arguments to the collection. The list of objects must be
 temrinated by 0, e.g.: l.AddVector(o1, o2, o3, o4, 0);
Bool_t AssertClass(TClass* cl) const
 Make sure all objects in this collection inherit from class cl.
void Browse(TBrowser* b)
 Browse this collection (called by TBrowser).
 If b=0, there is no Browse call TObject::Browse(0) instead.
         This means TObject::Inspect() will be invoked indirectly
Int_t Compare(const TObject* obj) const
 Compare two TCollection objects. Returns 0 when equal, -1 when this is
 smaller and +1 when bigger (like strcmp()).
void Draw(Option_t* option = "")
 Draw all objects in this collection.
 wildcarding supported, eg option="xxx*" draws only objects
 with names xxx*
void Dump()
 Dump all objects in this collection.
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 * operator()(const char* name) const
 Find an object in this collection by name.
TObject * FindObject(const TObject *obj)
 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).
const char * GetName()
 Return name of this collection.
 if no name, return the collection class name.
Int_t GrowBy(Int_t delta) const
 Increase the collection's capacity by delta slots.
Bool_t IsArgNull(const char* where, const TObject* obj) const
 Returns true if object is a null pointer.
void ls(Option_t* option = "") const
 List (ls) all objects in this collection.
 Wildcarding supported, eg option="xxx*" lists only objects
 with names xxx*.
void Paint(Option_t* option = "")
 Paint all objects in this collection.
void Print(Option_t* wildcard = "") const
 Print all objects in this collection.
 Wildcarding is supported, e.g. wildcard="xxx*" prints only objects
 with names matching xxx*.
void Print(Option_t* wildcard, Option_t* option) const
 Print all objects in this collection, passing option to the
 objects Print() method.
 Wildcarding is supported, e.g. wildcard="xxx*" prints only objects
 with names matching xxx*.
void RecursiveRemove(TObject* obj)
 Remove object from this collection and recursively remove the object
 from all other objects (and collections).
void RemoveAll(TCollection* col)
 Remove all objects in collection col from this collection.
void Streamer(TBuffer& b)
 Stream all objects in the collection to or from the I/O buffer.
Int_t Write(const char *name, Int_t option, Int_t bsize)
 Write all objects in this collection. By default all objects in
 the collection are written individually (each object gets its
 own key). Note, this is recursive, i.e. objects in collections
 in the collection are also written individually. To write all
 objects using a single key specify a name and set option to
 TObject::kSingleKey (i.e. 1).
Int_t Write(const char *name, Int_t option, Int_t bsize)
 Write all objects in this collection. By default all objects in
 the collection are written individually (each object gets its
 own key). Note, this is recursive, i.e. objects in collections
 in the collection are also written individually. To write all
 objects using a single key specify a name and set option to
 TObject::kSingleKey (i.e. 1).
TCollection * GetCurrentCollection()
 Return the globally accessible collection.
void SetCurrentCollection()
 Set this collection to be the globally accesible collection.
void StartGarbageCollection()
 Set up for garbage collection.
void EmptyGarbageCollection()
 Do the garbage collection.
void GarbageCollect(TObject* obj)
 Add to the list of things to be cleaned up.
void SetOwner(Bool_t enable = kTRUE)
 Set whether this collection is the owner (enable==true)
 of its content.  If it is the owner of its contents,
 these objects will be deleted whenever the collection itself
 is delete.   The objects might also be deleted or destructed when Clear
 is called (depending on the collection).
void operator=(const TCollection& )
virtual ~TCollection()
{ }
void Add(TObject* obj)
Int_t Capacity()
{ return fSize; }
void Clear(Option_t* option = "")
Bool_t Contains(const char *name)
{ return FindObject(name) != 0; }
Bool_t Contains(const TObject *obj)
{ return FindObject(obj) != 0; }
void Delete(Option_t* option = "")
Int_t GetEntries()
{ return GetSize(); }
TObject ** GetObjectRef(const TObject* obj) const
Int_t GetSize()
{ return fSize; }
ULong_t Hash()
{ return fName.Hash(); }
Bool_t IsEmpty()
{ return GetSize() <= 0; }
Bool_t IsFolder()
{ return kTRUE; }
Bool_t IsOwner()
{ return TestBit(kIsOwner); }
Bool_t IsSortable()
{ return kTRUE; }
TIterator * MakeIterator(Bool_t dir = kIterForward) const
TIterator * MakeReverseIterator()
{ return MakeIterator(kIterBackward); }
TObject * Remove(TObject* obj)
void RemoveAll(TCollection* col)
void SetName(const char* name)
{ fName = name; }

Author: Fons Rademakers 13/08/95
Last update: root/cont:$Id: TCollection.h 20882 2007-11-19 11:31:26Z rdm $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

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.