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