Logo ROOT  
Reference Guide
TStructNode.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_TStructNode
13#define ROOT_TStructNode
14
15#include <TObject.h>
16#include <TString.h>
17
19 kUnknown = 1, // Unknown type
20 kClass, // Class or structure
21 kCollection, // TCollection (e.g. TList, TExMap, TMap etc.)
22 kBasic, // Basic type (e.g. char, float, double)
23 kSTLCollection // STL collection
24};
26 kSize, // Objects are proportional to allocated memory
27 kMembers // Objects are proportional to number of members
28};
29
30//________________________________________________________________________
31//
32// Logical node with informatioon about class
33
34class TStructNode : public TObject {
35
36private:
38 TString fName; // Name of node
39 TString fTypeName; // Name of type
40 ULong_t fSize; // Memory allocated by class without pointers and list elements
41 ULong_t fTotalSize; // Total allocated memory
42 TStructNode *fParent; // Pointer to parent node, NULL if not exist
43 UInt_t fLevel; // Level number
44 ULong_t fMembersCount; // Number of members in class
45 ULong_t fAllMembersCount; // Number of all members (class and its daughters)
46 void* fPointer; // Pointer to data (address of variable)
47 Bool_t fCollapsed; // Condition - true if node is collapsed (we don't see dauthers)
48 Bool_t fVisible; // Condition - true if node is visible
49 TList* fMembers; // List of daughter nodes
50 Float_t fX; // X coordinate in 3D space
51 Float_t fY; // Y coordinate in 3D space
52 Float_t fWidth; // Width of outlining box
53 Float_t fHeight; // Height of outlining box
54 ENodeType fNodeType; // Type of node
55 UInt_t fMaxLevel; // Number of levels displayed when the node is top node on scene
56 UInt_t fMaxObjects; // Number of objects displayed when the node is top node on scene
57
58public:
59 TStructNode(TString name, TString typeName, void* pointer, TStructNode* parent, ULong_t size, ENodeType type);
61
62 virtual Int_t Compare(const TObject* obj) const;
64 Float_t GetCenter() const;
65 Float_t GetHeight() const;
66 UInt_t GetLevel() const;
67 UInt_t GetMaxLevel() const;
68 UInt_t GetMaxObjects() const;
69 TList* GetMembers() const;
71 Float_t GetMiddle() const;
72 const char* GetName() const;
73 ENodeType GetNodeType() const;
74 TStructNode *GetParent() const;
75 void* GetPointer() const;
80 ULong_t GetSize() const;
81 ULong_t GetTotalSize() const;
82 TString GetTypeName() const;
83 ULong_t GetVolume() const;
85 Float_t GetWidth() const;
86 Float_t GetX() const;
87 Float_t GetY() const;
88 Bool_t IsCollapsed() const;
89 virtual Bool_t IsSortable() const;
90 bool IsVisible() const;
91 void SetAllMembersCount(ULong_t count);
92 void SetCollapsed(Bool_t collapsed);
93 void SetHeight(Float_t h);
94 void SetMaxLevel(UInt_t level);
95 void SetMaxObjects(UInt_t max);
96 void SetMembers(TList* list);
97 void SetMembersCount(ULong_t count);
99 void SetPointer(void* pointer);
100 static void SetScaleBy(EScalingType type);
101 void SetSize(ULong_t size);
102 void SetTotalSize(ULong_t size);
103 void SetVisible(bool visible);
104 void SetWidth(Float_t w);
105 void SetX(Float_t x);
106 void SetY(Float_t y);
107
108 ClassDef(TStructNode,0); // Node with information about class
109};
110
111#endif
#define h(i)
Definition: RSha256.hxx:106
unsigned long ULong_t
Definition: RtypesCore.h:53
float Float_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
EScalingType
Definition: TStructNode.h:25
@ kSize
Definition: TStructNode.h:26
@ kMembers
Definition: TStructNode.h:27
ENodeType
Definition: TStructNode.h:18
@ kSTLCollection
Definition: TStructNode.h:23
@ kClass
Definition: TStructNode.h:20
@ kUnknown
Definition: TStructNode.h:19
@ kCollection
Definition: TStructNode.h:21
@ kBasic
Definition: TStructNode.h:22
A doubly linked list.
Definition: TList.h:44
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:131
TStructNode(TString name, TString typeName, void *pointer, TStructNode *parent, ULong_t size, ENodeType type)
Constructs node with name "name" of class "typeName" and given parent "parent" which represents point...
Definition: TStructNode.cxx:37
void SetNodeType(ENodeType type)
Sets type of node to "type".
UInt_t GetMaxLevel() const
Returns maximum number of leves displayed when the node is top node on scene.
virtual Bool_t IsSortable() const
Returns true, because we have overrided method Compare.
ULong_t fTotalSize
Definition: TStructNode.h:41
ULong_t GetAllMembersCount() const
Returns number of all members in node.
Definition: TStructNode.cxx:95
void SetY(Float_t y)
Sets Y coordinate to "y".
ULong_t GetSize() const
Returns size of node.
void SetPointer(void *pointer)
Sets main pointer to "pointer".
Float_t fHeight
Definition: TStructNode.h:53
TString GetTypeName() const
Returns name of class.
void SetX(Float_t x)
Sets X coordinate to "x".
TString fName
Definition: TStructNode.h:38
UInt_t fMaxLevel
Definition: TStructNode.h:55
TStructNode * GetParent() const
Returns pointer to parent node.
void SetWidth(Float_t w)
Sets width of outlining box to "w".
void SetCollapsed(Bool_t collapsed)
Sets collapsing of node to "collapse".
void SetMaxLevel(UInt_t level)
Sets maximum number of leves displayed when the node is top node on scene.
ULong_t fSize
Definition: TStructNode.h:40
ULong_t fMembersCount
Definition: TStructNode.h:44
ULong_t GetMembersCount() const
Returns numbers of members of node.
Bool_t fCollapsed
Definition: TStructNode.h:47
bool IsVisible() const
Returns true if node is visible.
virtual Int_t Compare(const TObject *obj) const
Overrided method. Compare to objects of TStructNode class.
Definition: TStructNode.cxx:71
void SetMembersCount(ULong_t count)
Sets number of members to "number".
void SetSize(ULong_t size)
Sets size of node to "size".
void SetMembers(TList *list)
Sets list of dauther nodes to "list".
ULong_t GetRelativeSize() const
Returns relative size of node.
Float_t GetCenter() const
Returns center of outlining box on x-axis.
ULong_t GetVolume() const
Returns size or number of members.
Bool_t fVisible
Definition: TStructNode.h:48
void * GetPointer() const
Returns main pointer.
void SetTotalSize(ULong_t size)
Sets total size of allocated memory in bytes to value "size".
UInt_t fLevel
Definition: TStructNode.h:43
TString fTypeName
Definition: TStructNode.h:39
void SetAllMembersCount(ULong_t count)
Sets numbers of all members to "number".
~TStructNode()
Destructs list of nodes.
Definition: TStructNode.cxx:63
Float_t GetY() const
Returns Y coordinate.
ULong_t GetRelativeVolume() const
Returns size or number of members.
void SetVisible(bool visible)
Sets visibility of node to "visible".
TList * GetMembers() const
Returns list with pointers to daughter nodes.
void SetMaxObjects(UInt_t max)
Sets maximum number of objects displayed when the node is top node on scene.
ULong_t GetRelativeMembersCount() const
Returns relative numbers of members.
Float_t fY
Definition: TStructNode.h:51
Float_t GetWidth() const
Returns width of outlining box.
ULong_t fAllMembersCount
Definition: TStructNode.h:45
Float_t GetVolumeRatio()
Returns ratio - volme of node to area taken by outlining box.
static void SetScaleBy(EScalingType type)
Sets scaling by to "type".
Float_t GetX() const
Returns X coordinate.
UInt_t fMaxObjects
Definition: TStructNode.h:56
const char * GetName() const
Returns name of object.
ENodeType fNodeType
Definition: TStructNode.h:54
Float_t GetRelativeVolumeRatio()
Returns ratio - relative volume to area taken by utlining box.
TList * fMembers
Definition: TStructNode.h:49
Float_t GetMiddle() const
Returns center of outlining box on y-axis.
ENodeType GetNodeType() const
Returns type of node.
void SetHeight(Float_t h)
Sets width of outlining box to "w".
Float_t GetHeight() const
Returns height of outlining box.
UInt_t GetMaxObjects() const
Returns maximum number of objects displayed when the node is top node on scene.
static EScalingType fgScalBy
Definition: TStructNode.h:37
TStructNode * fParent
Definition: TStructNode.h:42
UInt_t GetLevel() const
Returns actual level of node.
Float_t fWidth
Definition: TStructNode.h:52
void * fPointer
Definition: TStructNode.h:46
ULong_t GetTotalSize() const
Returns total size of allocated memory in bytes.
Float_t fX
Definition: TStructNode.h:50
Bool_t IsCollapsed() const
Returns true if node is colllapsed.
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17