Logo ROOT  
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 "TBuffer.h"
16#include "TClassTree.h"
17#include "TClassTable.h"
18#include "TClass.h"
19#include "TBaseClass.h"
20#include "TDataMember.h"
21#include "TDataType.h"
22#include "TMethod.h"
23#include "TMethodArg.h"
24#include "TVirtualPad.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
34const Int_t kUsedByData = BIT(11);
35const Int_t kUsedByFunc = BIT(12);
36const Int_t kUsedByCode = BIT(13);
38const Int_t kUsingData = BIT(15);
39const Int_t kUsingFunc = BIT(16);
40const Int_t kUsingCode = BIT(17);
41const Int_t kUsingClass = BIT(18);
43const Int_t kIsaPointer = BIT(20);
44const Int_t kIsBasic = BIT(21);
45
48
50
51/** \class TClassTree
52\ingroup gpad
53
54Draw inheritance tree and their relations for a list of classes.
55
56The 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
63The list of classes is specified:
64 - either in the TClassTree constructor as a second argument
65 - or the parameter to TClassTree::Draw
66
67Note that the ClassTree viewer can also be started from the canvas
68pull down menu "Classes".
69
70In the list of classes, class names are separated by a ":"
71wildcarding is supported.
72The 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
96Example: `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
101By default, only direct inheritance is drawn.
102Use 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
108The following picture is produced directly by:
109~~~ {.cpp}
110 TClassTree ct("ct","*TH1")
111~~~
112It shows all the classes derived from the base class TH1.
113
114\image html gpad_classtree1.png
115
116The TClassTree class uses the services of the class TPaveClass to
117show the class names. By clicking with the right mouse button in
118one 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
124The 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
132Note that in case of embedded classes or pointers to classes,
133the corresponding dashed lines or arrows respectively start
134in the TPaveClass object at an X position reflecting the position
135in 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
142Use TClassTree::SetSourceDir to specify the search path for source files.
143By default the search path includes the `$ROOTSYS` directory, the current
144directory and the subdirectory `src`.
145
146The first time TClassTree::Draw is invoked, all the classes in the
147current application are processed, including the parsing of the code
148to find all classes referenced by the include statements.
149This process may take a few seconds. The following commands will be
150much faster.
151
152A TClassTree object may be saved in a Root file.
153This object can be processed later by a Root program that ignores
154the original classes. This interesting possibility allows to send
155the class structure of an application to a colleague who does not have
156your classes.
157
158Example:
159~~~ {.cpp}
160 TFile f("myClasses.root","recreate")
161 TClassTree *ct = new TClassTree("ct","ATLF*")
162 ct->Write();
163~~~
164You can send at this point the file myClass.root to a colleague who can
165run 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~~~
171At this point, one has still access to all the classes present
172in the original session and select any combination of these classes
173to 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
204TClassTree::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
260void 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
277Int_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
338void 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
438TObjString *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])) {
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)) {
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.
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);
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);
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
682void 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);
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 delete [] sourceName;
851 sourceFile.close();
852}
853
854////////////////////////////////////////////////////////////////////////////////
855/// Set the list of classes for which the hierarchy is to be drawn
856/// See Paint for the syntax
857
858void TClassTree::SetClasses(const char *classes, Option_t *)
859{
860 if (classes == 0) return;
861 fClasses = classes;
862 for (Int_t i=0;i<fNclasses;i++) {
863 fCstatus[i] = 0;
864 fCparent[i] = -1;
865 }
866 if (gPad) Paint();
867}
868
869////////////////////////////////////////////////////////////////////////////////
870/// Set the size along x of the TPaveLabel showing the class name
871
873{
874 fLabelDx = labeldx;
875 if (gPad) Paint();
876}
877
878////////////////////////////////////////////////////////////////////////////////
879/// Set the offset at the top of the picture
880/// The default offset is computed automatically taking into account
881/// classes not inheriting from TObject.
882
884{
885 fYoffset = offset;
886 if (gPad) Paint();
887}
888
889////////////////////////////////////////////////////////////////////////////////
890/// mark classes used by the list of classes in classes
891
892void TClassTree::ShowClassesUsedBy(const char *classes)
893{
894 Int_t i,j;
895 Int_t nch = strlen(classes);
896 char *ptr = new char[nch+1];
897 strlcpy(ptr,classes,nch+1);
898 if (ptr[0] == '*') {
899 i = FindClass(&ptr[1]);
900 if (i >= 0) {
901 char *derived = fDerived[i];
902 for (j=0;j<fNclasses;j++) {
903 if(derived[j]) FindClassesUsedBy(j);
904 }
905 }
906 } else if (ptr[nch-1] == '*') {
907 ptr[nch-1] = 0;
908 for (j=0;j<fNclasses;j++) {
909 if(fCnames[j]->Contains(ptr)) FindClassesUsedBy(j);
910 }
911 } else {
912 for (j=0;j<fNclasses;j++) {
913 if(!fCnames[j]->CompareTo(ptr)) FindClassesUsedBy(j);
914 }
915 }
916 delete [] ptr;
917 if (gPad) Paint();
918}
919
920////////////////////////////////////////////////////////////////////////////////
921/// mark classes using any class in the list of classes in classes
922
923void TClassTree::ShowClassesUsing(const char *classes)
924{
925 Int_t i,j;
926 Int_t nch = strlen(classes);
927 char *ptr = new char[nch+1];
928 strlcpy(ptr,classes,nch+1);
929 if (ptr[0] == '*') {
930 i = FindClass(&ptr[1]);
931 if (i >= 0) {
932 char *derived = fDerived[i];
933 for (j=0;j<fNclasses;j++) {
934 if(derived[j]) FindClassesUsing(j);
935 }
936 }
937 } else if (ptr[nch-1] == '*') {
938 ptr[nch-1] = 0;
939 for (j=0;j<fNclasses;j++) {
940 if(fCnames[j]->Contains(ptr)) FindClassesUsing(j);
941 }
942 } else {
943 for (j=0;j<fNclasses;j++) {
944 if(!fCnames[j]->CompareTo(ptr)) FindClassesUsing(j);
945 }
946 }
947 delete [] ptr;
948 if (gPad) Paint();
949}
950
951////////////////////////////////////////////////////////////////////////////////
952/// Draw the Code References relationships
953
955{
956 TIter next(gPad->GetListOfPrimitives());
957 TObject *obj;
958 TObjString *os;
959 TPaveClass *pave;
960 Int_t ic,icl;
961 Float_t x,y,x1,y1;
962 //iterate on all TPaveClass objects in the pad
963 while((obj=next())) {
964 if (obj->InheritsFrom(TPaveClass::Class())) {
965 pave = (TPaveClass*)obj;
966 icl = FindClass(pave->GetLabel());
967 if (icl < 0) continue;
968 char *derived = fDerived[icl];
969 x = 0.5*(pave->GetX1() + pave->GetX2());
970 y = 0.5*(pave->GetY1() + pave->GetY2());
971 TIter nextos(fLinks[icl]);
972 //iterate on all classes in the list of classes of this class
973 while((os=(TObjString*)nextos())) {
974 if (!os->TestBit(kUsedByCode1)) continue;
975 ic = FindClass(os->GetName());
976 if (derived[ic]) continue;
977 FindClassPosition(os->GetName(),x1,y1);
978 if (x1 == 0 || y1 == 0) continue; //may be pointed class was not drawn
979 TArrow *arrow = new TArrow(x,y,x1,y1,0.008,"|>");
980 arrow->SetLineColor(kGreen);
981 arrow->SetFillColor(kGreen);
982 arrow->SetBit(kIsClassTree);
983 arrow->Draw();
984 }
985 }
986 }
987}
988
989////////////////////////////////////////////////////////////////////////////////
990/// Draw the "Has a" relationships
991
993{
994 TIter next(gPad->GetListOfPrimitives());
995 TObject *obj;
996 TObjString *os;
997 TPaveClass *pave;
998 Int_t icl;
999 Float_t y,x1,y1,dx;
1000 //iterate on all TPaveClass objects in the pad
1001 while((obj=next())) {
1002 if (obj->InheritsFrom(TPaveClass::Class())) {
1003 pave = (TPaveClass*)obj;
1004 icl = FindClass(pave->GetLabel());
1005 if (icl < 0) continue;
1006 y = 0.5*(pave->GetY1() + pave->GetY2());
1007 Int_t nmembers = fNdata[icl];
1008 if (nmembers == 0) continue;
1009 dx = (pave->GetX2() - pave->GetX1())/nmembers;
1010 TIter nextos(fLinks[icl]);
1011 //iterate on all classes in the list of classes of this class
1012 while((os=(TObjString*)nextos())) {
1013 if (!os->TestBit(kUsedByData)) continue;
1014 if (os->TestBit(kIsaPointer)) continue;
1015 if (os->TestBit(kIsBasic)) continue;
1016 FindClassPosition(os->GetName(),x1,y1);
1017 if (x1 == 0 || y1 == 0) continue; //may be base class was not drawn
1018 Int_t imember = os->GetUniqueID();
1019 TLine *line = new TLine(pave->GetX1()+(imember+0.5)*dx,y,x1,y1);
1020 line->SetLineStyle(3);
1021 line->SetLineColor(6);
1023 line->Draw();
1024 }
1025 }
1026 }
1027}
1028
1029////////////////////////////////////////////////////////////////////////////////
1030/// Set link options in the ClassTree object
1031///
1032/// - "C" show References from code
1033/// - "H" show Has a relations
1034/// - "M" show Multiple Inheritance
1035/// - "R" show References from data members
1036
1038{
1039 TString opt = option;
1040 opt.ToUpper();
1042 if (opt.Contains("C")) fShowCod = 1;
1043 if (opt.Contains("H")) fShowHas = 1;
1044 if (opt.Contains("M")) fShowMul = 1;
1045 if (opt.Contains("R")) fShowRef = 1;
1046 if (gPad) Paint();
1047}
1048
1049////////////////////////////////////////////////////////////////////////////////
1050/// Draw the Multiple inheritance relationships
1051
1053{
1054 TIter next(gPad->GetListOfPrimitives());
1055 TObject *obj;
1056 TObjString *os;
1057 TPaveClass *pave;
1058 Int_t ic,icl;
1059 Float_t x,y,x1,y1;
1060 //iterate on all TPaveClass objects in the pad
1061 while((obj=next())) {
1062 if (obj->InheritsFrom(TPaveClass::Class())) {
1063 pave = (TPaveClass*)obj;
1064 icl = FindClass(pave->GetLabel());
1065 if (icl < 0) continue;
1066 char *derived = fDerived[icl];
1067 x = 0.5*(pave->GetX1() + pave->GetX2());
1068 y = 0.5*(pave->GetY1() + pave->GetY2());
1069 TIter nextos(fLinks[icl]);
1070 //iterate on all classes in the list of classes of this class
1071 while((os=(TObjString*)nextos())) {
1072 if (!os->TestBit(kUsedByClass)) continue;
1073 ic = FindClass(os->GetName());
1074 if (derived[ic] != 2) continue; //keep only multiple inheritance
1075 FindClassPosition(os->GetName(),x1,y1);
1076 if (x1 == 0 || y1 == 0) continue; //may be base class was not drawn
1077 TLine *line = new TLine(x,y,x1,y1);
1079 line->SetLineStyle(2);
1081 line->Draw();
1082 }
1083 }
1084 }
1085}
1086
1087////////////////////////////////////////////////////////////////////////////////
1088/// Draw the References relationships (other than inheritance or composition)
1089
1091{
1092 TIter next(gPad->GetListOfPrimitives());
1093 TObject *obj;
1094 TObjString *os;
1095 TPaveClass *pave;
1096 Int_t ic,icl;
1097 Float_t y,x1,y1,dx;
1098 Int_t icc = FindClass("TClass");
1099 //iterate on all TPaveClass objects in the pad
1100 while((obj=next())) {
1101 if (obj->InheritsFrom(TPaveClass::Class())) {
1102 pave = (TPaveClass*)obj;
1103 icl = FindClass(pave->GetLabel());
1104 if (icl < 0) continue;
1105 y = 0.5*(pave->GetY1() + pave->GetY2());
1106 Int_t nmembers = fNdata[icl];
1107 if (nmembers == 0) continue;
1108 dx = (pave->GetX2() - pave->GetX1())/nmembers;
1109 TIter nextos(fLinks[icl]);
1110 //iterate on all classes in the list of classes of this class
1111 while((os=(TObjString*)nextos())) {
1112 if (!os->TestBit(kUsedByData)) continue;
1113 ic = FindClass(os->GetName());
1114 if (!os->TestBit(kIsaPointer)) continue;
1115 if (os->TestBit(kIsBasic)) continue;
1116 if (ic == icc) continue; // do not show relations with TClass
1117 FindClassPosition(os->GetName(),x1,y1);
1118 if (x1 == 0 || y1 == 0) continue; //may be pointed class was not drawn
1119 Int_t imember = os->GetUniqueID();
1120 TArrow *arrow = new TArrow(pave->GetX1()+(imember+0.5)*dx,y,x1,y1,0.008,"|>");
1121 arrow->SetLineColor(kRed);
1122 arrow->SetFillColor(kRed);
1123 arrow->SetBit(kIsClassTree);
1124 arrow->Draw();
1125 }
1126 }
1127 }
1128}
1129
1130////////////////////////////////////////////////////////////////////////////////
1131/// Stream an object of class TClassTree.
1132/// the status of the object is saved and can be replayed in a subsequent session
1133
1134void TClassTree::Streamer(TBuffer &R__b)
1135{
1136 Int_t i;
1137 if (R__b.IsReading()) {
1138 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
1139 TNamed::Streamer(R__b);
1140 fClasses.Streamer(R__b);
1141 R__b >> fYoffset;
1142 R__b >> fLabelDx;
1143 R__b >> fNclasses;
1144 R__b >> fShowCod;
1145 R__b >> fShowMul;
1146 R__b >> fShowHas;
1147 R__b >> fShowRef;
1148 fCnames = new TString*[fNclasses];
1149 fCtitles = new TString*[fNclasses];
1150 fCstatus = new Int_t[fNclasses];
1151 fParents = new Int_t[fNclasses];
1152 fCparent = new Int_t[fNclasses];
1153 fNdata = new Int_t[fNclasses];
1154 fCpointer = new TClass*[fNclasses];
1155 fOptions = new TString*[fNclasses];
1156 fLinks = new TList*[fNclasses];
1157 fDerived = new char*[fNclasses];
1158 for (i=0;i<fNclasses;i++) {
1159 R__b >> fCstatus[i];
1160 R__b >> fParents[i];
1161 R__b >> fNdata[i];
1162 fCnames[i] = new TString();
1163 fCtitles[i] = new TString();
1164 fOptions[i] = new TString();
1165 fCnames[i]->Streamer(R__b);
1166 fCtitles[i]->Streamer(R__b);
1167 fOptions[i]->Streamer(R__b);
1168 fLinks[i] = new TList();
1169 fLinks[i]->Streamer(R__b);
1170 fDerived[i] = new char[fNclasses];
1172 }
1173 fSourceDir.Streamer(R__b);
1174 } else {
1175 R__b.WriteVersion(TClassTree::IsA());
1176 TNamed::Streamer(R__b);
1177 fClasses.Streamer(R__b);
1178 R__b << fYoffset;
1179 R__b << fLabelDx;
1180 R__b << fNclasses;
1181 R__b << fShowCod;
1182 R__b << fShowMul;
1183 R__b << fShowHas;
1184 R__b << fShowRef;
1185 for (i=0;i<fNclasses;i++) {
1186 R__b << fCstatus[i];
1187 R__b << fParents[i];
1188 R__b << fNdata[i];
1189 fCnames[i]->Streamer(R__b);
1190 fCtitles[i]->Streamer(R__b);
1191 fOptions[i]->Streamer(R__b);
1192 fLinks[i]->Streamer(R__b);
1194 }
1195 fSourceDir.Streamer(R__b);
1196 }
1197}
void Class()
Definition: Class.C:29
static const double x1[5]
int Int_t
Definition: RtypesCore.h:43
short Version_t
Definition: RtypesCore.h:63
float Float_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:64
#define BIT(n)
Definition: Rtypes.h:83
#define ClassImp(name)
Definition: Rtypes.h:361
@ kRed
Definition: Rtypes.h:64
@ kGreen
Definition: Rtypes.h:64
@ kBlue
Definition: Rtypes.h:64
@ kYellow
Definition: Rtypes.h:64
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:94
const Int_t kIsBasic
Definition: TClassTree.cxx:44
const Int_t kUsingCode
Definition: TClassTree.cxx:40
const Int_t kUsingData
Definition: TClassTree.cxx:38
const Int_t kIsaPointer
Definition: TClassTree.cxx:43
const Int_t kUsedByCode1
Definition: TClassTree.cxx:42
static Int_t * gNtsons
Definition: TClassTree.cxx:47
const Int_t kUsingClass
Definition: TClassTree.cxx:41
static Float_t gDx
Definition: TClassTree.cxx:46
const Int_t kUsingFunc
Definition: TClassTree.cxx:39
const Int_t kUsedByData
Definition: TClassTree.cxx:34
static Float_t gYsize
Definition: TClassTree.cxx:46
static Float_t gLabdx
Definition: TClassTree.cxx:46
const Int_t kUsedByCode
Definition: TClassTree.cxx:36
static Float_t gDy
Definition: TClassTree.cxx:46
static Int_t * gNsons
Definition: TClassTree.cxx:47
static Float_t gLabdy
Definition: TClassTree.cxx:46
const Int_t kUsedByFunc
Definition: TClassTree.cxx:35
static Float_t gDxx
Definition: TClassTree.cxx:46
const Int_t kUsedByClass
Definition: TClassTree.cxx:37
static Float_t gXsize
Definition: TClassTree.cxx:46
const Int_t kIsClassTree
Definition: TClassTree.cxx:33
static Float_t gCsize
Definition: TClassTree.cxx:46
#define gDirectory
Definition: TDirectory.h:229
char name[80]
Definition: TGX11.cxx:109
float xmin
Definition: THbookFile.cxx:93
float ymin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
float ymax
Definition: THbookFile.cxx:93
#define gROOT
Definition: TROOT.h:406
@ kReadPermission
Definition: TSystem.h:46
R__EXTERN TSystem * gSystem
Definition: TSystem.h:556
#define gPad
Definition: TVirtualPad.h:287
#define snprintf
Definition: civetweb.c:1540
Draw all kinds of Arrows.
Definition: TArrow.h:29
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:33
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
Definition: TBaseClass.cxx:63
Double_t GetX1() const
Definition: TBox.h:52
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this box.
Definition: TBox.cxx:729
Double_t GetX2() const
Definition: TBox.h:53
Double_t GetY1() const
Definition: TBox.h:54
Double_t GetY2() const
Definition: TBox.h:55
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
Bool_t IsReading() const
Definition: TBuffer.h:85
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual void WriteFastArray(const Bool_t *b, Int_t n)=0
static char * Next()
Returns next class from sorted class table.
static void Init()
Draw inheritance tree and their relations for a list of classes.
Definition: TClassTree.h:21
virtual void ShowClassesUsedBy(const char *classes)
mark classes used by the list of classes in classes
Definition: TClassTree.cxx:892
virtual void Paint(Option_t *option="")
Draw the current class setting in fClasses and fStatus.
Definition: TClassTree.cxx:453
virtual void ShowHas()
Draw the "Has a" relationships.
Definition: TClassTree.cxx:992
virtual void ShowLinks(Option_t *option="HMR")
Set link options in the ClassTree object.
char ** fDerived
![fNclasses] table to indicate if i derives from j
Definition: TClassTree.h:36
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
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:858
Int_t * fCstatus
[fNclasses] classes status
Definition: TClassTree.h:32
Int_t fNclasses
current number of classes
Definition: TClassTree.h:27
virtual void PaintClass(Int_t iclass, Float_t xleft, Float_t y)
Paint one class level.
Definition: TClassTree.cxx:634
virtual void FindClassesUsing(Int_t iclass)
Select all classes using/referencing the class number iclass.
Definition: TClassTree.cxx:312
Int_t * fParents
[fNclasses] parent number of classes (permanent)
Definition: TClassTree.h:34
Int_t fShowRef
if 1 show classes relationship other than inheritance
Definition: TClassTree.h:31
virtual void Init()
Initialize the data structures.
Definition: TClassTree.cxx:359
TString ** fOptions
![fNclasses] List of options per class
Definition: TClassTree.h:40
Int_t fShowHas
if 1 show "has a" relationship
Definition: TClassTree.h:30
Int_t fShowCod
if 1 show classes referenced by implementation
Definition: TClassTree.h:28
Int_t * fCparent
!parent number of classes (temporary)
Definition: TClassTree.h:35
TString fSourceDir
Concatenated source directories.
Definition: TClassTree.h:41
virtual Int_t FindClass(const char *classname)
Find class number corresponding to classname in list of local classes.
Definition: TClassTree.cxx:277
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 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
TString ** fCtitles
![fNclasses] class titles
Definition: TClassTree.h:39
virtual void SetLabelDx(Float_t labeldx=0.15)
Set the size along x of the TPaveLabel showing the class name.
Definition: TClassTree.cxx:872
virtual ~TClassTree()
TClassTree default destructor.
Definition: TClassTree.cxx:236
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:883
virtual void SetSourceDir(const char *dir="src")
Definition: TClassTree.h:68
Float_t fLabelDx
width along x of TPaveLabels in per cent of pad
Definition: TClassTree.h:26
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
virtual void ShowRef()
Draw the References relationships (other than inheritance or composition)
virtual void ShowCod()
Draw the Code References relationships.
Definition: TClassTree.cxx:954
TList ** fLinks
![fNclasses] for each class, the list of referenced(ing) classes
Definition: TClassTree.h:42
virtual void ShowMul()
Draw the Multiple inheritance relationships.
virtual void ls(Option_t *option="") const
list classes names and titles
Definition: TClassTree.cxx:424
virtual void ShowClassesUsing(const char *classes)
mark classes using any class in the list of classes in classes
Definition: TClassTree.cxx:923
TClassTree()
TClassTree default constructor.
Definition: TClassTree.cxx:179
Float_t fYoffset
offset at top of picture in per cent of pad
Definition: TClassTree.h:25
TClass ** fCpointer
![fNclasses] pointers to the TClass objects
Definition: TClassTree.h:37
virtual void FindClassesUsedBy(Int_t iclass)
Select all classes used/referenced by the class number iclass.
Definition: TClassTree.cxx:288
TString fClasses
List of classes to be drawn.
Definition: TClassTree.h:24
TObjString * Mark(const char *classname, TList *los, Int_t abit)
set bit abit in class classname in list los
Definition: TClassTree.cxx:438
Int_t fShowMul
if 1 show multiple inheritance
Definition: TClassTree.h:29
TString ** fCnames
![fNclasses] class names
Definition: TClassTree.h:38
const char * GetClasses() const
Definition: TClassTree.h:62
Int_t * fNdata
[fNclasses] Number of data members per class
Definition: TClassTree.h:33
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
Definition: TClass.cxx:3780
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Definition: TClass.cxx:3738
const char * GetImplFileName() const
Definition: TClass.h:453
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3604
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:2948
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Bool_t IsaPointer() const
Return true if data member is a pointer.
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
const char * GetReturnTypeName() const
Get full type description of function return type, e,g.: "class TDirectory*".
Definition: TFunction.cxx:140
A simple line.
Definition: TLine.h:23
A doubly linked list.
Definition: TList.h:44
virtual void Add(TObject *obj)
Definition: TList.h:87
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:577
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:469
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:658
Each ROOT method (see TMethod) has a linked list of its arguments.
Definition: TMethodArg.h:31
const char * GetTypeName() const
Get type of method argument, e.g.
Definition: TMethodArg.cxx:67
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:38
virtual TList * GetListOfMethodArgs()
Returns methodarg list and additionally updates fDataMember in TMethod by calling FindDataMember();.
Definition: TMethod.cxx:306
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Collectable string class.
Definition: TObjString.h:28
const char * GetName() const
Returns name of object.
Definition: TObjString.h:38
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:375
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition: TObject.cxx:705
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
A TPaveLabel specialized to process classes inside a TClassTree.
Definition: TPaveClass.h:19
const char * GetLabel() const
Definition: TPaveLabel.h:35
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
static const TString & GetSourceDir()
Get the source directory in the installation. Static utility function.
Definition: TROOT.cxx:3034
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1138
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition: TSystem.cxx:1058
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:930
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1541
TLine * line
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double ns
Definition: first.py:1