ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TLeafObject.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Rene Brun 27/01/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_TLeafObject
13 #define ROOT_TLeafObject
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TLeafObject //
19 // //
20 // A TLeaf for a general object derived from TObject. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 
25 #ifndef ROOT_TLeaf
26 #include "TLeaf.h"
27 #endif
28 #ifndef ROOT_TClassRef
29 #include "TClassRef.h"
30 #endif
31 
32 class TClass;
33 class TMethodCall;
34 
35 class TLeafObject : public TLeaf {
36 
37 protected:
38  TClassRef fClass; //! pointer to class
39  void **fObjAddress; //! Address of Pointer to object
40  Bool_t fVirtual; // Support for polymorphism, when set classname is written with object.
41 
42 public:
43  enum { kWarn = BIT(12) };
44 
45  TLeafObject();
46  TLeafObject(TBranch *parent, const char *name, const char *type);
47  virtual ~TLeafObject();
48 
49  virtual void FillBasket(TBuffer &b);
50  TClass *GetClass() const {return fClass;}
51  TMethodCall *GetMethodCall(const char *name);
52  TObject *GetObject() const {return (TObject*)(*fObjAddress);}
53  const char *GetTypeName() const ;
54  virtual void *GetValuePointer() const {return fObjAddress;}
55  Bool_t IsOnTerminalBranch() const;
56  Bool_t IsVirtual() const {return fVirtual;}
57  virtual Bool_t Notify();
58  virtual void PrintValue(Int_t i=0) const;
59  virtual void ReadBasket(TBuffer &b);
60  virtual void SetAddress(void *add=0);
61  virtual void SetVirtual(Bool_t virt=kTRUE) {fVirtual=virt;}
62 
63  ClassDef(TLeafObject,4); //A TLeaf for a general object derived from TObject.
64 };
65 
66 #endif
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition: TLeaf.h:37
Bool_t IsOnTerminalBranch() const
Return true if this leaf is does not have any sub-branch/leaf.
Bool_t fVirtual
Address of Pointer to object.
Definition: TLeafObject.h:40
A TLeaf for a general object derived from TObject.
Definition: TLeafObject.h:35
#define BIT(n)
Definition: Rtypes.h:120
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TClassRef fClass
Definition: TLeafObject.h:38
TMethodCall * GetMethodCall(const char *name)
Returns pointer to method corresponding to name.
Definition: TLeafObject.cxx:89
const char * GetTypeName() const
Returns name of leaf type.
Bool_t IsVirtual() const
Definition: TLeafObject.h:56
virtual void ReadBasket(TBuffer &b)
Read leaf elements from Basket input buffer.
Method or function calling interface.
Definition: TMethodCall.h:41
virtual void * GetValuePointer() const
Definition: TLeafObject.h:54
void ** fObjAddress
pointer to class
Definition: TLeafObject.h:39
virtual void SetAddress(void *add=0)
Set leaf buffer data address.
virtual ~TLeafObject()
Default destructor for a LeafObject.
Definition: TLeafObject.cxx:50
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
virtual void FillBasket(TBuffer &b)
Pack leaf elements in Basket output buffer.
Definition: TLeafObject.cxx:57
virtual Bool_t Notify()
This method must be overridden to handle object notifcation.
TClass * GetClass() const
Definition: TLeafObject.h:50
int type
Definition: TGX11.cxx:120
TObject * GetObject() const
Definition: TLeafObject.h:52
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
TClassRef is used to implement a permanent reference to a TClass object.
Definition: TClassRef.h:33
virtual void SetVirtual(Bool_t virt=kTRUE)
Definition: TLeafObject.h:61
A TTree is a list of TBranches.
Definition: TBranch.h:58
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void PrintValue(Int_t i=0) const
Prints leaf value.
ClassDef(TLeafObject, 4)