library: libCore #include "TCollection.h"

# TCollection

class description - source file - inheritance tree (.pdf)

## class TCollection : public TObject

| Inheritance Chart:

`TObject`

<-

`TCollection`

<-

`THashTable` |

`TMap` |

`TSeqCollection`

<-

`TBtree` |

`TList`

<-

`TGridResult` |

`THashList` |

`TQCommand`

<-

`TQUndoManager` |

`TQConnection` |

[more...]

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

        private:

          void operator=(const TCollection&)

        public:

                      virtual ~TCollection()
                 virtual void Add(TObject* obj)
                 virtual void AddAll(const 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 = "")
                virtual Int_t Compare(const TObject* obj) const
                       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 Int_t GetEntries() const
          virtual const char* GetName() const
            virtual TObject** GetObjectRef(const TObject* obj) const
                virtual Int_t GetSize() const
                virtual Int_t GrowBy(Int_t delta) const
              virtual ULong_t Hash() 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 Bool_t IsSortable() 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* wildcard = "") const
                 virtual void Print(Option_t* wildcard, 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)
                virtual Int_t Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const

### 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 TCollection:: kIsOwner
          static const enum TCollection:: kInitCapacity
          static const enum TCollection:: kInitHashTableCapacity

## 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(const 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

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() 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 *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) const

     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()

void SetCurrentCollection()

void StartGarbageCollection()

void EmptyGarbageCollection()

void GarbageCollect(TObject *obj)

### Inline Functions

                   void ~TCollection()
                   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
                  Int_t GetEntries() const
              TObject** GetObjectRef(const TObject* obj) const
                  Int_t GetSize() const
                ULong_t Hash() const
                 Bool_t IsEmpty() const
                 Bool_t IsFolder() const
                 Bool_t IsOwner() const
                 Bool_t IsSortable() 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)

Author: Fons Rademakers 13/08/95
Last update: root/cont:$Name: $:$Id: TCollection.cxx,v 1.29 2005/06/23 06:24:27 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *