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 
18 enum ENodeType {
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 
34 class TStructNode : public TObject {
35 
36 private:
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 
58 public:
59  TStructNode(TString name, TString typeName, void* pointer, TStructNode* parent, ULong_t size, ENodeType type);
60  ~TStructNode();
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;
70  ULong_t GetMembersCount() const;
71  Float_t GetMiddle() const;
72  const char* GetName() const;
73  ENodeType GetNodeType() const;
74  TStructNode *GetParent() const;
75  void* GetPointer() const;
77  ULong_t GetRelativeSize() const;
78  ULong_t GetRelativeVolume() 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
TStructNode::fLevel
UInt_t fLevel
Definition: TStructNode.h:43
TStructNode::fTotalSize
ULong_t fTotalSize
Definition: TStructNode.h:41
TStructNode::GetSize
ULong_t GetSize() const
Returns size of node.
Definition: TStructNode.cxx:256
TStructNode::~TStructNode
~TStructNode()
Destructs list of nodes.
Definition: TStructNode.cxx:63
TStructNode::SetY
void SetY(Float_t y)
Sets Y coordinate to "y".
Definition: TStructNode.cxx:472
TStructNode::GetVolume
ULong_t GetVolume() const
Returns size or number of members.
Definition: TStructNode.cxx:281
TStructNode::fMembersCount
ULong_t fMembersCount
Definition: TStructNode.h:44
TStructNode::GetWidth
Float_t GetWidth() const
Returns width of outlining box.
Definition: TStructNode.cxx:304
kMembers
@ kMembers
Definition: TStructNode.h:27
kSTLCollection
@ kSTLCollection
Definition: TStructNode.h:23
TStructNode::GetX
Float_t GetX() const
Returns X coordinate.
Definition: TStructNode.cxx:312
TStructNode::GetRelativeVolumeRatio
Float_t GetRelativeVolumeRatio()
Returns ratio - relative volume to area taken by utlining box.
Definition: TStructNode.cxx:248
TStructNode::fY
Float_t fY
Definition: TStructNode.h:51
TStructNode::GetRelativeMembersCount
ULong_t GetRelativeMembersCount() const
Returns relative numbers of members.
Definition: TStructNode.cxx:200
Float_t
float Float_t
Definition: RtypesCore.h:57
EScalingType
EScalingType
Definition: TStructNode.h:25
TStructNode::SetNodeType
void SetNodeType(ENodeType type)
Sets type of node to "type".
Definition: TStructNode.cxx:408
kClass
@ kClass
Definition: TStructNode.h:20
TStructNode::GetMembers
TList * GetMembers() const
Returns list with pointers to daughter nodes.
Definition: TStructNode.cxx:159
x
Double_t x[n]
Definition: legend1.C:17
TStructNode::SetMembersCount
void SetMembersCount(ULong_t count)
Sets number of members to "number".
Definition: TStructNode.cxx:400
TStructNode::GetPointer
void * GetPointer() const
Returns main pointer.
Definition: TStructNode.cxx:191
TStructNode::GetMaxObjects
UInt_t GetMaxObjects() const
Returns maximum number of objects displayed when the node is top node on scene.
Definition: TStructNode.cxx:151
TStructNode::GetMaxLevel
UInt_t GetMaxLevel() const
Returns maximum number of leves displayed when the node is top node on scene.
Definition: TStructNode.cxx:143
kBasic
@ kBasic
Definition: TStructNode.h:22
TStructNode::fMembers
TList * fMembers
Definition: TStructNode.h:49
TString
Basic string class.
Definition: TString.h:136
TStructNode::fHeight
Float_t fHeight
Definition: TStructNode.h:53
TString.h
TStructNode::SetSize
void SetSize(ULong_t size)
Sets size of node to "size".
Definition: TStructNode.cxx:432
bool
TStructNode::SetWidth
void SetWidth(Float_t w)
Sets width of outlining box to "w".
Definition: TStructNode.cxx:456
TStructNode::fX
Float_t fX
Definition: TStructNode.h:50
kUnknown
@ kUnknown
Definition: TStructNode.h:19
TStructNode::GetNodeType
ENodeType GetNodeType() const
Returns type of node.
Definition: TStructNode.cxx:135
TStructNode::SetAllMembersCount
void SetAllMembersCount(ULong_t count)
Sets numbers of all members to "number".
Definition: TStructNode.cxx:352
TStructNode::SetMembers
void SetMembers(TList *list)
Sets list of dauther nodes to "list".
Definition: TStructNode.cxx:392
TStructNode::SetCollapsed
void SetCollapsed(Bool_t collapsed)
Sets collapsing of node to "collapse".
Definition: TStructNode.cxx:360
TStructNode::fMaxObjects
UInt_t fMaxObjects
Definition: TStructNode.h:56
TStructNode::GetMiddle
Float_t GetMiddle() const
Returns center of outlining box on y-axis.
Definition: TStructNode.cxx:175
TStructNode::fAllMembersCount
ULong_t fAllMembersCount
Definition: TStructNode.h:45
h
#define h(i)
Definition: RSha256.hxx:106
TStructNode::SetVisible
void SetVisible(bool visible)
Sets visibility of node to "visible".
Definition: TStructNode.cxx:448
TStructNode::GetLevel
UInt_t GetLevel() const
Returns actual level of node.
Definition: TStructNode.cxx:119
TStructNode::SetScaleBy
static void SetScaleBy(EScalingType type)
Sets scaling by to "type".
Definition: TStructNode.cxx:424
TStructNode::fParent
TStructNode * fParent
Definition: TStructNode.h:42
TStructNode::GetTypeName
TString GetTypeName() const
Returns name of class.
Definition: TStructNode.cxx:272
TStructNode::GetName
const char * GetName() const
Returns name of object.
Definition: TStructNode.cxx:127
TStructNode::fPointer
void * fPointer
Definition: TStructNode.h:46
y
Double_t y[n]
Definition: legend1.C:17
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TStructNode::SetMaxObjects
void SetMaxObjects(UInt_t max)
Sets maximum number of objects displayed when the node is top node on scene.
Definition: TStructNode.cxx:384
TStructNode::IsVisible
bool IsVisible() const
Returns true if node is visible.
Definition: TStructNode.cxx:344
TStructNode::GetY
Float_t GetY() const
Returns Y coordinate.
Definition: TStructNode.cxx:320
TStructNode::SetPointer
void SetPointer(void *pointer)
Sets main pointer to "pointer".
Definition: TStructNode.cxx:416
TStructNode::IsSortable
virtual Bool_t IsSortable() const
Returns true, because we have overrided method Compare.
Definition: TStructNode.cxx:336
TStructNode::fSize
ULong_t fSize
Definition: TStructNode.h:40
unsigned int
TStructNode::fWidth
Float_t fWidth
Definition: TStructNode.h:52
kSize
@ kSize
Definition: TStructNode.h:26
TStructNode::SetTotalSize
void SetTotalSize(ULong_t size)
Sets total size of allocated memory in bytes to value "size".
Definition: TStructNode.cxx:440
TStructNode::fgScalBy
static EScalingType fgScalBy
Definition: TStructNode.h:37
TStructNode
Definition: TStructNode.h:34
TStructNode::fName
TString fName
Definition: TStructNode.h:38
TStructNode::fNodeType
ENodeType fNodeType
Definition: TStructNode.h:54
TStructNode::GetVolumeRatio
Float_t GetVolumeRatio()
Returns ratio - volme of node to area taken by outlining box.
Definition: TStructNode.cxx:296
TStructNode::GetParent
TStructNode * GetParent() const
Returns pointer to parent node.
Definition: TStructNode.cxx:183
TStructNode::SetHeight
void SetHeight(Float_t h)
Sets width of outlining box to "w".
Definition: TStructNode.cxx:368
TObject.h
TStructNode::GetTotalSize
ULong_t GetTotalSize() const
Returns total size of allocated memory in bytes.
Definition: TStructNode.cxx:264
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TStructNode::fTypeName
TString fTypeName
Definition: TStructNode.h:39
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TStructNode::Compare
virtual Int_t Compare(const TObject *obj) const
Overrided method. Compare to objects of TStructNode class.
Definition: TStructNode.cxx:71
name
char name[80]
Definition: TGX11.cxx:110
TStructNode::GetHeight
Float_t GetHeight() const
Returns height of outlining box.
Definition: TStructNode.cxx:111
TStructNode::IsCollapsed
Bool_t IsCollapsed() const
Returns true if node is colllapsed.
Definition: TStructNode.cxx:328
TStructNode::SetX
void SetX(Float_t x)
Sets X coordinate to "x".
Definition: TStructNode.cxx:464
type
int type
Definition: TGX11.cxx:121
TStructNode::TStructNode
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
TStructNode::fMaxLevel
UInt_t fMaxLevel
Definition: TStructNode.h:55
TStructNode::GetAllMembersCount
ULong_t GetAllMembersCount() const
Returns number of all members in node.
Definition: TStructNode.cxx:95
TStructNode::GetMembersCount
ULong_t GetMembersCount() const
Returns numbers of members of node.
Definition: TStructNode.cxx:167
TStructNode::GetRelativeSize
ULong_t GetRelativeSize() const
Returns relative size of node.
Definition: TStructNode.cxx:212
TStructNode::fCollapsed
Bool_t fCollapsed
Definition: TStructNode.h:47
ENodeType
ENodeType
Definition: TStructNode.h:18
kCollection
@ kCollection
Definition: TStructNode.h:21
TStructNode::GetCenter
Float_t GetCenter() const
Returns center of outlining box on x-axis.
Definition: TStructNode.cxx:103
TStructNode::fVisible
Bool_t fVisible
Definition: TStructNode.h:48
TList
A doubly linked list.
Definition: TList.h:44
TStructNode::GetRelativeVolume
ULong_t GetRelativeVolume() const
Returns size or number of members.
Definition: TStructNode.cxx:226
int
TStructNode::SetMaxLevel
void SetMaxLevel(UInt_t level)
Sets maximum number of leves displayed when the node is top node on scene.
Definition: TStructNode.cxx:376