ROOT  6.06/09
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(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...
void Prepare()
Create top node and find all member nodes.
An array of TObjects.
Definition: TObjArray.h:39
TExMap GetLevelMembersCount() const
Returns TExMap with pairs
ClassDef(TStructViewer, 0)
const char Option_t
Definition: RtypesCore.h:62
TStructNode * fTopNode
Definition: TStructViewer.h:36
void Draw(Option_t *option="")
Draw object if there is valid pointer.
TGMainFrame * GetFrame()
Returns pointer to main window.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TExMap fPointers
Definition: TStructViewer.h:34
void SetLinksVisibility(Bool_t val)
ISets links visibility.
TStructViewerGUI * fGUI
Definition: TStructViewer.h:31
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...
void SetColor(TString name, Int_t color)
Sets color for the class "name" to color "color".
void Reset()
Deleting nodes, maps and array.
A doubly linked list.
Definition: TList.h:47
~TStructViewer()
Destructor. Clean all object after closing the viewer.
TClass * fPointerClass
Definition: TStructViewer.h:30
TExMap fLevelMembersCount
Definition: TStructViewer.h:32
Bool_t GetLinksVisibility() const
Get visibility of links between objects.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
The Canvas class.
Definition: TCanvas.h:48
TObjArray fLevelArray
Definition: TStructViewer.h:35
TExMap GetLevelSize() const
Returns TExMap with pairs
unsigned long ULong_t
Definition: RtypesCore.h:51
The color creation and management class.
Definition: TColor.h:23
TExMap fLevelSize
Definition: TStructViewer.h:33
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
void CountMembers(TClass *cl, TStructNode *parent, void *pointer)
Count allocated memory, increase member counters, find child nodes.
void SetPointer(void *ptr, const char *clname=NULL)
Set main pointer of class "clname".
#define NULL
Definition: Rtypes.h:82
TCanvas * GetCanvas()
Returns canvas used to keep TGeoVolumes.
void * GetPointer() const
Return main pointer.
TColor GetColor(const char *typeName)
Returns color associated with type "typeName".
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:35