ROOT logo
// @(#)root/base:$Id$
// Author: Fons Rademakers   15/07/96

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TMemberInspector
#define ROOT_TMemberInspector

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TMemberInspector                                                     //
//                                                                      //
// Abstract base class for accessing the datamembers of a class.        //
// Classes derived from this class can be given as argument to the      //
// ShowMembers() methods of ROOT classes. This feature facilitates      //
// the writing of class browsers and inspectors.                        //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "Rtypes.h"

class TObject;
class TClass;

class TMemberInspector {
private:
   class TParentBuf;
   TParentBuf* fParent; // current inspection "path"

   TMemberInspector(const TMemberInspector&);            // Not implemented.
   TMemberInspector &operator=(const TMemberInspector&); // Not implemented.

public:
   TMemberInspector();
   virtual ~TMemberInspector();

   virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr) = 0;

   const char* GetParent() const;
   Ssiz_t GetParentLen() const;
   void AddToParent(const char* name);
   void RemoveFromParent(Ssiz_t startingAt);

   template <class T>
   void InspectMember(T& obj, const char* name) {
      Ssiz_t len = GetParentLen();
      AddToParent(name);
      obj.ShowMembers(*this);
      RemoveFromParent(len);
   }

   void InspectMember(TObject& obj, const char* name);
   void InspectMember(const char* topclassname, void* pobj, const char* name,
                      Bool_t transient);
   void InspectMember(TClass* cl, void* pobj, const char* name);
   
   void GenericShowMembers(const char *topClassName, void *obj,
                           Bool_t transientMember);

   ClassDef(TMemberInspector,0)  //ABC for inspecting class data members
};

#endif
 TMemberInspector.h:1
 TMemberInspector.h:2
 TMemberInspector.h:3
 TMemberInspector.h:4
 TMemberInspector.h:5
 TMemberInspector.h:6
 TMemberInspector.h:7
 TMemberInspector.h:8
 TMemberInspector.h:9
 TMemberInspector.h:10
 TMemberInspector.h:11
 TMemberInspector.h:12
 TMemberInspector.h:13
 TMemberInspector.h:14
 TMemberInspector.h:15
 TMemberInspector.h:16
 TMemberInspector.h:17
 TMemberInspector.h:18
 TMemberInspector.h:19
 TMemberInspector.h:20
 TMemberInspector.h:21
 TMemberInspector.h:22
 TMemberInspector.h:23
 TMemberInspector.h:24
 TMemberInspector.h:25
 TMemberInspector.h:26
 TMemberInspector.h:27
 TMemberInspector.h:28
 TMemberInspector.h:29
 TMemberInspector.h:30
 TMemberInspector.h:31
 TMemberInspector.h:32
 TMemberInspector.h:33
 TMemberInspector.h:34
 TMemberInspector.h:35
 TMemberInspector.h:36
 TMemberInspector.h:37
 TMemberInspector.h:38
 TMemberInspector.h:39
 TMemberInspector.h:40
 TMemberInspector.h:41
 TMemberInspector.h:42
 TMemberInspector.h:43
 TMemberInspector.h:44
 TMemberInspector.h:45
 TMemberInspector.h:46
 TMemberInspector.h:47
 TMemberInspector.h:48
 TMemberInspector.h:49
 TMemberInspector.h:50
 TMemberInspector.h:51
 TMemberInspector.h:52
 TMemberInspector.h:53
 TMemberInspector.h:54
 TMemberInspector.h:55
 TMemberInspector.h:56
 TMemberInspector.h:57
 TMemberInspector.h:58
 TMemberInspector.h:59
 TMemberInspector.h:60
 TMemberInspector.h:61
 TMemberInspector.h:62
 TMemberInspector.h:63
 TMemberInspector.h:64
 TMemberInspector.h:65
 TMemberInspector.h:66
 TMemberInspector.h:67
 TMemberInspector.h:68
 TMemberInspector.h:69