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_TStructViewer
0013 #define ROOT_TStructViewer
0014 
0015 #include <TObject.h>
0016 #include <TExMap.h>
0017 #include <TObjArray.h>
0018 #include <TList.h>
0019 #include <TCanvas.h>
0020 #include <TColor.h>
0021 
0022 class TStructViewerGUI;
0023 class TStructNode;
0024 class TGMainFrame;
0025 
0026 class TStructViewer : public TObject {
0027 
0028 private:
0029    void             *fPointer;            // Main pointer to represented object
0030    TClass           *fPointerClass;       // TClass of a main pointer
0031    TStructViewerGUI *fGUI;                // Pointer to GUI class
0032    TExMap            fLevelMembersCount;  // Contains number of objects on each level
0033    TExMap            fLevelSize;          // Contains total size in bytes of a level
0034    TExMap            fPointers;           // Map of pointer to avoid circulation
0035    TObjArray         fLevelArray;         // Array with pointers to nodes on each level
0036    TStructNode      *fTopNode;            // Master node for fPointer
0037    TList             fColors;             // List with properties used to color nodes
0038 
0039 
0040 private:
0041    void     AddNode(TStructNode* node, ULong_t size);
0042    void     CountMembers(TClass* cl, TStructNode* parent, void* pointer);
0043    void     Prepare();
0044    void     Reset();
0045 
0046 public:
0047    TStructViewer(void* ptr = nullptr, const char * clname = nullptr);
0048    ~TStructViewer() override;
0049 
0050    void     Draw(Option_t *option = "") override;
0051    TCanvas* GetCanvas();
0052    TGMainFrame* GetFrame();
0053    TColor   GetColor(const char* typeName);
0054    TExMap   GetLevelMembersCount() const;
0055    TExMap   GetLevelSize() const;
0056    Bool_t   GetLinksVisibility() const;
0057    void    *GetPointer() const;
0058    void     SetColor(TString name, Int_t color);
0059    void     SetLinksVisibility(Bool_t val);
0060    void     SetPointer(void* ptr, const char* clname = nullptr);
0061 
0062    ClassDefOverride(TStructViewer, 0); // A 3D struct viewer
0063 };
0064 
0065 #endif