ROOT logo
ROOT » GRAF2D » GPAD » TClassTree

class TClassTree: public TNamed

 Draw inheritance tree and their relations for a list of classes
 The following options are supported
   - Direct inheritance (default)
   - Multiple inheritance
   - Composition
   - References by data members and member functions
   - References from Code

 The list of classes is specified:
   - either in the TClassTree constructor as a second argument
   - or the parameter to TClassTRee::Draw

 Note that the ClassTree viewer can also be started from the canvas
 pull down menu "Classes".

 In the list of classes, class names are separated by a ":"
 wildcarding is supported.
 The following formats are supported, eg in TClassTree::Draw
   1- Draw("ClassA")
         Draw inheritance tree for ClassA
         Show all classes referenced by ClassA
   2- Draw("*ClassB")
         Draw inheritance tree for ClassB
         and all the classes deriving from ClassB
   3- Draw(">ClassC")
         Draw inheritance tree for ClassC
         Show classes referencing ClassC
   4- Draw("ClassD<")
         Draw inheritance tree for ClassD
         Show classes referenced by ClassD
         Show all classes referencing ClassD
   5- Draw("Cla*")
         Draw inheritance tree for all classes with name starting with "Cla"
         Show classes referenced by these classes
   6- Draw("ClassA:ClassB<")
         Draw inheritance tree for ClassA
         Show all classes referenced by ClassA
         Draw inheritance tree for ClassB
         Show classes referenced by ClassB
         Show all classes referencing ClassB

  example;  Draw("TTree<")
         Draw inheritance tree for the Root class TTree
         Show all classes referenced by TTree
         Show all classes using TTree

 By default, only direct inheritance is drawn.
 Use TClassTree::ShowLinks(option) to show additional references
   option = "H" to show links to embedded classes
   option = "M" to show multiple inheritance
   option = "R" to show pointers to other classes from data members
   option = "C" to show classes used by the code(implementation) of a class

 The following picture is produced directly by:
       TClassTree ct("ct","*TH1")
 It shows all the classes derived from the base class TH1.

/* */

 The ClassTree class uses the services of the class TPaveClass to
 show the class names. By clicking with the right mouse button in
 one TPaveClass object, one can invoke the following functions of TClassTree:
   - ShowLinks(option) with by default option = "HMR"
   - Draw(classes). By default the class drawn is the one being pointed
   - ShowClassesUsedBy(classes) (by default the pointed class)
   - ShowClassesUsing(classes) (by default the pointed class)

  The following picture has been generated with the following statements
       TClassTree tc1("tc1","TObject");

/* */

 Note that in case of embedded classes or pointers to classes,
 the corresponding dashed lines or arrows respectively start
 in the TPaveClass object at an X position reflecting the position
 in the list of data members.

  - References by data members to other classes are show with a full red line
  - Multiple inheritance is shown with a dashed blue line
  - "Has a" relation is shown with a dotted cyan line
  - References from code is shown by a full green line

  Use TClassTree::SetSourceDir to specify the search path for source files.
  By default the search path includes the ROOTSYS/src directory, the current
  directory and the subdirectory src.

  The first time TClassTree::Draw is invoked, all the classes in the
  current application are processed, including the parsing of the code
  to find all classes referenced by the include statements.
  This process may take a few seconds. The following commands will be
  much faster.

  A TClassTree object may be saved in a Root file.
  This object can be processed later by a Root program that ignores
  the original classes. This interesting possibility allows to send
  the class structure of an application to a colleague who does not have
  your classes.
    TFile f("myClasses.root","recreate")
    TClassTree *ct = new TClassTree("ct","ATLF*")
  You can send at this point the file myClass.root to a colleague who can
  run the following Root basic session
     TFile f("myClass.root"); //connect the file;                 //to list all classes and titles
     tt.Draw("ATLFDisplay")   //show class ATLFDisplay with all its dependencies
  At this point, one has still access to all the classes present
  in the original session and select any combination of these classes
  to be displayed.

Function Members (Methods)

TClassTree(const TClassTree&)
TClassTree(const char* name, const char* classes = "")
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(const char* classes = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
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 voidTNamed::FillBuffer(char*& buffer)
virtual Int_tFindClass(const char* classname)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
const char*GetClasses() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*GetSourceDir() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() 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() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
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)
TClassTree&operator=(const TClassTree&)
virtual voidPaint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidSaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidSetClasses(const char* classes, Option_t* option = "ID")
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetLabelDx(Float_t labeldx = 0.15)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetSourceDir(const char* dir = "src")
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidSetYoffset(Float_t offset = 0)
virtual voidShowClassesUsedBy(const char* classes)
virtual voidShowClassesUsing(const char* classes)
virtual voidShowLinks(Option_t* option = "HMR")
virtual voidShowMembers(TMemberInspector& insp)
virtual Int_tTNamed::Sizeof() const
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_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual voidFindClassesUsedBy(Int_t iclass)
virtual voidFindClassesUsing(Int_t iclass)
virtual voidFindClassPosition(const char* classname, Float_t& x, Float_t& y)
virtual voidInit()
TObjString*Mark(const char* classname, TList* los, Int_t abit)
virtual voidPaintClass(Int_t iclass, Float_t xleft, Float_t y)
virtual voidScanClasses(Int_t iclass)
virtual voidShowCod()
virtual voidShowHas()
virtual voidShowMul()
virtual voidShowRef()

Data Members

TStringfClassesList of classes to be drawn
TString**fCnames![fNclasses] class names
Int_t*fCparent!parent number of classes (temporary)
TClass**fCpointer![fNclasses] pointers to the TClass objects
Int_t*fCstatus[fNclasses] classes status
TString**fCtitles![fNclasses] class titles
char**fDerived![fNclasses] table to indicate if i derives from j
Float_tfLabelDxwidth along x of TPaveLabels in per cent of pad
TList**fLinks![fNclasses] for each class, the list of referenced(ing) classes
TStringTNamed::fNameobject identifier
Int_tfNclassescurrent number of classes
Int_t*fNdata[fNclasses] Number of data members per class
TString**fOptions![fNclasses] List of options per class
Int_t*fParents[fNclasses] parent number of classes (permanent)
Int_tfShowCodif 1 show classes referenced by implementation
Int_tfShowHasif 1 show "has a" relationship
Int_tfShowMulif 1 show multiple inheritance
Int_tfShowRefif 1 show classes relationship other than inheritance
TStringfSourceDirConcatenated source directories
TStringTNamed::fTitleobject title
Float_tfYoffsetoffset at top of picture in per cent of pad

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

 TClassTree default constructor.
TClassTree(const char* name, const char* classes = "")
 TClassTree constructor.
 TClassTree default destructor.
void Draw(const char* classes = "")
 Draw the inheritance tree and relations for the list of classes
 see this class header for the syntax and examples
Int_t FindClass(const char* classname)
  Find class number corresponding to classname in list of local classes
void FindClassesUsedBy(Int_t iclass)
  Select all classes used/referenced by the class number iclass
void FindClassesUsing(Int_t iclass)
  Select all classes using/referencing the class number iclass
void FindClassPosition(const char* classname, Float_t& x, Float_t& y)
 Search the TPaveClass object in the pad with label=classname
 returns the x and y position of the center of the pave.
void Init()
 Initialize the data structures
void ls(Option_t* option = "") const
 list classes names and titles
TObjString * Mark(const char* classname, TList* los, Int_t abit)
 set bit abit in class classname in list los
void Paint(Option_t* option = "")
 Draw the current class setting in fClasses and fStatus
void PaintClass(Int_t iclass, Float_t xleft, Float_t y)
 Paint one class level
void SaveAs(const char* filename = "", Option_t* option = "") const
 save current configuration in a Root file
 if filename is blank, the name of the file will be the current objectname.root
 all the current settings are preserved
 the Root file produced can be looked at by a another Root session
 with no access to the original classes.
 By default a message is printed. Specify option "Q" to remove the message
void ScanClasses(Int_t iclass)
  Select all classes used by/referenced/referencing the class number iclass
  and build the list of these classes
void SetClasses(const char* classes, Option_t* option = "ID")
 Set the list of classes for which the hierarchy is to be drawn
 See Paint for the syntax
void SetLabelDx(Float_t labeldx = 0.15)
 Set the size along x of the TPavellabel showing the class name
void SetYoffset(Float_t offset = 0)
 Set the offset at the top of the picture
 The default offset is computed automatically taking into account
 classes not inheriting from TObject.
void ShowClassesUsedBy(const char* classes)
 mark classes used by the list of classes in classes
void ShowClassesUsing(const char* classes)
 mark classes using any class in the list of classes in classes
void ShowCod()
 Draw the Code References relationships
void ShowHas()
 Draw the "Has a" relationships
void ShowLinks(Option_t* option = "HMR")
 Set link options in the ClassTree object

   "C"  show References from code
   "H"  show Has a relations
   "M"  show Multiple Inheritance
   "R"  show References from data members
void ShowMul()
 Draw the Multiple inheritance relationships
void ShowRef()
 Draw the References relationships (other than inheritance or composition)
void Streamer(TBuffer& b)
 Stream an object of class TClassTree.
 the status of the object is saved and can be replayed in a subsequent session
const char * GetClasses() const
{return fClasses.Data();}
const char * GetSourceDir() const
{return fSourceDir.Data();}
void SetSourceDir(const char* dir = "src")
{fSourceDir = dir;}