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