Logo ROOT   6.10/09
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
Float_t GetWidth() const
Returns width of outlining box.
void SetNodeType(ENodeType type)
Sets type of node to "type".
float Float_t
Definition: RtypesCore.h:53
Float_t GetCenter() const
Returns center of outlining box on x-axis.
Bool_t fVisible
Definition: TStructNode.h:48
~TStructNode()
Destructs list of nodes.
Definition: TStructNode.cxx:63
ULong_t GetVolume() const
Returns size or number of members.
void SetY(Float_t y)
Sets Y coordinate to "y".
Float_t GetRelativeVolumeRatio()
Returns ratio - relative volume to area taken by utlining box.
ULong_t fMembersCount
Definition: TStructNode.h:44
ULong_t GetRelativeVolume() const
Returns size or number of members.
UInt_t GetMaxLevel() const
Returns maximum number of leves displayed when the node is top node on scene.
TH1 * h
Definition: legend2.C:5
Float_t fHeight
Definition: TStructNode.h:53
Basic string class.
Definition: TString.h:129
void SetMembersCount(ULong_t count)
Sets number of members to "number".
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
ULong_t GetSize() const
Returns size of node.
UInt_t GetMaxObjects() const
Returns maximum number of objects displayed when the node is top node on scene.
ULong_t GetRelativeMembersCount() const
Returns relative numbers of members.
TList * fMembers
Definition: TStructNode.h:49
TList * GetMembers() const
Returns list with pointers to daughter nodes.
void SetAllMembersCount(ULong_t count)
Sets numbers of all members to "number".
void SetSize(ULong_t size)
Sets size of node to "size".
Float_t GetX() const
Returns X coordinate.
void SetMembers(TList *list)
Sets list of dauther nodes to "list".
void * GetPointer() const
Returns main pointer.
Double_t x[n]
Definition: legend1.C:17
Float_t fY
Definition: TStructNode.h:51
#define ClassDef(name, id)
Definition: Rtypes.h:297
TStructNode * fParent
Definition: TStructNode.h:42
void SetWidth(Float_t w)
Sets width of outlining box to "w".
ULong_t fAllMembersCount
Definition: TStructNode.h:45
Float_t GetMiddle() const
Returns center of outlining box on y-axis.
A doubly linked list.
Definition: TList.h:43
bool IsVisible() const
Returns true if node is visible.
void SetPointer(void *pointer)
Sets main pointer to "pointer".
TString GetTypeName() const
Returns name of class.
const char * GetName() const
Returns name of object.
void SetCollapsed(Bool_t collapsed)
Sets collapsing of node to "collapse".
static EScalingType fgScalBy
Definition: TStructNode.h:37
UInt_t fMaxObjects
Definition: TStructNode.h:56
Float_t fX
Definition: TStructNode.h:50
ENodeType GetNodeType() const
Returns type of node.
TString fName
Definition: TStructNode.h:38
void SetMaxObjects(UInt_t max)
Sets maximum number of objects displayed when the node is top node on scene.
void SetVisible(bool visible)
Sets visibility of node to "visible".
ENodeType fNodeType
Definition: TStructNode.h:54
unsigned int UInt_t
Definition: RtypesCore.h:42
Float_t GetY() const
Returns Y coordinate.
void SetHeight(Float_t h)
Sets width of outlining box to "w".
UInt_t GetLevel() const
Returns actual level of node.
ULong_t GetTotalSize() const
Returns total size of allocated memory in bytes.
ENodeType
Definition: TStructNode.h:18
TString fTypeName
Definition: TStructNode.h:39
virtual Int_t Compare(const TObject *obj) const
Overrided method. Compare to objects of TStructNode class.
Definition: TStructNode.cxx:71
Float_t GetHeight() const
Returns height of outlining box.
static void SetScaleBy(EScalingType type)
Sets scaling by to "type".
virtual Bool_t IsSortable() const
Returns true, because we have overrided method Compare.
ULong_t fSize
Definition: TStructNode.h:40
void * fPointer
Definition: TStructNode.h:46
EScalingType
Definition: TStructNode.h:25
Float_t fWidth
Definition: TStructNode.h:52
int type
Definition: TGX11.cxx:120
void SetTotalSize(ULong_t size)
Sets total size of allocated memory in bytes to value "size".
unsigned long ULong_t
Definition: RtypesCore.h:51
Double_t y[n]
Definition: legend1.C:17
UInt_t fMaxLevel
Definition: TStructNode.h:55
TStructNode * GetParent() const
Returns pointer to parent node.
Mother of all ROOT objects.
Definition: TObject.h:37
void SetMaxLevel(UInt_t level)
Sets maximum number of leves displayed when the node is top node on scene.
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
ULong_t GetAllMembersCount() const
Returns number of all members in node.
Definition: TStructNode.cxx:95
Float_t GetVolumeRatio()
Returns ratio - volme of node to area taken by outlining box.
UInt_t fLevel
Definition: TStructNode.h:43
void SetX(Float_t x)
Sets X coordinate to "x".
Bool_t IsCollapsed() const
Returns true if node is colllapsed.
ULong_t GetMembersCount() const
Returns numbers of members of node.
ULong_t GetRelativeSize() const
Returns relative size of node.
Bool_t fCollapsed
Definition: TStructNode.h:47
ULong_t fTotalSize
Definition: TStructNode.h:41