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