Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
23class TStructNode;
24class TGMainFrame;
25
26class TStructViewer : public TObject {
27
28private:
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
40private:
41 void AddNode(TStructNode* node, ULong_t size);
42 void CountMembers(TClass* cl, TStructNode* parent, void* pointer);
43 void Prepare();
44 void Reset();
45
46public:
47 TStructViewer(void* ptr = NULL, const char * clname = NULL);
49
50 void Draw(Option_t *option = "");
53 TColor GetColor(const char* typeName);
55 TExMap GetLevelSize() 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
unsigned long ULong_t
Definition RtypesCore.h:55
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
The Canvas class.
Definition TCanvas.h:23
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
The color creation and management class.
Definition TColor.h:19
This class stores a (key,value) pair using an external hash.
Definition TExMap.h:33
A doubly linked list.
Definition TList.h:44
An array of TObjects.
Definition TObjArray.h:37
Mother of all ROOT objects.
Definition TObject.h:37
Basic string class.
Definition TString.h:136
TExMap fLevelMembersCount
TCanvas * GetCanvas()
Returns canvas used to keep TGeoVolumes.
TGMainFrame * GetFrame()
Returns pointer to main window.
void SetLinksVisibility(Bool_t val)
ISets links visibility.
TObjArray fLevelArray
~TStructViewer()
Destructor. Clean all object after closing the viewer.
void CountMembers(TClass *cl, TStructNode *parent, void *pointer)
Count allocated memory, increase member counters, find child nodes.
void SetColor(TString name, Int_t color)
Sets color for the class "name" to color "color".
TColor GetColor(const char *typeName)
Returns color associated with type "typeName".
void SetPointer(void *ptr, const char *clname=NULL)
Set main pointer of class "clname".
void Reset()
Deleting nodes, maps and array.
TStructNode * fTopNode
Bool_t GetLinksVisibility() const
Get visibility of links between objects.
void Prepare()
Create top node and find all member nodes.
void * GetPointer() const
Return main pointer.
TStructViewerGUI * fGUI
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...
TClass * fPointerClass
TExMap GetLevelMembersCount() const
Returns TExMap with pairs <level number, number of objects>
TExMap GetLevelSize() const
Returns TExMap with pairs <level number, size of level in bytes>
th1 Draw()