Logo ROOT  
Reference Guide
TStructViewer.h
Go to the documentation of this file.
1 // @(#)root/gviz3d:$Id$
2 // Author: Tomasz Sosnicki 18/09/09
3 
4 /************************************************************************
5 * Copyright (C) 1995-2009, 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 #ifndef ROOT_TStructViewer
13 #define ROOT_TStructViewer
14 
15 #include <TObject.h>
16 #include <TExMap.h>
17 #include <TObjArray.h>
18 #include <TList.h>
19 #include <TCanvas.h>
20 #include <TColor.h>
21 
22 class TStructViewerGUI;
23 class TStructNode;
24 class TGMainFrame;
25 
26 class TStructViewer : public TObject {
27 
28 private:
29  void *fPointer; // Main pointer to represented object
30  TClass *fPointerClass; // TClass of a main pointer
31  TStructViewerGUI *fGUI; // Pointer to GUI class
32  TExMap fLevelMembersCount; // Contains number of objects on each level
33  TExMap fLevelSize; // Contains total size in bytes of a level
34  TExMap fPointers; // Map of pointer to avoid circulation
35  TObjArray fLevelArray; // Array with pointers to nodes on each level
36  TStructNode *fTopNode; // Master node for fPointer
37  TList fColors; // List with properties used to color nodes
38 
39 
40 private:
41  void AddNode(TStructNode* node, ULong_t size);
42  void CountMembers(TClass* cl, TStructNode* parent, void* pointer);
43  void Prepare();
44  void Reset();
45 
46 public:
47  TStructViewer(void* ptr = NULL, const char * clname = NULL);
49 
50  void Draw(Option_t *option = "");
51  TCanvas* GetCanvas();
53  TColor GetColor(const char* typeName);
55  TExMap GetLevelSize() const;
56  Bool_t GetLinksVisibility() const;
57  void *GetPointer() const;
58  void SetColor(TString name, Int_t color);
59  void SetLinksVisibility(Bool_t val);
60  void SetPointer(void* ptr, const char* clname = NULL);
61 
62  ClassDef(TStructViewer, 0); // A 3D struct viewer
63 };
64 
65 #endif
TStructViewer
Definition: TStructViewer.h:26
TStructViewer::GetFrame
TGMainFrame * GetFrame()
Returns pointer to main window.
Definition: TStructViewer.cxx:370
TGMainFrame
Definition: TGFrame.h:444
TObjArray
Definition: TObjArray.h:37
TStructViewer::CountMembers
void CountMembers(TClass *cl, TStructNode *parent, void *pointer)
Count allocated memory, increase member counters, find child nodes.
Definition: TStructViewer.cxx:115
TStructViewer::fPointer
void * fPointer
Definition: TStructViewer.h:29
TStructViewer::Prepare
void Prepare()
Create top node and find all member nodes.
Definition: TStructViewer.cxx:409
TStructViewer::fLevelArray
TObjArray fLevelArray
Definition: TStructViewer.h:35
TList.h
TColor.h
TCanvas.h
TString
Definition: TString.h:136
TStructViewer::TStructViewer
TStructViewer(void *ptr=NULL, const char *clname=NULL)
Default constructor. An argument "ptr" is a main pointer of type "clname", which should be shown in t...
Definition: TStructViewer.cxx:69
bool
TStructViewer::GetLevelMembersCount
TExMap GetLevelMembersCount() const
Returns TExMap with pairs <level number, number of objects>
Definition: TStructViewer.cxx:385
TStructViewer::Reset
void Reset()
Deleting nodes, maps and array.
Definition: TStructViewer.cxx:429
TStructViewer::fPointers
TExMap fPointers
Definition: TStructViewer.h:34
TStructViewer::fTopNode
TStructNode * fTopNode
Definition: TStructViewer.h:36
TStructViewer::GetLinksVisibility
Bool_t GetLinksVisibility() const
Get visibility of links between objects.
Definition: TStructViewer.cxx:401
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TStructViewerGUI
Definition: TStructViewerGUI.h:37
TStructViewer::SetColor
void SetColor(TString name, Int_t color)
Sets color for the class "name" to color "color".
Definition: TStructViewer.cxx:450
TColor
Definition: TColor.h:19
TStructViewer::AddNode
void AddNode(TStructNode *node, ULong_t size)
Find list with nodes on specified level and add node to this list and increment list of sizes and lis...
Definition: TStructViewer.cxx:97
TStructViewer::fColors
TList fColors
Definition: TStructViewer.h:37
TStructViewer::GetCanvas
TCanvas * GetCanvas()
Returns canvas used to keep TGeoVolumes.
Definition: TStructViewer.cxx:362
TStructViewer::SetPointer
void SetPointer(void *ptr, const char *clname=NULL)
Set main pointer of class "clname".
Definition: TStructViewer.cxx:480
TStructViewer::SetLinksVisibility
void SetLinksVisibility(Bool_t val)
ISets links visibility.
Definition: TStructViewer.cxx:472
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TStructViewer::fLevelMembersCount
TExMap fLevelMembersCount
Definition: TStructViewer.h:32
TStructViewer::fGUI
TStructViewerGUI * fGUI
Definition: TStructViewer.h:31
TStructViewer::Draw
void Draw(Option_t *option="")
Draw object if there is valid pointer.
Definition: TStructViewer.cxx:342
TStructNode
Definition: TStructNode.h:34
TObject.h
TObjArray.h
TCanvas
Definition: TCanvas.h:23
TClass
Definition: TClass.h:80
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TStructViewer::GetColor
TColor GetColor(const char *typeName)
Returns color associated with type "typeName".
Definition: TStructViewer.cxx:503
name
char name[80]
Definition: TGX11.cxx:110
TExMap
Definition: TExMap.h:33
TStructViewer::GetPointer
void * GetPointer() const
Return main pointer.
Definition: TStructViewer.cxx:377
TStructViewer::GetLevelSize
TExMap GetLevelSize() const
Returns TExMap with pairs <level number, size of level in bytes>
Definition: TStructViewer.cxx:393
TStructViewer::fLevelSize
TExMap fLevelSize
Definition: TStructViewer.h:33
TList
Definition: TList.h:44
TStructViewer::~TStructViewer
~TStructViewer()
Destructor. Clean all object after closing the viewer.
Definition: TStructViewer.cxx:87
TExMap.h
int
TStructViewer::fPointerClass
TClass * fPointerClass
Definition: TStructViewer.h:30