TStructNode.h

Go to the documentation of this file.
00001 // @(#)root/gviz3d:$Id: TStructNode.h 29985 2009-08-31 16:05:21Z brun $
00002 // Author: Tomasz Sosnicki   18/09/09
00003 
00004 /************************************************************************
00005 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
00006 * All rights reserved.                                                  *
00007 *                                                                       *
00008 * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010 *************************************************************************/
00011 
00012 #ifndef ROOT_TStructNode
00013 #define ROOT_TStructNode
00014 
00015 #include <TObject.h>
00016 #include <TString.h>
00017 
00018 enum ENodeType {
00019    kUnknown = 1,  // Unknown type
00020    kClass,        // Class or structure
00021    kCollection,   // TCollection (e.g. TList, TExMap, TMap etc.)
00022    kBasic,        // Basic type (e.g. char, float, double)
00023    kSTLCollection // STL collection
00024 };
00025 enum EScalingType {
00026    kSize,         // Objects are proportional to allocated memory
00027    kMembers       // Objects are proportional to number of members
00028 };
00029 
00030 //________________________________________________________________________
00031 //
00032 // Logical node with informatioon about class
00033 
00034 class TStructNode : public TObject {
00035 
00036 private:
00037    static EScalingType  fgScalBy;
00038    TString              fName;            // Name of node
00039    TString              fTypeName;        // Name of type
00040    ULong_t              fSize;            // Memory allocated by class without pointers and list elements
00041    ULong_t              fTotalSize;       // Total allocated memory
00042    TStructNode         *fParent;          // Pointer to parent node, NULL if not exist
00043    UInt_t               fLevel;           // Level number
00044    ULong_t              fMembersCount;    // Number of members in class
00045    ULong_t              fAllMembersCount; // Number of all members (class and its daughters)
00046    void*                fPointer;         // Pointer to data (address of variable)
00047    Bool_t               fCollapsed;       // Condition - true if node is collapsed (we don't see dauthers)
00048    Bool_t               fVisible;         // Condition - true if node is visible
00049    TList*               fMembers;         // List of daughter nodes
00050    Float_t              fX;               // X coordinate in 3D space
00051    Float_t              fY;               // Y coordinate in 3D space
00052    Float_t              fWidth;           // Width of outlining box
00053    Float_t              fHeight;          // Height of outlining box
00054    ENodeType            fNodeType;        // Type of node
00055    UInt_t               fMaxLevel;        // Number of levels displayed when the node is top node on scene
00056    UInt_t               fMaxObjects;      // Number of objects displayed when the node is top node on scene
00057 
00058 public:
00059    TStructNode(TString name, TString typeName, void* pointer, TStructNode* parent, ULong_t size, ENodeType type);
00060    ~TStructNode();
00061    
00062    virtual Int_t  Compare(const TObject* obj) const;
00063    ULong_t        GetAllMembersCount() const;
00064    Float_t        GetCenter() const;
00065    Float_t        GetHeight() const;
00066    UInt_t         GetLevel() const;
00067    UInt_t         GetMaxLevel() const;
00068    UInt_t         GetMaxObjects() const;
00069    TList*         GetMembers() const;
00070    ULong_t        GetMembersCount() const;
00071    Float_t        GetMiddle() const;
00072    const char*    GetName() const;
00073    ENodeType      GetNodeType() const;
00074    TStructNode   *GetParent() const;
00075    void*          GetPointer() const;
00076    ULong_t        GetRelativeMembersCount() const;
00077    ULong_t        GetRelativeSize() const;
00078    ULong_t        GetRelativeVolume() const;
00079    Float_t        GetRelativeVolumeRatio();
00080    ULong_t        GetSize() const;
00081    ULong_t        GetTotalSize() const;
00082    TString        GetTypeName() const;
00083    ULong_t        GetVolume() const;
00084    Float_t        GetVolumeRatio();
00085    Float_t        GetWidth() const;
00086    Float_t        GetX() const;
00087    Float_t        GetY() const;
00088    Bool_t         IsCollapsed() const;
00089    virtual Bool_t IsSortable() const;
00090    bool           IsVisible() const;
00091    void           SetAllMembersCount(ULong_t count);
00092    void           SetCollapsed(Bool_t collapsed);
00093    void           SetHeight(Float_t h);
00094    void           SetMaxLevel(UInt_t level);
00095    void           SetMaxObjects(UInt_t max);
00096    void           SetMembers(TList* list);
00097    void           SetMembersCount(ULong_t count);
00098    void           SetNodeType(ENodeType type);
00099    void           SetPointer(void* pointer);
00100    static void    SetScaleBy(EScalingType type);
00101    void           SetSize(ULong_t size);
00102    void           SetTotalSize(ULong_t size);
00103    void           SetVisible(bool visible);
00104    void           SetWidth(Float_t w);
00105    void           SetX(Float_t x);
00106    void           SetY(Float_t y);
00107 
00108    ClassDef(TStructNode,0); // Node with information about class
00109 };
00110 
00111 #endif

Generated on Tue Jul 5 14:18:43 2011 for ROOT_528-00b_version by  doxygen 1.5.1