Logo ROOT   6.12/07
Reference Guide
TClassTree.cxx
Go to the documentation of this file.
1 // @(#)root/gpad:$Id$
2 // Author: Rene Brun 01/12/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "RConfigure.h"
13 
14 #include "TROOT.h"
15 #include "TClassTree.h"
16 #include "TClassTable.h"
17 #include "TClass.h"
18 #include "TBaseClass.h"
19 #include "TDataMember.h"
20 #include "TDataType.h"
21 #include "TRealData.h"
22 #include "TMethod.h"
23 #include "TMethodArg.h"
24 #include "TPad.h"
25 #include "TPaveClass.h"
26 #include "TArrow.h"
27 #include "TText.h"
28 #include "TSystem.h"
29 #include "TObjString.h"
30 #include "Riostream.h"
31 #include <algorithm>
32 
33 const Int_t kIsClassTree = BIT(7);
34 const Int_t kUsedByData = BIT(11);
35 const Int_t kUsedByFunc = BIT(12);
36 const Int_t kUsedByCode = BIT(13);
37 const Int_t kUsedByClass = BIT(14);
38 const Int_t kUsingData = BIT(15);
39 const Int_t kUsingFunc = BIT(16);
40 const Int_t kUsingCode = BIT(17);
41 const Int_t kUsingClass = BIT(18);
42 const Int_t kUsedByCode1 = BIT(19);
43 const Int_t kIsaPointer = BIT(20);
44 const Int_t kIsBasic = BIT(21);
45 
47 static Int_t *gNtsons, *gNsons;
48 
50 
51 /** \class TClassTree
52 \ingroup gpad
53 
54 Draw inheritance tree and their relations for a list of classes.
55 
56 The following options are supported
57  - Direct inheritance (default)
58  - Multiple inheritance
59  - Composition
60  - References by data members and member functions
61  - References from Code
62 
63 The list of classes is specified:
64  - either in the TClassTree constructor as a second argument
65  - or the parameter to TClassTree::Draw
66 
67 Note that the ClassTree viewer can also be started from the canvas
68 pull down menu "Classes".
69 
70 In the list of classes, class names are separated by a ":"
71 wildcarding is supported.
72 The following formats are supported, eg in TClassTree::Draw
73  1. `Draw("ClassA")`
74  - Draw inheritance tree for ClassA
75  - Show all classes referenced by ClassA
76  2. `Draw("*ClassB")`
77  - Draw inheritance tree for ClassB
78  and all the classes deriving from ClassB
79  3. `Draw(">ClassC")`
80  - Draw inheritance tree for ClassC
81  - Show classes referencing ClassC
82  4. `Draw("ClassD<")`
83  - Draw inheritance tree for ClassD
84  - Show classes referenced by ClassD
85  - Show all classes referencing ClassD
86  5. `Draw("Cla*")`
87  - Draw inheritance tree for all classes with name starting with "Cla"
88  - Show classes referenced by these classes
89  6. `Draw("ClassA:ClassB<")`
90  - Draw inheritance tree for ClassA
91  - Show all classes referenced by ClassA
92  - Draw inheritance tree for ClassB
93  - Show classes referenced by ClassB
94  - Show all classes referencing ClassB
95 
96 Example: `Draw("TTree<")`
97  - Draw inheritance tree for the Root class TTree
98  - Show all classes referenced by TTree
99  - Show all classes using TTree
100 
101 By default, only direct inheritance is drawn.
102 Use TClassTree::ShowLinks(option) to show additional references
103  - option = "H" to show links to embedded classes
104  - option = "M" to show multiple inheritance
105  - option = "R" to show pointers to other classes from data members
106  - option = "C" to show classes used by the code(implementation) of a class
107 
108 The following picture is produced directly by:
109 ~~~ {.cpp}
110  TClassTree ct("ct","*TH1")
111 ~~~
112 It shows all the classes derived from the base class TH1.
113 
114 \image html gpad_classtree1.png
115 
116 The TClassTree class uses the services of the class TPaveClass to
117 show the class names. By clicking with the right mouse button in
118 one TPaveClass object, one can invoke the following functions of TClassTree:
119  - ShowLinks(option) with by default option = "HMR"
120  - Draw(classes). By default the class drawn is the one being pointed
121  - ShowClassesUsedBy(classes) (by default the pointed class)
122  - ShowClassesUsing(classes) (by default the pointed class)
123 
124 The following picture has been generated with the following statements
125 ~~~ {.cpp}
126  TClassTree tc1("tc1","TH1");
127  tc1.ShowLinks("HMR");
128 ~~~
129 
130 \image html gpad_classtree2.png
131 
132 Note that in case of embedded classes or pointers to classes,
133 the corresponding dashed lines or arrows respectively start
134 in the TPaveClass object at an X position reflecting the position
135 in the list of data members.
136 
137  - References by data members to other classes are show with a full red line
138  - Multiple inheritance is shown with a dashed blue line
139  - "Has a" relation is shown with a dotted cyan line
140  - References from code is shown by a full green line
141 
142 Use TClassTree::SetSourceDir to specify the search path for source files.
143 By default the search path includes the `$ROOTSYS` directory, the current
144 directory and the subdirectory `src`.
145 
146 The first time TClassTree::Draw is invoked, all the classes in the
147 current application are processed, including the parsing of the code
148 to find all classes referenced by the include statements.
149 This process may take a few seconds. The following commands will be
150 much faster.
151 
152 A TClassTree object may be saved in a Root file.
153 This object can be processed later by a Root program that ignores
154 the original classes. This interesting possibility allows to send
155 the class structure of an application to a colleague who does not have
156 your classes.
157 
158 Example:
159 ~~~ {.cpp}
160  TFile f("myClasses.root","recreate")
161  TClassTree *ct = new TClassTree("ct","ATLF*")
162  ct->Write();
163 ~~~
164 You can send at this point the file myClass.root to a colleague who can
165 run the following Root basic session
166 ~~~ {.cpp}
167  TFile f("myClass.root"); //connect the file
168  tt.ls(); //to list all classes and titles
169  tt.Draw("ATLFDisplay") //show class ATLFDisplay with all its dependencies
170 ~~~
171 At this point, one has still access to all the classes present
172 in the original session and select any combination of these classes
173 to be displayed.
174 */
175 
176 ////////////////////////////////////////////////////////////////////////////////
177 /// TClassTree default constructor.
178 
180 {
181  fShowCod = 0;
182  fShowHas = 0;
183  fShowMul = 0;
184  fShowRef = 0;
185  fNclasses = 0;
186  fCstatus = 0;
187  fParents = 0;
188  fCparent = 0;
189  fCpointer = 0;
190  fCnames = 0;
191  fCtitles = 0;
192  fOptions = 0;
193  fLinks = 0;
194  fDerived = 0;
195  fNdata = 0;
196  SetLabelDx();
197  SetYoffset(0);
198  SetSourceDir(".:src:" + TROOT::GetSourceDir());
199 }
200 
201 ////////////////////////////////////////////////////////////////////////////////
202 /// TClassTree constructor.
203 
204 TClassTree::TClassTree(const char *name, const char *classes)
205  :TNamed(name,classes)
206 {
207  fShowCod = 0;
208  fShowHas = 0;
209  fShowMul = 0;
210  fShowRef = 0;
211  fNclasses = 0;
212  fCstatus = 0;
213  fParents = 0;
214  fCparent = 0;
215  fCpointer = 0;
216  fCnames = 0;
217  fCtitles = 0;
218  fOptions = 0;
219  fLinks = 0;
220  fDerived = 0;
221  fNdata = 0;
222  SetLabelDx();
223  SetYoffset(0);
224  SetSourceDir(".:src:" + TROOT::GetSourceDir());
225 
226  // draw list of classes (if specified)
227  if (classes && strlen(classes)) {
228  fClasses = classes;
229  Draw();
230  }
231 }
232 
233 ////////////////////////////////////////////////////////////////////////////////
234 /// TClassTree default destructor.
235 
237 {
238  for (Int_t i=0;i<fNclasses;i++) {
239  //delete fOptions[i];
240  if (fLinks[i]) fLinks[i]->Delete();
241  //delete fLinks[i];
242  //if (fDerived[i]) {delete [] fDerived[i]; fDerived[i] = 0;}
243  }
244  delete [] fCnames;
245  delete [] fCtitles;
246  delete [] fCstatus;
247  delete [] fParents;
248  delete [] fCparent;
249  delete [] fCpointer;
250  delete [] fOptions;
251  delete [] fLinks;
252  delete [] fDerived;
253  delete [] fNdata;
254 }
255 
256 ////////////////////////////////////////////////////////////////////////////////
257 /// Draw the inheritance tree and relations for the list of classes
258 /// see this class header for the syntax and examples
259 
260 void TClassTree::Draw(const char *classes)
261 {
262  if (!gPad) {
263  gROOT->MakeDefCanvas();
264  }
265  Init();
266  if (classes && strlen(classes)) fClasses = classes;
267  for (Int_t i=0;i<fNclasses;i++) {
268  fCstatus[i] = 0;
269  fCparent[i] = -1;
270  }
271  Paint();
272 }
273 
274 ////////////////////////////////////////////////////////////////////////////////
275 /// Find class number corresponding to classname in list of local classes
276 
277 Int_t TClassTree::FindClass(const char *classname)
278 {
279  for (Int_t i=0;i<fNclasses;i++) {
280  if(!fCnames[i]->CompareTo(classname)) return i;
281  }
282  return -1;
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 /// Select all classes used/referenced by the class number iclass
287 
289 {
290  fCstatus[iclass] = 1;
291  Int_t i;
292  TObjString *os;
293  TList *los = fLinks[iclass];
294  TIter next(los);
295  while ((os = (TObjString*)next())) {
296  i = FindClass(os->GetName());
297  if (i < 0) continue;
298  if (fCstatus[i]) continue;
299  Int_t udata = os->TestBit(kUsedByData);
300  Int_t ufunc = os->TestBit(kUsedByFunc);
301  Int_t ucode = os->TestBit(kUsedByCode);
302  Int_t uclass = os->TestBit(kUsedByClass);
303  if (udata || ufunc || ucode || uclass) {
304  fCstatus[i] = 1;
305  }
306  }
307 }
308 
309 ////////////////////////////////////////////////////////////////////////////////
310 /// Select all classes using/referencing the class number iclass
311 
313 {
314  // loop on all classes
315  fCstatus[iclass] = 1;
316  Int_t i;
317  TObjString *os;
318  TList *los = fLinks[iclass];
319  TIter next(los);
320  while ((os = (TObjString*)next())) {
321  i = FindClass(os->GetName());
322  if (i < 0) continue;
323  if (fCstatus[i]) continue;
324  Int_t udata = os->TestBit(kUsingData);
325  Int_t ufunc = os->TestBit(kUsingFunc);
326  Int_t ucode = os->TestBit(kUsingCode);
327  Int_t uclass = os->TestBit(kUsingClass);
328  if (udata || ufunc || ucode || uclass) {
329  fCstatus[i] = 1;
330  }
331  }
332 }
333 
334 ////////////////////////////////////////////////////////////////////////////////
335 /// Search the TPaveClass object in the pad with label=classname
336 /// returns the x and y position of the center of the pave.
337 
338 void TClassTree::FindClassPosition(const char *classname, Float_t &x, Float_t &y)
339 {
340  TIter next(gPad->GetListOfPrimitives());
341  TObject *obj;
342  TPaveClass *pave;
343  while((obj=next())) {
344  if (obj->InheritsFrom(TPaveClass::Class())) {
345  pave = (TPaveClass*)obj;
346  if (!strcmp(pave->GetLabel(),classname)) {
347  x = 0.5*(pave->GetX1() + pave->GetX2());
348  y = 0.5*(pave->GetY1() + pave->GetY2());
349  return;
350  }
351  }
352  }
353  x = y = 0;
354 }
355 
356 ////////////////////////////////////////////////////////////////////////////////
357 /// Initialize the data structures
358 
360 {
361  if (fNclasses) return;
362 
363  // fill the classes structures
364  gClassTable->Init();
365  fNclasses = gClassTable->Classes(); //number of classes in the application
366  fCnames = new TString*[fNclasses]; //class names
367  fCtitles = new TString*[fNclasses]; //class titles (given in ClassDef)
368  fCstatus = new Int_t[fNclasses]; //=0 if not used in current expression
369  fParents = new Int_t[fNclasses]; //parent number of classes (permanent)
370  fCparent = new Int_t[fNclasses]; //parent number of classes (local to expression)
371  fNdata = new Int_t[fNclasses]; //number of data members per class
372  fCpointer = new TClass*[fNclasses]; //pointers to the TClass
373  fOptions = new TString*[fNclasses]; //options per class
374  fLinks = new TList*[fNclasses]; //list of classes referencing/referenced
375  fDerived = new char*[fNclasses]; //derivation matrix
376 
377  Int_t i,j;
378  for (i=0;i<fNclasses;i++) {
379  fCnames[i] = new TString(gClassTable->Next());
380  fCpointer[i] = TClass::GetClass(fCnames[i]->Data());
381  fCtitles[i] = new TString(fCpointer[i]->GetTitle());
382  fCstatus[i] = 0;
383  fOptions[i] = new TString("ID");
384  fLinks[i] = new TList();
385  fDerived[i] = new char[fNclasses];
386  }
387  TBaseClass *clbase;
388  TClass *cl;
389  for (i=0;i<fNclasses;i++) {
391  if (lm) fNdata[i] = lm->GetSize();
392  else fNdata[i] = 0;
393  // build derivation matrix
394  char *derived = fDerived[i];
395  for (j=0;j<fNclasses;j++) {
396  derived[j] = 0;
397  if (fCpointer[i]->InheritsFrom(fCpointer[j])) {
398  derived[j] = 1;
399  }
400  }
401  //build list of class parent
402  fParents[i] = -1;
403  TList *lb = fCpointer[i]->GetListOfBases();
404  if (!lb) continue;
405  clbase = (TBaseClass*)lb->First();
406  if (clbase == 0) continue;
407  cl = (TClass*)clbase->GetClassPointer();
408  for (j=0;j<fNclasses;j++) {
409  if(cl == fCpointer[j]) {
410  fParents[i] = j;
411  break;
412  }
413  }
414  }
415  //now the real & hard stuff
416  for (i=0;i<fNclasses;i++) {
417  ScanClasses(i);
418  }
419 }
420 
421 ////////////////////////////////////////////////////////////////////////////////
422 /// list classes names and titles
423 
425 {
426  char line[500];
427  for (Int_t i=0;i<fNclasses;i++) {
428  snprintf(line,500,"%s%s",fCnames[i]->Data(),"...........................");
429  snprintf(&line[30],460,"%s",fCtitles[i]->Data());
430  line[79] = 0;
431  printf("%5d %s\n",i,line);
432  }
433 }
434 
435 ////////////////////////////////////////////////////////////////////////////////
436 /// set bit abit in class classname in list los
437 
438 TObjString *TClassTree::Mark(const char *classname, TList *los, Int_t abit)
439 {
440  if (!los) return 0;
441  TObjString *os = (TObjString*)los->FindObject(classname);
442  if (!os) {
443  os = new TObjString(classname);
444  los->Add(os);
445  }
446  os->SetBit(abit);
447  return os;
448 }
449 
450 ////////////////////////////////////////////////////////////////////////////////
451 /// Draw the current class setting in fClasses and fStatus
452 
454 {
455  //delete primitives belonging to a previous paint
456  if (gPad) {
457  TIter next(gPad->GetListOfPrimitives());
458  TObject *obj;
459  while((obj=next())) {
460  if (obj->TestBit(kIsClassTree)) delete obj;
461  }
462  }
463 
464  Int_t nch = strlen(GetClasses());
465  if (nch == 0) return;
466  char *classes = new char[nch+1];
467  gNsons = new Int_t[fNclasses];
468  gNtsons = new Int_t[fNclasses];
469  strlcpy(classes,GetClasses(),nch+1);
470  Int_t i,j;
471  char *derived;
472  char *ptr = strtok(classes,":");
473  //mark referenced classes
474  while (ptr) {
475  nch = strlen(ptr);
476  if (ptr[0] == '*') {
477  j = FindClass(&ptr[1]);
478  if (j >= 0) {
479  for (i=0;i<fNclasses;i++) {
480  derived = fDerived[i];
481  if(derived[j]) fCstatus[i] = 1;
482  }
483  }
484  } else if (ptr[0] == '>') {
485  for (i=0;i<fNclasses;i++) {
486  if(fCnames[i]->Contains(&ptr[1])) {
487  FindClassesUsing(i);
488  fCstatus[i] = 2;
489  break;
490  }
491  }
492  } else if (ptr[nch-1] == '<') {
493  ptr[nch-1] = 0;
494  for (i=0;i<fNclasses;i++) {
495  if(fCnames[i]->Contains(ptr)) {
497  FindClassesUsing(i);
498  fCstatus[i] = 2;
499  break;
500  }
501  }
502  } else if (ptr[nch-1] == '*') {
503  ptr[nch-1] = 0;
504  for (i=0;i<fNclasses;i++) {
505  if(fCnames[i]->Contains(ptr)) fCstatus[i] = 1;
506  }
507  } else {
508  for (i=0;i<fNclasses;i++) {
509  if(!fCnames[i]->CompareTo(ptr)) {
511  fCstatus[i] = 2;
512  break;
513  }
514  }
515  }
516  ptr = strtok(0,":");
517  }
518  //mark base classes of referenced classes
519  for (i=0;i<fNclasses;i++) {
520  gNsons[i] = gNtsons[i] = 0;
521  }
522  for (i=0;i<fNclasses;i++) {
523  if (fCstatus[i] == 0) continue;
524  derived = fDerived[i];
525  for (j=0;j<fNclasses;j++) {
526  if (j == i) continue;
527  if(derived[j]) {
528  fCstatus[j] = 1;
529  }
530  }
531  }
532  //find parent class number for selected classes
533  for (i=0;i<fNclasses;i++) {
534  if (fCstatus[i] == 0) continue;
535  j = fParents[i];
536  if (j >=0 ) {
537  fCparent[i] = j;
538  gNsons[j]++;
539  }
540  }
541  //compute total number of sons for each node
542  Int_t maxlev = 1;
543  Int_t icl,ip;
544  for (i=0;i<fNclasses;i++) {
545  if (fCstatus[i] == 0) continue;
546  if (gNsons[i] != 0) continue;
547  icl = i;
548  Int_t nlevel = 1;
549  while (fCparent[icl] >= 0) {
550  nlevel++;
551  if (nlevel > maxlev) maxlev = nlevel;
552  ip = fCparent[icl];
553  gNtsons[ip]++;
554  icl = ip;
555  }
556  }
557 
558  //compute levels, number and list of sons
559  Int_t ndiv=0;
560  Int_t nmore = 0;
561  for (i=0;i<fNclasses;i++) {
562  if (fCstatus[i] == 0) continue;
563  if (fCparent[i] < 0) {
564  ndiv += gNtsons[i]+1;
565  nmore++;
566  }
567  }
568  ndiv++;
569 
570  // We are now ready to draw the active nodes
571  Float_t xmin = gPad->GetX1();
572  Float_t xmax = gPad->GetX2();
573  Float_t ymin = gPad->GetY1();
574  Float_t ymax = gPad->GetY2();
575  Float_t ytop = gYsize/20;
576  gXsize = xmax - xmin;
577  gYsize = ymax - ymin;
578  gDy = (gYsize-ytop)/(ndiv);
579  if (gDy > gYsize/10.) gDy = gYsize/10.;
580  gDx = 0.9*gXsize/5;
581  if (maxlev > 5) gDx = 0.97*gXsize/maxlev;
582  Float_t y = ymax -ytop;
584  if (gLabdx > 0.95*gDx) gLabdx = 0.95*gDx;
585  gLabdy = 0.3*gDy;
586  gDxx = 0.5*gXsize/26.;
587  Float_t xleft = xmin +gDxx;
588  Float_t ymore = 0.5*nmore*gDy+fYoffset*gYsize;
589  Int_t dxpixels = gPad->XtoAbsPixel(gLabdx) - gPad->XtoAbsPixel(0);
590  Int_t dypixels = gPad->YtoAbsPixel(0) - gPad->YtoAbsPixel(gLabdy);
591  gCsize = dxpixels/(10.*dypixels);
592  gCsize = std::max(gCsize,Float_t(0.75));
593  gCsize = std::min(gCsize,Float_t(1.1));
594  // draw classes level 0
595  for (i=0;i<fNclasses;i++) {
596  if (fCstatus[i] == 0) continue;
597  if (fCparent[i] < 0) {
598  y -= gDy+0.5*gNtsons[i]*gDy;
599  if (!fCnames[i]->CompareTo("TObject")) y += ymore;
600  PaintClass(i,xleft,y);
601  y -= 0.5*gNtsons[i]*gDy;
602  }
603  }
604 
605  // show all types of links corresponding to selected options
606  if (fShowCod) ShowCod();
607  if (fShowHas) ShowHas();
608  if (fShowMul) ShowMul();
609  if (fShowRef) ShowRef();
610 
611  nch = strlen(GetClasses());
612  xmax = 0.3;
613  if (nch > 20) xmax = 0.5;
614  if (nch > 50) xmax = 0.7;
615  if (nch > 70) xmax = 0.9;
616  TPaveClass *ptitle = new TPaveClass(xmin +0.1*gXsize/26.
617  ,ymin+gYsize-0.9*gYsize/20.
618  ,xmin+xmax*gXsize
619  ,ymin+gYsize-0.1*gYsize/26.
620  ,GetClasses(),this);
621  ptitle->SetFillColor(42);
622  ptitle->SetBit(kIsClassTree);
623  ptitle->Draw();
624 
625  //cleanup
626  delete [] classes;
627  delete [] gNsons;
628  delete [] gNtsons;
629 }
630 
631 ////////////////////////////////////////////////////////////////////////////////
632 /// Paint one class level
633 
635 {
636  Float_t u[2],yu=0,yl=0;
637  Int_t ns = gNsons[iclass];
638  u[0] = xleft;
639  u[1] = u[0]+gDxx;
640  if(ns != 0) u[1] = u[0]+gDx;
641  TLine *line = new TLine(u[0],y,u[1],y);
642  line->SetBit(kIsClassTree);
643  line->Draw();
644  Int_t icobject = FindClass("TObject");
645  TPaveClass *label = new TPaveClass(xleft+gDxx,y-gLabdy,xleft+gLabdx,y+gLabdy,fCnames[iclass]->Data(),this);
646  char *derived = fDerived[iclass];
647  if (icobject >= 0 && !derived[icobject]) label->SetFillColor(30);
648  if (fCstatus[iclass] > 1) label->SetFillColor(kYellow);
649  label->SetTextSize(gCsize);
650  label->SetBit(kIsClassTree);
651  label->SetToolTipText(fCtitles[iclass]->Data(),500);
652  label->Draw();
653  if (ns == 0) return;
654 
655  // drawing sons
656  y += 0.5*gNtsons[iclass]*gDy;
657  Int_t first =0;
658  for (Int_t i=0;i<fNclasses;i++) {
659  if(fCparent[i] != iclass) continue;
660  if (gNtsons[i] > 1) y -= 0.5*gNtsons[i]*gDy;
661  else y -= 0.5*gDy;
662  if (!first) {first=1; yu = y;}
663  PaintClass(i,u[1],y);
664  yl = y;
665  if (gNtsons[i] > 1) y -= 0.5*gNtsons[i]*gDy;
666  else y -= 0.5*gDy;
667  }
668  if (ns == 1) return;
669  line = new TLine(u[1],yl,u[1],yu);
670  line->SetBit(kIsClassTree);
671  line->Draw();
672 }
673 
674 ////////////////////////////////////////////////////////////////////////////////
675 /// save current configuration in a Root file
676 /// if filename is blank, the name of the file will be the current objectname.root
677 /// all the current settings are preserved
678 /// the Root file produced can be looked at by a another Root session
679 /// with no access to the original classes.
680 /// By default a message is printed. Specify option "Q" to remove the message
681 
682 void TClassTree::SaveAs(const char *filename, Option_t *option) const
683 {
684  if (gDirectory) gDirectory->SaveObjectAs(this,filename,option);
685 }
686 
687 ////////////////////////////////////////////////////////////////////////////////
688 /// Select all classes used by/referenced/referencing the class number iclass
689 /// and build the list of these classes
690 
692 {
693  Int_t ic, icl;
694  TList *los = fLinks[iclass];
695  TList *losref = 0;
696  TObjString *os;
697 
698  // scan list of data members
699  // =========================
700  TClass *cl = fCpointer[iclass];
701  TDataMember *dm;
702  TList *lm = cl->GetListOfDataMembers();
703  if (lm) {
704  TIter next(lm);
705  Int_t imember = 0;
706  while ((dm = (TDataMember *) next())) {
707  imember++;
708  ic = FindClass(dm->GetTypeName());
709  if (ic < 0 || ic == iclass) continue;
710  losref = fLinks[ic];
711  os = Mark(fCnames[ic]->Data(),los,kUsedByData);
712  if (os) {
713  os->SetBit(kIsaPointer,dm->IsaPointer());
714  os->SetBit(kIsBasic,dm->IsBasic());
715  os->SetUniqueID(imember);
716  }
717  Mark(fCnames[iclass]->Data(),losref,kUsingData);
718  }
719  }
720 
721  // scan base classes
722  // =================
723  char *derived = fDerived[iclass];
724  TBaseClass *clbase;
725  Int_t numb = 0;
726  TList *lb = fCpointer[iclass]->GetListOfBases();
727  if (lb) {
728  TIter nextb(lb);
729  while ((clbase = (TBaseClass*)nextb())) {
730  numb++;
731  if (numb == 1) continue;
732  ic = FindClass(clbase->GetName());
733  derived[ic] = 2;
734  }
735  for (ic=0;ic<fNclasses;ic++) {
736  if (ic == iclass) continue;
737  if (derived[ic]) {
738  losref = fLinks[ic];
739  Mark(fCnames[ic]->Data(),los,kUsedByClass);
740  Mark(fCnames[iclass]->Data(),losref,kUsingClass);
741  }
742  }
743  }
744 
745  // scan member functions
746  // =====================
747  char *star, *cref;
748  TMethod *method;
749  TMethodArg *methodarg;
750  TList *lf = cl->GetListOfMethods();
751  if (lf) {
752  TIter nextm(lf);
753  TString name;
754  while ((method = (TMethod*) nextm())) {
755  // check return type
756  name = method->GetReturnTypeName();
757  star = strstr((char*)name.Data(),"*");
758  if (star) *star = 0;
759  cref = strstr((char*)name.Data(),"&");
760  if (cref) *cref = 0;
761  ic = FindClass(name);
762  if (ic < 0 || ic == iclass) continue;
763  losref = fLinks[ic];
764  Mark(fCnames[ic]->Data(),los,kUsedByFunc);
765  Mark(fCnames[iclass]->Data(),losref,kUsingFunc);
766 
767  // now loop on all method arguments
768  // ================================
769  TIter nexta(method->GetListOfMethodArgs());
770  while ((methodarg = (TMethodArg*) nexta())) {
771  name = methodarg->GetTypeName();
772  star = strstr((char*)name.Data(),"*");
773  if (star) *star = 0;
774  cref = strstr((char*)name.Data(),"&");
775  if (cref) *cref = 0;
776  ic = FindClass(name);
777  if (ic < 0 || ic == iclass) continue;
778  losref = fLinks[ic];
779  Mark(fCnames[ic]->Data(),los,kUsedByFunc);
780  Mark(fCnames[iclass]->Data(),losref,kUsingFunc);
781  }
782  }
783  }
784 
785  // Look into the source code to search the list of includes
786  // here we assume that include file names are classes file names
787  // we stop reading the code when
788  // - a class member function is found
789  // - any class constructor is found
790  if (!cl->GetImplFileName() || !cl->GetImplFileName()[0])
791  return;
792 
793  const char *source = gSystem->BaseName( gSystem->UnixPathName(cl->GetImplFileName()));
794  char *sourceName = gSystem->Which( fSourceDir.Data(), source , kReadPermission );
795  if (!sourceName) return;
796  Int_t ncn = strlen(fCnames[iclass]->Data())+2;
797  char *cname = new char[ncn+1];
798  snprintf(cname,ncn,"%s::",fCnames[iclass]->Data());
799  // open source file
800  std::ifstream sourceFile;
801  sourceFile.open( sourceName, std::ios::in );
802  Int_t nlines = 0;
803  if( sourceFile.good() ) {
804  const Int_t kMAXLEN=1500;
805  char line[kMAXLEN];
806  while( !sourceFile.eof() ) {
807  sourceFile.getline( line, kMAXLEN-1 );
808  if( sourceFile.eof() ) break;
809  Int_t nblank = strspn(line," ");
810  if (!strncmp(&line[nblank],"//",2)) continue;
811  char *cc = strstr(line,"::");
812  if (cc) {
813  *cc = 0;
814  if (!strncmp(&line[nblank],cname,ncn)) break; //reach class member function
815  Int_t nl = strlen(&line[nblank]);
816  if (!strncmp(&line[nblank],cc+2,nl)) break; //reach any class constructor
817  }
818  nlines++; if (nlines > 1000) break;
819  char *inc = strstr(line,"#include");
820  if (inc) {
821  char *ch = strstr(line,".h");
822  if (!ch) continue;
823  *ch = 0;
824  char *start = strstr(line,"<");
825  if (!start) start = strstr(line,"\"");
826  if (!start) continue;
827  start++;
828  while ((start < ch) && (*start == ' ')) start++;
829  icl = FindClass(start);
830  if (icl < 0 || icl == iclass) continue;
831  // mark this include being used by this class
832  losref = fLinks[icl];
833  Mark(fCnames[icl]->Data(),los,kUsedByCode1);
834  Mark(fCnames[icl]->Data(),los,kUsedByCode);
835  Mark(fCnames[iclass]->Data(),losref,kUsingCode);
836  // and also the base classes of the class in the include
837  derived = fDerived[icl];
838  for (ic=0;ic<fNclasses;ic++) {
839  if (ic == icl) continue;
840  if (derived[ic]) {
841  losref = fLinks[ic];
842  Mark(fCnames[ic]->Data(),los,kUsedByCode);
843  Mark(fCnames[iclass]->Data(),losref,kUsingCode);
844  }
845  }
846  }
847  }
848  }
849  delete [] cname;
850  sourceFile.close();
851 }
852 
853 ////////////////////////////////////////////////////////////////////////////////
854 /// Set the list of classes for which the hierarchy is to be drawn
855 /// See Paint for the syntax
856 
857 void TClassTree::SetClasses(const char *classes, Option_t *)
858 {
859  if (classes == 0) return;
860  fClasses = classes;
861  for (Int_t i=0;i<fNclasses;i++) {
862  fCstatus[i] = 0;
863  fCparent[i] = -1;
864  }
865  if (gPad) Paint();
866 }
867 
868 ////////////////////////////////////////////////////////////////////////////////
869 /// Set the size along x of the TPaveLabel showing the class name
870 
872 {
873  fLabelDx = labeldx;
874  if (gPad) Paint();
875 }
876 
877 ////////////////////////////////////////////////////////////////////////////////
878 /// Set the offset at the top of the picture
879 /// The default offset is computed automatically taking into account
880 /// classes not inheriting from TObject.
881 
883 {
884  fYoffset = offset;
885  if (gPad) Paint();
886 }
887 
888 ////////////////////////////////////////////////////////////////////////////////
889 /// mark classes used by the list of classes in classes
890 
891 void TClassTree::ShowClassesUsedBy(const char *classes)
892 {
893  Int_t i,j;
894  Int_t nch = strlen(classes);
895  char *ptr = new char[nch+1];
896  strlcpy(ptr,classes,nch+1);
897  if (ptr[0] == '*') {
898  i = FindClass(&ptr[1]);
899  if (i >= 0) {
900  char *derived = fDerived[i];
901  for (j=0;j<fNclasses;j++) {
902  if(derived[j]) FindClassesUsedBy(j);
903  }
904  }
905  } else if (ptr[nch-1] == '*') {
906  ptr[nch-1] = 0;
907  for (j=0;j<fNclasses;j++) {
908  if(fCnames[j]->Contains(ptr)) FindClassesUsedBy(j);
909  }
910  } else {
911  for (j=0;j<fNclasses;j++) {
912  if(!fCnames[j]->CompareTo(ptr)) FindClassesUsedBy(j);
913  }
914  }
915  delete [] ptr;
916  if (gPad) Paint();
917 }
918 
919 ////////////////////////////////////////////////////////////////////////////////
920 /// mark classes using any class in the list of classes in classes
921 
922 void TClassTree::ShowClassesUsing(const char *classes)
923 {
924  Int_t i,j;
925  Int_t nch = strlen(classes);
926  char *ptr = new char[nch+1];
927  strlcpy(ptr,classes,nch+1);
928  if (ptr[0] == '*') {
929  i = FindClass(&ptr[1]);
930  if (i >= 0) {
931  char *derived = fDerived[i];
932  for (j=0;j<fNclasses;j++) {
933  if(derived[j]) FindClassesUsing(j);
934  }
935  }
936  } else if (ptr[nch-1] == '*') {
937  ptr[nch-1] = 0;
938  for (j=0;j<fNclasses;j++) {
939  if(fCnames[j]->Contains(ptr)) FindClassesUsing(j);
940  }
941  } else {
942  for (j=0;j<fNclasses;j++) {
943  if(!fCnames[j]->CompareTo(ptr)) FindClassesUsing(j);
944  }
945  }
946  delete [] ptr;
947  if (gPad) Paint();
948 }
949 
950 ////////////////////////////////////////////////////////////////////////////////
951 /// Draw the Code References relationships
952 
954 {
955  TIter next(gPad->GetListOfPrimitives());
956  TObject *obj;
957  TObjString *os;
958  TPaveClass *pave;
959  Int_t ic,icl;
960  Float_t x,y,x1,y1;
961  //iterate on all TPaveClass objects in the pad
962  while((obj=next())) {
963  if (obj->InheritsFrom(TPaveClass::Class())) {
964  pave = (TPaveClass*)obj;
965  icl = FindClass(pave->GetLabel());
966  if (icl < 0) continue;
967  char *derived = fDerived[icl];
968  x = 0.5*(pave->GetX1() + pave->GetX2());
969  y = 0.5*(pave->GetY1() + pave->GetY2());
970  TIter nextos(fLinks[icl]);
971  //iterate on all classes in the list of classes of this class
972  while((os=(TObjString*)nextos())) {
973  if (!os->TestBit(kUsedByCode1)) continue;
974  ic = FindClass(os->GetName());
975  if (derived[ic]) continue;
976  FindClassPosition(os->GetName(),x1,y1);
977  if (x1 == 0 || y1 == 0) continue; //may be pointed class was not drawn
978  TArrow *arrow = new TArrow(x,y,x1,y1,0.008,"|>");
979  arrow->SetLineColor(kGreen);
980  arrow->SetFillColor(kGreen);
981  arrow->SetBit(kIsClassTree);
982  arrow->Draw();
983  }
984  }
985  }
986 }
987 
988 ////////////////////////////////////////////////////////////////////////////////
989 /// Draw the "Has a" relationships
990 
992 {
993  TIter next(gPad->GetListOfPrimitives());
994  TObject *obj;
995  TObjString *os;
996  TPaveClass *pave;
997  Int_t icl;
998  Float_t y,x1,y1,dx;
999  //iterate on all TPaveClass objects in the pad
1000  while((obj=next())) {
1001  if (obj->InheritsFrom(TPaveClass::Class())) {
1002  pave = (TPaveClass*)obj;
1003  icl = FindClass(pave->GetLabel());
1004  if (icl < 0) continue;
1005  y = 0.5*(pave->GetY1() + pave->GetY2());
1006  Int_t nmembers = fNdata[icl];
1007  if (nmembers == 0) continue;
1008  dx = (pave->GetX2() - pave->GetX1())/nmembers;
1009  TIter nextos(fLinks[icl]);
1010  //iterate on all classes in the list of classes of this class
1011  while((os=(TObjString*)nextos())) {
1012  if (!os->TestBit(kUsedByData)) continue;
1013  if (os->TestBit(kIsaPointer)) continue;
1014  if (os->TestBit(kIsBasic)) continue;
1015  FindClassPosition(os->GetName(),x1,y1);
1016  if (x1 == 0 || y1 == 0) continue; //may be base class was not drawn
1017  Int_t imember = os->GetUniqueID();
1018  TLine *line = new TLine(pave->GetX1()+(imember+0.5)*dx,y,x1,y1);
1019  line->SetLineStyle(3);
1020  line->SetLineColor(6);
1021  line->SetBit(kIsClassTree);
1022  line->Draw();
1023  }
1024  }
1025  }
1026 }
1027 
1028 ////////////////////////////////////////////////////////////////////////////////
1029 /// Set link options in the ClassTree object
1030 ///
1031 /// - "C" show References from code
1032 /// - "H" show Has a relations
1033 /// - "M" show Multiple Inheritance
1034 /// - "R" show References from data members
1035 
1037 {
1038  TString opt = option;
1039  opt.ToUpper();
1040  fShowCod = fShowHas = fShowMul = fShowRef = 0;
1041  if (opt.Contains("C")) fShowCod = 1;
1042  if (opt.Contains("H")) fShowHas = 1;
1043  if (opt.Contains("M")) fShowMul = 1;
1044  if (opt.Contains("R")) fShowRef = 1;
1045  if (gPad) Paint();
1046 }
1047 
1048 ////////////////////////////////////////////////////////////////////////////////
1049 /// Draw the Multiple inheritance relationships
1050 
1052 {
1053  TIter next(gPad->GetListOfPrimitives());
1054  TObject *obj;
1055  TObjString *os;
1056  TPaveClass *pave;
1057  Int_t ic,icl;
1058  Float_t x,y,x1,y1;
1059  //iterate on all TPaveClass objects in the pad
1060  while((obj=next())) {
1061  if (obj->InheritsFrom(TPaveClass::Class())) {
1062  pave = (TPaveClass*)obj;
1063  icl = FindClass(pave->GetLabel());
1064  if (icl < 0) continue;
1065  char *derived = fDerived[icl];
1066  x = 0.5*(pave->GetX1() + pave->GetX2());
1067  y = 0.5*(pave->GetY1() + pave->GetY2());
1068  TIter nextos(fLinks[icl]);
1069  //iterate on all classes in the list of classes of this class
1070  while((os=(TObjString*)nextos())) {
1071  if (!os->TestBit(kUsedByClass)) continue;
1072  ic = FindClass(os->GetName());
1073  if (derived[ic] != 2) continue; //keep only multiple inheritance
1074  FindClassPosition(os->GetName(),x1,y1);
1075  if (x1 == 0 || y1 == 0) continue; //may be base class was not drawn
1076  TLine *line = new TLine(x,y,x1,y1);
1077  line->SetBit(kIsClassTree);
1078  line->SetLineStyle(2);
1079  line->SetLineColor(kBlue);
1080  line->Draw();
1081  }
1082  }
1083  }
1084 }
1085 
1086 ////////////////////////////////////////////////////////////////////////////////
1087 /// Draw the References relationships (other than inheritance or composition)
1088 
1090 {
1091  TIter next(gPad->GetListOfPrimitives());
1092  TObject *obj;
1093  TObjString *os;
1094  TPaveClass *pave;
1095  Int_t ic,icl;
1096  Float_t y,x1,y1,dx;
1097  Int_t icc = FindClass("TClass");
1098  //iterate on all TPaveClass objects in the pad
1099  while((obj=next())) {
1100  if (obj->InheritsFrom(TPaveClass::Class())) {
1101  pave = (TPaveClass*)obj;
1102  icl = FindClass(pave->GetLabel());
1103  if (icl < 0) continue;
1104  y = 0.5*(pave->GetY1() + pave->GetY2());
1105  Int_t nmembers = fNdata[icl];
1106  if (nmembers == 0) continue;
1107  dx = (pave->GetX2() - pave->GetX1())/nmembers;
1108  TIter nextos(fLinks[icl]);
1109  //iterate on all classes in the list of classes of this class
1110  while((os=(TObjString*)nextos())) {
1111  if (!os->TestBit(kUsedByData)) continue;
1112  ic = FindClass(os->GetName());
1113  if (!os->TestBit(kIsaPointer)) continue;
1114  if (os->TestBit(kIsBasic)) continue;
1115  if (ic == icc) continue; // do not show relations with TClass
1116  FindClassPosition(os->GetName(),x1,y1);
1117  if (x1 == 0 || y1 == 0) continue; //may be pointed class was not drawn
1118  Int_t imember = os->GetUniqueID();
1119  TArrow *arrow = new TArrow(pave->GetX1()+(imember+0.5)*dx,y,x1,y1,0.008,"|>");
1120  arrow->SetLineColor(kRed);
1121  arrow->SetFillColor(kRed);
1122  arrow->SetBit(kIsClassTree);
1123  arrow->Draw();
1124  }
1125  }
1126  }
1127 }
1128 
1129 ////////////////////////////////////////////////////////////////////////////////
1130 /// Stream an object of class TClassTree.
1131 /// the status of the object is saved and can be replayed in a subsequent session
1132 
1133 void TClassTree::Streamer(TBuffer &R__b)
1134 {
1135  Int_t i;
1136  if (R__b.IsReading()) {
1137  Version_t R__v = R__b.ReadVersion(); if (R__v) { }
1138  TNamed::Streamer(R__b);
1139  fClasses.Streamer(R__b);
1140  R__b >> fYoffset;
1141  R__b >> fLabelDx;
1142  R__b >> fNclasses;
1143  R__b >> fShowCod;
1144  R__b >> fShowMul;
1145  R__b >> fShowHas;
1146  R__b >> fShowRef;
1147  fCnames = new TString*[fNclasses];
1148  fCtitles = new TString*[fNclasses];
1149  fCstatus = new Int_t[fNclasses];
1150  fParents = new Int_t[fNclasses];
1151  fCparent = new Int_t[fNclasses];
1152  fNdata = new Int_t[fNclasses];
1153  fCpointer = new TClass*[fNclasses];
1154  fOptions = new TString*[fNclasses];
1155  fLinks = new TList*[fNclasses];
1156  fDerived = new char*[fNclasses];
1157  for (i=0;i<fNclasses;i++) {
1158  R__b >> fCstatus[i];
1159  R__b >> fParents[i];
1160  R__b >> fNdata[i];
1161  fCnames[i] = new TString();
1162  fCtitles[i] = new TString();
1163  fOptions[i] = new TString();
1164  fCnames[i]->Streamer(R__b);
1165  fCtitles[i]->Streamer(R__b);
1166  fOptions[i]->Streamer(R__b);
1167  fLinks[i] = new TList();
1168  fLinks[i]->Streamer(R__b);
1169  fDerived[i] = new char[fNclasses];
1170  R__b.ReadFastArray(fDerived[i],fNclasses);
1171  }
1172  fSourceDir.Streamer(R__b);
1173  } else {
1174  R__b.WriteVersion(TClassTree::IsA());
1175  TNamed::Streamer(R__b);
1176  fClasses.Streamer(R__b);
1177  R__b << fYoffset;
1178  R__b << fLabelDx;
1179  R__b << fNclasses;
1180  R__b << fShowCod;
1181  R__b << fShowMul;
1182  R__b << fShowHas;
1183  R__b << fShowRef;
1184  for (i=0;i<fNclasses;i++) {
1185  R__b << fCstatus[i];
1186  R__b << fParents[i];
1187  R__b << fNdata[i];
1188  fCnames[i]->Streamer(R__b);
1189  fCtitles[i]->Streamer(R__b);
1190  fOptions[i]->Streamer(R__b);
1191  fLinks[i]->Streamer(R__b);
1192  R__b.WriteFastArray(fDerived[i],fNclasses);
1193  }
1194  fSourceDir.Streamer(R__b);
1195  }
1196 }
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:932
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
TString fClasses
List of classes to be drawn.
Definition: TClassTree.h:24
virtual ~TClassTree()
TClassTree default destructor.
Definition: TClassTree.cxx:236
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:375
Bool_t IsReading() const
Definition: TBuffer.h:83
A TPaveLabel specialized to process classes inside a TClassTree.
Definition: TPaveClass.h:19
virtual void FindClassesUsedBy(Int_t iclass)
Select all classes used/referenced by the class number iclass.
Definition: TClassTree.cxx:288
const Int_t kUsedByClass
Definition: TClassTree.cxx:37
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3507
float xmin
Definition: THbookFile.cxx:93
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:467
virtual 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 cent...
Definition: TClassTree.cxx:338
static Float_t gDy
Definition: TClassTree.cxx:46
Double_t GetX2() const
Definition: TBox.h:53
short Version_t
Definition: RtypesCore.h:61
TLine * line
const char * GetImplFileName() const
Definition: TClass.h:421
virtual void ls(Option_t *option="") const
list classes names and titles
Definition: TClassTree.cxx:424
static Int_t * gNtsons
Definition: TClassTree.cxx:47
Collectable string class.
Definition: TObjString.h:28
float Float_t
Definition: RtypesCore.h:53
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:95
const char * GetReturnTypeName() const
Get full type description of function return type, e,g.: "class TDirectory*".
Definition: TFunction.cxx:140
const char Option_t
Definition: RtypesCore.h:62
Definition: Rtypes.h:59
virtual void SetYoffset(Float_t offset=0)
Set the offset at the top of the picture The default offset is computed automatically taking into acc...
Definition: TClassTree.cxx:882
float ymin
Definition: THbookFile.cxx:93
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
TString fSourceDir
Concatenated source directories.
Definition: TClassTree.h:41
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
Definition: TBaseClass.cxx:63
virtual 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.
Definition: TClassTree.cxx:857
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this box.
Definition: TBox.cxx:679
#define BIT(n)
Definition: Rtypes.h:78
TString ** fCtitles
![fNclasses] class titles
Definition: TClassTree.h:39
Int_t fShowCod
if 1 show classes referenced by implementation
Definition: TClassTree.h:28
Int_t * fNdata
[fNclasses] Number of data members per class
Definition: TClassTree.h:33
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1112
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
static Float_t gLabdy
Definition: TClassTree.cxx:46
TClassTree()
TClassTree default constructor.
Definition: TClassTree.cxx:179
const Int_t kUsingCode
Definition: TClassTree.cxx:40
virtual void ShowClassesUsing(const char *classes)
mark classes using any class in the list of classes in classes
Definition: TClassTree.cxx:922
#define gROOT
Definition: TROOT.h:402
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Definition: TClass.cxx:3617
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TObjString * Mark(const char *classname, TList *los, Int_t abit)
set bit abit in class classname in list los
Definition: TClassTree.cxx:438
Basic string class.
Definition: TString.h:125
TString ** fCnames
![fNclasses] class names
Definition: TClassTree.h:38
int Int_t
Definition: RtypesCore.h:41
virtual void Paint(Option_t *option="")
Draw the current class setting in fClasses and fStatus.
Definition: TClassTree.cxx:453
virtual void ShowMul()
Draw the Multiple inheritance relationships.
Double_t GetY2() const
Definition: TBox.h:55
Float_t fLabelDx
width along x of TPaveLabels in per cent of pad
Definition: TClassTree.h:26
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1522
Each ROOT method (see TMethod) has a linked list of its arguments.
Definition: TMethodArg.h:31
Int_t fShowMul
if 1 show multiple inheritance
Definition: TClassTree.h:29
Definition: Rtypes.h:59
Definition: Rtypes.h:59
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual 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 curr...
Definition: TClassTree.cxx:682
virtual void ShowClassesUsedBy(const char *classes)
mark classes used by the list of classes in classes
Definition: TClassTree.cxx:891
const char * GetTypeName() const
Get type of method argument, e.g.
Definition: TMethodArg.cxx:67
virtual void ShowLinks(Option_t *option="HMR")
Set link options in the ClassTree object.
const Int_t kIsBasic
Definition: TClassTree.cxx:44
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1044
const Int_t kIsaPointer
Definition: TClassTree.cxx:43
virtual void ScanClasses(Int_t iclass)
Select all classes used by/referenced/referencing the class number iclass and build the list of these...
Definition: TClassTree.cxx:691
TClass ** fCpointer
![fNclasses] pointers to the TClass objects
Definition: TClassTree.h:37
static void Init()
static Float_t gXsize
Definition: TClassTree.cxx:46
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Double_t x[n]
Definition: legend1.C:17
void Class()
Definition: Class.C:29
TArrow * arrow
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition: TArrow.cxx:122
const Int_t kUsedByFunc
Definition: TClassTree.cxx:35
const Int_t kUsedByCode1
Definition: TClassTree.cxx:42
const Int_t kUsingClass
Definition: TClassTree.cxx:41
const Int_t kUsedByCode
Definition: TClassTree.cxx:36
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition: TObject.cxx:705
A doubly linked list.
Definition: TList.h:44
virtual Int_t FindClass(const char *classname)
Find class number corresponding to classname in list of local classes.
Definition: TClassTree.cxx:277
const char * GetName() const
Returns name of object.
Definition: TObjString.h:39
static Float_t gCsize
Definition: TClassTree.cxx:46
const char * GetLabel() const
Definition: TPaveLabel.h:35
static Float_t gYsize
Definition: TClassTree.cxx:46
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
float ymax
Definition: THbookFile.cxx:93
virtual void SetSourceDir(const char *dir="src")
Definition: TClassTree.h:68
virtual TList * GetListOfMethodArgs()
Returns methodarg list and additionally updates fDataMember in TMethod by calling FindDataMember();...
Definition: TMethod.cxx:305
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
static Float_t gDxx
Definition: TClassTree.cxx:46
char ** fDerived
![fNclasses] table to indicate if i derives from j
Definition: TClassTree.h:36
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
virtual void SetLabelDx(Float_t labeldx=0.15)
Set the size along x of the TPaveLabel showing the class name.
Definition: TClassTree.cxx:871
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
Int_t fNclasses
current number of classes
Definition: TClassTree.h:27
Int_t * fParents
[fNclasses] parent number of classes (permanent)
Definition: TClassTree.h:34
A simple line.
Definition: TLine.h:23
Int_t fShowRef
if 1 show classes relationship other than inheritance
Definition: TClassTree.h:31
static const TString & GetSourceDir()
Get the source directory in the installation. Static utility function.
Definition: TROOT.cxx:3000
virtual void FindClassesUsing(Int_t iclass)
Select all classes using/referencing the class number iclass.
Definition: TClassTree.cxx:312
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
float xmax
Definition: THbookFile.cxx:93
virtual void ShowRef()
Draw the References relationships (other than inheritance or composition)
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual void WriteFastArray(const Bool_t *b, Int_t n)=0
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:33
virtual void ShowCod()
Draw the Code References relationships.
Definition: TClassTree.cxx:953
static const double x1[5]
static char * Next()
Returns next class from sorted class table.
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
#define ClassImp(name)
Definition: Rtypes.h:359
Double_t GetX1() const
Definition: TBox.h:52
virtual void Draw(const char *classes="")
Draw the inheritance tree and relations for the list of classes see this class header for the syntax ...
Definition: TClassTree.cxx:260
static Float_t gLabdx
Definition: TClassTree.cxx:46
Double_t y[n]
Definition: legend1.C:17
virtual void ShowHas()
Draw the "Has a" relationships.
Definition: TClassTree.cxx:991
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:570
Int_t fShowHas
if 1 show "has a" relationship
Definition: TClassTree.h:30
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2887
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
Mother of all ROOT objects.
Definition: TObject.h:37
const Int_t kUsingFunc
Definition: TClassTree.cxx:39
const Int_t kIsClassTree
Definition: TClassTree.cxx:33
virtual void Add(TObject *obj)
Definition: TList.h:87
static Float_t gDx
Definition: TClassTree.cxx:46
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:38
#define snprintf
Definition: civetweb.c:822
#define gPad
Definition: TVirtualPad.h:285
Double_t GetY1() const
Definition: TBox.h:54
#define gDirectory
Definition: TDirectory.h:213
Definition: Rtypes.h:59
const char * GetClasses() const
Definition: TClassTree.h:62
Definition: first.py:1
const Int_t kUsingData
Definition: TClassTree.cxx:38
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
Draw all kinds of Arrows.
Definition: TArrow.h:29
virtual Int_t GetSize() const
Definition: TCollection.h:180
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
Definition: TClass.cxx:3666
Bool_t IsaPointer() const
Return true if data member is a pointer.
TString ** fOptions
![fNclasses] List of options per class
Definition: TClassTree.h:40
Int_t * fCstatus
[fNclasses] classes status
Definition: TClassTree.h:32
static Int_t * gNsons
Definition: TClassTree.cxx:47
virtual void PaintClass(Int_t iclass, Float_t xleft, Float_t y)
Paint one class level.
Definition: TClassTree.cxx:634
static constexpr double ns
Float_t fYoffset
offset at top of picture in per cent of pad
Definition: TClassTree.h:25
char name[80]
Definition: TGX11.cxx:109
Int_t * fCparent
!parent number of classes (temporary)
Definition: TClassTree.h:35
Draw inheritance tree and their relations for a list of classes.
Definition: TClassTree.h:21
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
const Int_t kUsedByData
Definition: TClassTree.cxx:34
const char * Data() const
Definition: TString.h:345
virtual void Init()
Initialize the data structures.
Definition: TClassTree.cxx:359
TList ** fLinks
![fNclasses] for each class, the list of referenced(ing) classes
Definition: TClassTree.h:42