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
28class TObject;
29class TClass;
30
32public:
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 };
38private:
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
46public:
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);
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
int Ssiz_t
Definition: RtypesCore.h:65
bool Bool_t
Definition: RtypesCore.h:61
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
Abstract base class for accessing the data-members of a class.
const char * GetParent() const
void GenericShowMembers(const char *topClassName, const void *obj, Bool_t transientMember)
TMemberInspector(const TMemberInspector &)
TMemberInspector & operator=(const TMemberInspector &)
void RemoveFromParent(Ssiz_t startingAt)
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr, Bool_t)
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
virtual ~TMemberInspector()
EObjectPointerState GetObjectValidity() const
void AddToParent(const char *name)
Ssiz_t GetParentLen() const
virtual Bool_t IsTreatingNonAccessibleTypes()
TParentBuf * fParent
EObjectPointerState fObjectPointerState
void SetObjectValidity(EObjectPointerState val)
void InspectMember(const T &obj, const char *name, Bool_t isTransient)
Mother of all ROOT objects.
Definition: TObject.h:37
double T(double x)
Definition: ChebyshevPol.h:34