TCollection


class description - source file - inheritance tree

class TCollection : public TObject

    private:
void operator=(const TCollection&) protected:
public:
virtual void ~TCollection() virtual void Add(TObject* obj) virtual void AddAll(TCollection* col) void AddVector(TObject* obj1) Bool_t AssertClass(TClass* cl) const virtual void Browse(TBrowser* b) Int_t Capacity() const static TClass* Class() virtual void Clear(Option_t* option) Bool_t Contains(const char* name) const Bool_t Contains(const TObject* obj) const virtual void Delete(Option_t* option) virtual void Draw(Option_t* option) virtual void Dump() const static void EmptyGarbageCollection() virtual TObject* FindObject(const char* name) const virtual TObject* FindObject(const TObject* obj) const static void GarbageCollect(TObject* obj) static TCollection* GetCurrentCollection() virtual const char* GetName() const virtual TObject** GetObjectRef(TObject* obj) const virtual Int_t GetSize() const virtual Int_t GrowBy(Int_t delta) const virtual TClass* IsA() const Bool_t IsArgNull(const char* where, const TObject* obj) const virtual Bool_t IsEmpty() const virtual Bool_t IsFolder() const Bool_t IsOwner() const virtual void ls(Option_t* option) const virtual TIterator* MakeIterator(Bool_t dir = kIterForward) const virtual TIterator* MakeReverseIterator() const TObject* operator()(const char* name) const virtual void Paint(Option_t* option) virtual void Print(Option_t* option) const virtual void RecursiveRemove(TObject* obj) virtual TObject* Remove(TObject* obj) virtual void RemoveAll(TCollection* col) void RemoveAll() void SetCurrentCollection() void SetName(const char* name) void SetOwner(Bool_t enable = kTRUE) virtual void ShowMembers(TMemberInspector& insp, char* parent) static void StartGarbageCollection() virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual Int_t Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)

Data Members

    private:
static TCollection* fgCurrentCollection used by macro ForEach static TObjectTable* fgGarbageCollection used by garbage collector static Bool_t fgEmptyingGarbage used by garbage collector static Int_t fgGarbageStack used by garbage collector protected:
TString fName name of the collection Int_t fSize number of elements in collection public:
static const enum TObject:: kIsOwner static const enum TObject:: kInitCapacity static const enum TObject:: kInitHashTableCapacity


See also

THashTable, TMap, TSeqCollection

Class Description

                                                                      
 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.           
                                                                      

/*

*/



void AddAll(TCollection *col)
 Add all objects from collection col to this collection.

void AddVector(TObject *va_(obj1), ...)
 Add all arguments to this collection.

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

void Draw(Option_t *option)
 Draw all objects in this collection.
 wildcarding supported, eg option="xxx*" draws only objects
 with names xxx*

void Dump() const
 Dump all objects in this collection.

TObject* FindObject(const char *name) const
 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 *obj) const
 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() const
 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 *option) const
 Print all objects in this collection.
 wildcarding supported, eg option="xxx*" prints only objects
 with names 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 not recursive, collections in the collection
 are written with a single key. To write all objects using a single
 key specify a name and set option to TObject::kSingleKey (i.e. 1).

TCollection* GetCurrentCollection()

void SetCurrentCollection()

void StartGarbageCollection()

void EmptyGarbageCollection()

void GarbageCollect(TObject *obj)



Inline Functions


               void operator=(const TCollection&)
               void Add(TObject* obj)
              Int_t Capacity() const
               void Clear(Option_t* option)
             Bool_t Contains(const char* name) const
             Bool_t Contains(const TObject* obj) const
               void Delete(Option_t* option)
           TObject* operator()(const char* name) const
          TObject** GetObjectRef(TObject* obj) const
              Int_t GetSize() const
             Bool_t IsEmpty() const
             Bool_t IsFolder() const
             Bool_t IsOwner() const
         TIterator* MakeIterator(Bool_t dir = kIterForward) const
         TIterator* MakeReverseIterator() const
           TObject* Remove(TObject* obj)
               void RemoveAll()
               void SetName(const char* name)
               void SetOwner(Bool_t enable = kTRUE)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void StreamerNVirtual(TBuffer& b)
               void ~TCollection()


Author: Fons Rademakers 13/08/95
Last update: root/cont:$Name: $:$Id: TCollection.cxx,v 1.14 2001/04/19 07:25:18 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - 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.