Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TStructViewer.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_TStructViewer
13 #define ROOT_TStructViewer
14 
15 #include <TObject.h>
16 #include <TExMap.h>
17 #include <TObjArray.h>
18 #include <TList.h>
19 #include <TCanvas.h>
20 #include <TColor.h>
21 
22 class TStructViewerGUI;
23 class TStructNode;
24 class TGMainFrame;
25 
26 class TStructViewer : public TObject {
27 
28 private:
29  void *fPointer; // Main pointer to represented object
30  TClass *fPointerClass; // TClass of a main pointer
31  TStructViewerGUI *fGUI; // Pointer to GUI class
32  TExMap fLevelMembersCount; // Contains number of objects on each level
33  TExMap fLevelSize; // Contains total size in bytes of a level
34  TExMap fPointers; // Map of pointer to avoid circulation
35  TObjArray fLevelArray; // Array with pointers to nodes on each level
36  TStructNode *fTopNode; // Master node for fPointer
37  TList fColors; // List with properties used to color nodes
38 
39 
40 private:
41  void AddNode(TStructNode* node, ULong_t size);
42  void CountMembers(TClass* cl, TStructNode* parent, void* pointer);
43  void Prepare();
44  void Reset();
45 
46 public:
47  TStructViewer(void* ptr = NULL, const char * clname = NULL);
48  ~TStructViewer();
49 
50  void Draw(Option_t *option = "");
51  TCanvas* GetCanvas();
52  TGMainFrame* GetFrame();
53  TColor GetColor(const char* typeName);
54  TExMap GetLevelMembersCount() const;
55  TExMap GetLevelSize() const;
56  Bool_t GetLinksVisibility() const;
57  void *GetPointer() const;
58  void SetColor(TString name, Int_t color);
59  void SetLinksVisibility(Bool_t val);
60  void SetPointer(void* ptr, const char* clname = NULL);
61 
62  ClassDef(TStructViewer, 0); // A 3D struct viewer
63 };
64 
65 #endif