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