library: libCore #include "TObjectTable.h"

# TObjectTable

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

## class TObjectTable : public TObject

| Inheritance Chart:

`TObject`

<-

`TObjectTable`

        private:

            void Expand(Int_t newsize)
           Int_t FindElement(TObject* obj)
            void FixCollisions(Int_t index)
          Bool_t HighWaterMark()

        public:

                          TObjectTable(Int_t tableSize = 100)
                          TObjectTable(const TObjectTable&)
                          ~TObjectTable()
                     void Add(TObject* obj)
              static void AddObj(TObject* obj)
                    void* CheckPtrAndWarn(const char* msg, void* vp)
           static TClass* Class()
             virtual void Delete(Option_t* opt = "")
                    Int_t GetSize() const
                    Int_t Instances() const
                     void InstanceStatistics() const
          virtual TClass* IsA() const
            TObjectTable& operator=(const TObjectTable&)
             virtual void Print(Option_t* option = "") const
                   Bool_t PtrIsValid(TObject* obj)
                     void Remove(TObject* obj)
                     void RemoveQuietly(TObject* obj)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
                     void Statistics()
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                     void Terminate()
                     void UpdateInstCount() const

### Data Members

        private:

          TObject** fTable
              Int_t fSize
              Int_t fTally

## Class Description

     This class registers all instances of TObject and its derived
     classes in a hash table. The Add() and Remove() members are called
     from the TObject ctor and dtor, repectively. Using the Print()
     member one can see all currently active objects in the system.
     Using the resource (in .rootrc): Root.ObjectStat one can toggle this
     feature on or off.
     Using the compile option R__NOSTATS one can de-active this feature
     for the entire system (for maximum performance in highly time
     critical applications).

     The following output has been produced in a ROOT interactive session
     via the command gObjectTable->Print()
       class                     cnt    on heap     size    total size    heap size
       ============================================================================
       TKey                        4          4       72           288          288
       TClass                     84         84       80          6720         6720
       TDataMember               276        276       24          6624         6624
       TObject                    11         11       12           132          132
       TMethod                  1974       1974       64        126336       126336
       TDataType                  34         34       56          1904         1904
       TList                    2328       2328       36         83808        83808
       TH1F                        1          1      448           448          448
       TText                    2688       2688       56        150528       150528
       TGaxis                      1          0      120           120            0
       TAxis                       6          3       88           528          264
       TBox                       57         57       52          2964         2964
       TLine                     118        118       40          4720         4720
       TWbox                       1          1       56            56           56
       TArrow                      1          1       64            64           64
       TPaveText                  59         59      124          7316         7316
       TPave                       1          1       92            92           92
       TFile                       1          1      136           136          136
       TCanvas                     3          3      444          1332         1332
       TPad                        1          1      312           312          312
       TContextMenu                3          3       48           144          144
       TMethodArg               2166       2166       44         95304        95304
       TPaveLabel                  1          1      120           120          120
       THtml                       1          1       32            32           32
       TROOT                       1          0      208           208            0
       TApplication                1          1       28            28           28
       TFileHandler                1          1       20            20           20
       TColor                    163        163       40          6520         6520
       TStyle                      1          1      364           364          364
       TRealData                 117        117       28          3276         3276
       TBaseClass                 88         88       36          3168         3168
       THashList                   5          5       40           200          200
       THashTable                  5          5       36           180          180
       TGeometry                   1          1       64            64           64
       TLink                       7          7       60           420          420
       TPostScript                 1          1      764           764          764
       TMinuit                     1          1      792           792          792
       TStopwatch                  1          0       56            56            0
       TRootGuiFactory             1          1       28            28           28
       TGX11                       1          1      172           172          172
       TUnixSystem                 1          1      252           252          252
       TSignalHandler              1          1       20            20           20
       TOrdCollection              3          3       40           120          120
       TEnv                        1          1       24            24           24
       TCint                       1          1      208           208          208
       TBenchmark                  1          1       52            52           52
       TClassTable                 1          1       12            12           12
       TObjectTable                1          1       12            12           12
       ----------------------------------------------------------------------------
       Total:                  10225      10219     5976        506988       506340
       ============================================================================

TObjectTable(Int_t tableSize)

     Create an object table.

~TObjectTable()

     Delete TObjectTable.

void Print(Option_t *option) const

     Print the object table.
     If option ="all" prints the list of all objects with the format
     object number, pointer, class name, object name

void Add(TObject *op)

     Add an object to the object table.

void AddObj(TObject *op)

     Add an object to the global object table gObjectTable. If the global
     table does not exist create it first. This member function may only
     be used by TObject::TObject. Use Add() to add objects to any other
     TObjectTable object. This is a static function.

void Delete(Option_t *)

     Delete all objects stored in the TObjectTable.

void Remove(TObject *op)

     Remove an object from the object table.

void RemoveQuietly(TObject *op)

     Remove an object from the object table. If op is 0 or not in the table
     don't complain. Currently only used by the TClonesArray dtor. Should not
     be used anywhere else, except in places where "special" allocation and
     de-allocation tricks are performed.

void Terminate()

     Deletes the object table (this static class function calls the dtor).

Int_t FindElement(TObject *op)

     Find an object in the object table. Returns the slot where to put
     the object. To test if the object is actually already in the table
     use PtrIsValid().

void FixCollisions(Int_t index)

     Rehash the object table in case an object has been removed.

void Expand(Int_t newSize)

     Expand the object table.

void InstanceStatistics() const

     Print the object table.

void UpdateInstCount() const

     Histogram all objects according to their classes.

void* CheckPtrAndWarn(const char *msg, void *vp)

     Issue a warning in case an object still appears in the table
     while it should not.

### Inline Functions

                   Bool_t HighWaterMark()
                    Int_t GetSize() const
                    Int_t Instances() const
                   Bool_t PtrIsValid(TObject* obj)
                     void Statistics()
                  TClass* Class()
                  TClass* IsA() const
                     void ShowMembers(TMemberInspector& insp, char* parent)
                     void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
             TObjectTable TObjectTable(const TObjectTable&)
            TObjectTable& operator=(const TObjectTable&)

Author: Fons Rademakers 11/08/95
Last update: root/cont:$Name: $:$Id: TObjectTable.cxx,v 1.6 2001/10/18 13:07:28 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *