Logo ROOT  
Reference Guide
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 #include "TLeaf.h"
26 #include "TClassRef.h"
27 
28 class TClass;
29 class TMethodCall;
30 
31 class TLeafObject : public TLeaf {
32 
33 protected:
34  TClassRef fClass; ///<! pointer to class
35  void **fObjAddress; ///<! Address of Pointer to object
36  Bool_t fVirtual; ///< Support for polymorphism, when set classname is written with object.
37 
38 public:
39  enum EStatusBits {
40  kWarn = BIT(14)
41  };
42 
43  // In version of ROOT older then v6.12, kWarn was set to BIT(12)
44  // which overlaps with TBranch::kBranchObject. Since it stored
45  // in ROOT files as part of the TBranchObject and that we want
46  // to reset in TBranchObject::Streamer, we need to keep track
47  // of the old value.
49  kOldWarn = BIT(12)
50  };
51 
52  TLeafObject();
53  TLeafObject(TBranch *parent, const char *name, const char *type);
54  virtual ~TLeafObject();
55 
56  virtual Bool_t CanGenerateOffsetArray() { return false; }
57  virtual void FillBasket(TBuffer &b);
58  virtual Int_t *GenerateOffsetArrayBase(Int_t /*base*/, Int_t /*events*/) { return nullptr; }
59  TClass *GetClass() const {return fClass;}
60  TMethodCall *GetMethodCall(const char *name);
61  TObject *GetObject() const {return (TObject*)(*fObjAddress);}
62  const char *GetTypeName() const ;
63  virtual void *GetValuePointer() const {return fObjAddress;}
64  Bool_t IsOnTerminalBranch() const;
65  Bool_t IsVirtual() const {return fVirtual;}
66  virtual Bool_t Notify();
67  virtual void PrintValue(Int_t i=0) const;
68  virtual void ReadBasket(TBuffer &b);
69  virtual void SetAddress(void *add=0);
70  virtual void SetVirtual(Bool_t virt=kTRUE) {fVirtual=virt;}
71 
72  ClassDef(TLeafObject,4); //A TLeaf for a general object derived from TObject.
73 };
74 
75 #endif
TLeafObject::SetVirtual
virtual void SetVirtual(Bool_t virt=kTRUE)
Definition: TLeafObject.h:70
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TLeafObject::IsVirtual
Bool_t IsVirtual() const
Definition: TLeafObject.h:65
TLeafObject::fClass
TClassRef fClass
! pointer to class
Definition: TLeafObject.h:34
TLeafObject::kWarn
@ kWarn
Definition: TLeafObject.h:40
TLeafObject::IsOnTerminalBranch
Bool_t IsOnTerminalBranch() const
Return true if this leaf is does not have any sub-branch/leaf.
Definition: TLeafObject.cxx:230
TLeafObject::GetObject
TObject * GetObject() const
Definition: TLeafObject.h:61
TLeafObject::CanGenerateOffsetArray
virtual Bool_t CanGenerateOffsetArray()
Definition: TLeafObject.h:56
Int_t
int Int_t
Definition: RtypesCore.h:45
TBuffer
Definition: TBuffer.h:43
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TLeafObject::EStatusBitsOldValues
EStatusBitsOldValues
Definition: TLeafObject.h:48
TLeafObject::GetMethodCall
TMethodCall * GetMethodCall(const char *name)
Returns pointer to method corresponding to name.
Definition: TLeafObject.cxx:91
b
#define b(i)
Definition: RSha256.hxx:118
bool
TLeafObject::GetValuePointer
virtual void * GetValuePointer() const
Definition: TLeafObject.h:63
TLeafObject::ReadBasket
virtual void ReadBasket(TBuffer &b)
Read leaf elements from Basket input buffer.
Definition: TLeafObject.cxx:136
TBranch
Definition: TBranch.h:89
TLeaf.h
TLeafObject::~TLeafObject
virtual ~TLeafObject()
Default destructor for a LeafObject.
Definition: TLeafObject.cxx:52
TLeaf
Definition: TLeaf.h:57
TLeafObject::fObjAddress
void ** fObjAddress
! Address of Pointer to object
Definition: TLeafObject.h:35
TLeafObject::Notify
virtual Bool_t Notify()
This method must be overridden to handle object notifcation.
Definition: TLeafObject.cxx:119
TLeafObject
Definition: TLeafObject.h:31
BIT
#define BIT(n)
Definition: Rtypes.h:85
TLeafObject::FillBasket
virtual void FillBasket(TBuffer &b)
Pack leaf elements in Basket output buffer.
Definition: TLeafObject.cxx:59
TLeafObject::kOldWarn
@ kOldWarn
Definition: TLeafObject.h:49
TLeafObject::SetAddress
virtual void SetAddress(void *add=0)
Set leaf buffer data address.
Definition: TLeafObject.cxx:184
TClassRef.h
TClass
Definition: TClass.h:80
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TLeafObject::GenerateOffsetArrayBase
virtual Int_t * GenerateOffsetArrayBase(Int_t, Int_t)
Definition: TLeafObject.h:58
name
char name[80]
Definition: TGX11.cxx:110
TClassRef
Definition: TClassRef.h:28
TMethodCall
Definition: TMethodCall.h:37
TLeafObject::PrintValue
virtual void PrintValue(Int_t i=0) const
Prints leaf value.
Definition: TLeafObject.cxx:128
TLeafObject::fVirtual
Bool_t fVirtual
Support for polymorphism, when set classname is written with object.
Definition: TLeafObject.h:36
type
int type
Definition: TGX11.cxx:121
TLeafObject::TLeafObject
TLeafObject()
Default constructor for LeafObject.
Definition: TLeafObject.cxx:30
TLeafObject::GetClass
TClass * GetClass() const
Definition: TLeafObject.h:59
TObject::EStatusBits
EStatusBits
Definition: TObject.h:57
TLeafObject::GetTypeName
const char * GetTypeName() const
Returns name of leaf type.
Definition: TLeafObject.cxx:111
int