TCollection


class description - source file - inheritance tree

class TCollection : public TObject

    private:
void operator=(const TCollection&) public:
virtual void ~TCollection() virtual void Add(TObject* obj) virtual void AddAll(TCollection* col) void AddVector(TObject* obj1, int) Bool_t AssertClass(TClass* cl) const virtual void Browse(TBrowser* b) Int_t Capacity() const TClass* Class() virtual void Clear(Option_t* option) Bool_t Contains(const char* name) const Bool_t Contains(TObject* obj) const virtual void Delete(Option_t* option) virtual void Draw(Option_t* option) virtual void Dump() void EmptyGarbageCollection() virtual TObject* FindObject(const char* name) const virtual TObject* FindObject(TObject* obj) const void GarbageCollect(TObject* obj) TCollection* GetCurrentCollection() virtual const char* GetName() const TObject* GetParent() const virtual Int_t GetSize() const virtual Int_t GrowBy(Int_t delta) const virtual TClass* IsA() const Bool_t IsArgNull(const char* where, TObject* obj) const Bool_t IsEmpty() const virtual Bool_t IsFolder() virtual void ls(Option_t* option) 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) virtual void RecursiveRemove(TObject* obj) virtual TObject* Remove(TObject* obj) virtual void RemoveAll(TCollection* col) void RemoveAll() void SetCurrentCollection() virtual void SetName(const char* name) void SetParent(TObject* parent) virtual void ShowMembers(TMemberInspector& insp, char* parent) void StartGarbageCollection() virtual void Streamer(TBuffer& b) virtual void 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 TObject* fParent parent object of collection Int_t fSize number of elements in collection public:
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.

void Dump()
 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(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).

Int_t GrowBy(Int_t delta) const
 Increase the collection's capacity by delta slots.

Bool_t IsArgNull(const char *where, TObject *obj) const
 Returns true if object is a null pointer.

void ls(Option_t *option)
 List (ls) all objects in this collection.

void Paint(Option_t *option)
 Paint all objects in this collection.

void Print(Option_t *option)
 Print all objects in this collection.

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.

void 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). To write all objects using one key specify a name and
 set option to 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(TObject* obj) const
               void Delete(Option_t* option)
           TObject* operator()(const char* name) const
        const char* GetName() const
           TObject* GetParent() const
              Int_t GetSize() const
             Bool_t IsEmpty() const
             Bool_t IsFolder()
         TIterator* MakeIterator(Bool_t dir = kIterForward) const
         TIterator* MakeReverseIterator() const
           TObject* Remove(TObject* obj)
               void RemoveAll()
               void SetName(const char* name)
               void SetParent(TObject* parent)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void ~TCollection()


Author: Fons Rademakers 13/08/95
Last update: 2.23/12 26/01/2000 09.57.11 by Rene Brun
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


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.