Logo ROOT  
Reference Guide
TMemberInspector.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 15/07/96
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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_TMemberInspector
13 #define ROOT_TMemberInspector
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TMemberInspector //
18 // //
19 // Abstract base class for accessing the datamembers of a class. //
20 // Classes derived from this class can be given as argument to the //
21 // ShowMembers() methods of ROOT classes. This feature facilitates //
22 // the writing of class browsers and inspectors. //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #include "Rtypes.h"
27 
28 class TObject;
29 class TClass;
30 
32 public:
34  kUnset, // No Inspect() call has been seen yet.
35  kNoObjectGiven, // No object was given to the initial Inspect() call.
36  kValidObjectGiven // The address points to an actual object.
37  };
38 private:
39  class TParentBuf;
40  TParentBuf* fParent; // current inspection "path"
41  EObjectPointerState fObjectPointerState; // whether the address is valid or only an offset
42 
43  TMemberInspector(const TMemberInspector&); // Not implemented.
44  TMemberInspector &operator=(const TMemberInspector&); // Not implemented.
45 
46 public:
48  virtual ~TMemberInspector();
49 
52  virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr);
53  virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr, Bool_t /* isTransient */) { Inspect(cl,parent,name,addr); }
54 
55  const char* GetParent() const;
56  Ssiz_t GetParentLen() const;
57  void AddToParent(const char* name);
58  void RemoveFromParent(Ssiz_t startingAt);
59 
61 
62  template <class T>
63  void InspectMember(const T& obj, const char* name, Bool_t isTransient) {
64  Ssiz_t len = GetParentLen();
66  obj.IsA()->CallShowMembers(&obj, *this, isTransient);
67  RemoveFromParent(len);
68  }
69 
70  void InspectMember(const TObject& obj, const char* name, Bool_t isTransient);
71  void InspectMember(const char* topclassname, const void* pobj, const char* name,
72  Bool_t transient);
73  void InspectMember(TClass* cl, const void* pobj, const char* name,
74  Bool_t isTransient);
75 
76  void GenericShowMembers(const char *topClassName, const void *obj,
77  Bool_t transientMember);
78 
79  ClassDef(TMemberInspector,0) //ABC for inspecting class data members
80 };
81 
82 #endif
TMemberInspector
Definition: TMemberInspector.h:31
TMemberInspector::GenericShowMembers
void GenericShowMembers(const char *topClassName, const void *obj, Bool_t transientMember)
Definition: TMemberInspector.cxx:105
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TMemberInspector::EObjectPointerState
EObjectPointerState
Definition: TMemberInspector.h:33
TMemberInspector::kNoObjectGiven
@ kNoObjectGiven
Definition: TMemberInspector.h:35
TMemberInspector::TMemberInspector
TMemberInspector()
Definition: TMemberInspector.cxx:62
TMemberInspector::IsTreatingNonAccessibleTypes
virtual Bool_t IsTreatingNonAccessibleTypes()
Definition: TMemberInspector.h:60
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TMemberInspector::kUnset
@ kUnset
Definition: TMemberInspector.h:34
bool
TMemberInspector::AddToParent
void AddToParent(const char *name)
Definition: TMemberInspector.cxx:87
TMemberInspector::fObjectPointerState
EObjectPointerState fObjectPointerState
Definition: TMemberInspector.h:41
TMemberInspector::Inspect
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr, Bool_t)
Definition: TMemberInspector.h:53
Ssiz_t
int Ssiz_t
Definition: RtypesCore.h:67
TMemberInspector::GetParent
const char * GetParent() const
Definition: TMemberInspector.cxx:75
TMemberInspector::GetObjectValidity
EObjectPointerState GetObjectValidity() const
Definition: TMemberInspector.h:50
TMemberInspector::SetObjectValidity
void SetObjectValidity(EObjectPointerState val)
Definition: TMemberInspector.h:51
TMemberInspector::~TMemberInspector
virtual ~TMemberInspector()
Definition: TMemberInspector.cxx:70
TMemberInspector::Inspect
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
Definition: TMemberInspector.cxx:99
TClass
Definition: TClass.h:80
TMemberInspector::InspectMember
void InspectMember(const T &obj, const char *name, Bool_t isTransient)
Definition: TMemberInspector.h:63
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:52
TMemberInspector::GetParentLen
Ssiz_t GetParentLen() const
Definition: TMemberInspector.cxx:81
Rtypes.h
TMemberInspector::operator=
TMemberInspector & operator=(const TMemberInspector &)
TMemberInspector::RemoveFromParent
void RemoveFromParent(Ssiz_t startingAt)
Definition: TMemberInspector.cxx:93
TMemberInspector::kValidObjectGiven
@ kValidObjectGiven
Definition: TMemberInspector.h:36
TMemberInspector::fParent
TParentBuf * fParent
Definition: TMemberInspector.h:39
int