Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 };
25 enum EScalingType {
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:
37  static EScalingType fgScalBy;
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;
63  ULong_t GetAllMembersCount() 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;
76  ULong_t GetRelativeMembersCount() const;
77  ULong_t GetRelativeSize() const;
78  ULong_t GetRelativeVolume() const;
79  Float_t GetRelativeVolumeRatio();
80  ULong_t GetSize() const;
81  ULong_t GetTotalSize() const;
82  TString GetTypeName() const;
83  ULong_t GetVolume() const;
84  Float_t GetVolumeRatio();
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);
98  void SetNodeType(ENodeType type);
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