Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:27

0001 // @(#)root/gviz3d:$Id$
0002 // Author: Tomasz Sosnicki   18/09/09
0003 
0004 /************************************************************************
0005 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
0006 * All rights reserved.                                                  *
0007 *                                                                       *
0008 * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010 *************************************************************************/
0011 
0012 #ifndef ROOT_TStructNode
0013 #define ROOT_TStructNode
0014 
0015 #include <TObject.h>
0016 #include <TString.h>
0017 
0018 enum ENodeType {
0019    kUnknown = 1,  // Unknown type
0020    kClass,        // Class or structure
0021    kCollection,   // TCollection (e.g. TList, TExMap, TMap etc.)
0022    kBasic,        // Basic type (e.g. char, float, double)
0023    kSTLCollection // STL collection
0024 };
0025 enum EScalingType {
0026    kSize,         // Objects are proportional to allocated memory
0027    kMembers       // Objects are proportional to number of members
0028 };
0029 
0030 //________________________________________________________________________
0031 //
0032 // Logical node with informatioon about class
0033 
0034 class TStructNode : public TObject {
0035 
0036 private:
0037    static EScalingType  fgScalBy;
0038    TString              fName;            // Name of node
0039    TString              fTypeName;        // Name of type
0040    ULong_t              fSize;            // Memory allocated by class without pointers and list elements
0041    ULong_t              fTotalSize;       // Total allocated memory
0042    TStructNode         *fParent;          // Pointer to parent node, NULL if not exist
0043    UInt_t               fLevel;           // Level number
0044    ULong_t              fMembersCount;    // Number of members in class
0045    ULong_t              fAllMembersCount; // Number of all members (class and its daughters)
0046    void*                fPointer;         // Pointer to data (address of variable)
0047    Bool_t               fCollapsed;       // Condition - true if node is collapsed (we don't see dauthers)
0048    Bool_t               fVisible;         // Condition - true if node is visible
0049    TList*               fMembers;         // List of daughter nodes
0050    Float_t              fX;               // X coordinate in 3D space
0051    Float_t              fY;               // Y coordinate in 3D space
0052    Float_t              fWidth;           // Width of outlining box
0053    Float_t              fHeight;          // Height of outlining box
0054    ENodeType            fNodeType;        // Type of node
0055    UInt_t               fMaxLevel;        // Number of levels displayed when the node is top node on scene
0056    UInt_t               fMaxObjects;      // Number of objects displayed when the node is top node on scene
0057 
0058 public:
0059    TStructNode(TString name, TString typeName, void* pointer, TStructNode* parent, ULong_t size, ENodeType type);
0060    ~TStructNode() override;
0061 
0062    Int_t  Compare(const TObject* obj) const override;
0063    ULong_t        GetAllMembersCount() const;
0064    Float_t        GetCenter() const;
0065    Float_t        GetHeight() const;
0066    UInt_t         GetLevel() const;
0067    UInt_t         GetMaxLevel() const;
0068    UInt_t         GetMaxObjects() const;
0069    TList*         GetMembers() const;
0070    ULong_t        GetMembersCount() const;
0071    Float_t        GetMiddle() const;
0072    const char*    GetName() const override;
0073    ENodeType      GetNodeType() const;
0074    TStructNode   *GetParent() const;
0075    void*          GetPointer() const;
0076    ULong_t        GetRelativeMembersCount() const;
0077    ULong_t        GetRelativeSize() const;
0078    ULong_t        GetRelativeVolume() const;
0079    Float_t        GetRelativeVolumeRatio();
0080    ULong_t        GetSize() const;
0081    ULong_t        GetTotalSize() const;
0082    TString        GetTypeName() const;
0083    ULong_t        GetVolume() const;
0084    Float_t        GetVolumeRatio();
0085    Float_t        GetWidth() const;
0086    Float_t        GetX() const;
0087    Float_t        GetY() const;
0088    Bool_t         IsCollapsed() const;
0089    Bool_t IsSortable() const override;
0090    bool           IsVisible() const;
0091    void           SetAllMembersCount(ULong_t count);
0092    void           SetCollapsed(Bool_t collapsed);
0093    void           SetHeight(Float_t h);
0094    void           SetMaxLevel(UInt_t level);
0095    void           SetMaxObjects(UInt_t max);
0096    void           SetMembers(TList* list);
0097    void           SetMembersCount(ULong_t count);
0098    void           SetNodeType(ENodeType type);
0099    void           SetPointer(void* pointer);
0100    static void    SetScaleBy(EScalingType type);
0101    void           SetSize(ULong_t size);
0102    void           SetTotalSize(ULong_t size);
0103    void           SetVisible(bool visible);
0104    void           SetWidth(Float_t w);
0105    void           SetX(Float_t x);
0106    void           SetY(Float_t y);
0107 
0108    ClassDefOverride(TStructNode,0); // Node with information about class
0109 };
0110 
0111 #endif