Logo ROOT   6.12/07
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:37
const char Option_t
Definition: RtypesCore.h:62
TStructNode * fTopNode
Definition: TStructViewer.h:36
TExMap GetLevelSize() const
Returns TExMap with pairs <level number, size of level in bytes>
void Draw(Option_t *option="")
Draw object if there is valid pointer.
Bool_t GetLinksVisibility() const
Get visibility of links between objects.
TGMainFrame * GetFrame()
Returns pointer to main window.
Basic string class.
Definition: TString.h:125
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 * GetPointer() const
Return main pointer.
#define ClassDef(name, id)
Definition: Rtypes.h:320
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:44
~TStructViewer()
Destructor. Clean all object after closing the viewer.
TClass * fPointerClass
Definition: TStructViewer.h:30
TExMap fLevelMembersCount
Definition: TStructViewer.h:32
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
The Canvas class.
Definition: TCanvas.h:31
TObjArray fLevelArray
Definition: TStructViewer.h:35
TExMap GetLevelMembersCount() const
Returns TExMap with pairs <level number, number of objects>
unsigned long ULong_t
Definition: RtypesCore.h:51
The color creation and management class.
Definition: TColor.h:19
TExMap fLevelSize
Definition: TStructViewer.h:33
Mother of all ROOT objects.
Definition: TObject.h:37
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".
TCanvas * GetCanvas()
Returns canvas used to keep TGeoVolumes.
TColor GetColor(const char *typeName)
Returns color associated with type "typeName".
char name[80]
Definition: TGX11.cxx:109
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33