TStructViewer.h

Go to the documentation of this file.
00001 // @(#)root/gviz3d:$Id: TStructViewer.h 30023 2009-09-02 17:57:16Z 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_TStructViewer
00013 #define ROOT_TStructViewer
00014 
00015 #include <TObject.h>
00016 #include <TExMap.h>
00017 #include <TObjArray.h>
00018 #include <TList.h>
00019 #include <TCanvas.h>
00020 #include <TColor.h>
00021 
00022 class TStructViewerGUI;
00023 class TStructNode;
00024 class TGMainFrame;
00025 
00026 class TStructViewer : public TObject {
00027 
00028 private:
00029    void             *fPointer;            // Main pointer to represented object
00030    TClass           *fPointerClass;       // TClass of a main pointer
00031    TStructViewerGUI *fGUI;                // Pointer to GUI class
00032    TExMap            fLevelMembersCount;  // Contains number of objects on each level
00033    TExMap            fLevelSize;          // Contains total size in bytes of a level
00034    TExMap            fPointers;           // Map of pointer to avoid circulation
00035    TObjArray         fLevelArray;         // Array with pointers to nodes on each level
00036    TStructNode      *fTopNode;            // Master node for fPointer
00037    TList             fColors;             // List with properties used to color nodes
00038 
00039 
00040 private:
00041    void     AddNode(TStructNode* node, ULong_t size);
00042    void     CountMembers(TClass* cl, TStructNode* parent, void* pointer);
00043    void     Prepare();
00044    void     Reset();
00045 
00046 public:
00047    TStructViewer(void* ptr = NULL, const char * clname = NULL);
00048    ~TStructViewer();
00049 
00050    void     Draw(Option_t *option = "");
00051    TCanvas* GetCanvas();
00052    TGMainFrame* GetFrame();
00053    TColor   GetColor(const char* typeName);
00054    TExMap   GetLevelMembersCount() const;
00055    TExMap   GetLevelSize() const;
00056    Bool_t   GetLinksVisibility() const;
00057    void    *GetPointer() const;
00058    void     SetColor(TString name, Int_t color);
00059    void     SetLinksVisibility(Bool_t val);
00060    void     SetPointer(void* ptr, const char* clname = NULL);
00061 
00062    ClassDef(TStructViewer, 0); // A 3D struct viewer
00063 };
00064 
00065 #endif

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