Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
28class TClass;
29class TMethodCall;
30
31class TLeafObject : public TLeaf {
32
33protected:
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
38public:
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
53 TLeafObject(TBranch *parent, const char *name, const char *type);
54 virtual ~TLeafObject();
55
56 Bool_t CanGenerateOffsetArray() override { return false; }
57 void FillBasket(TBuffer &b) override;
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 override;
63 void *GetValuePointer() const override {return fObjAddress;}
64 Bool_t IsOnTerminalBranch() const override;
65 Bool_t IsVirtual() const {return fVirtual;}
66 Bool_t Notify() override;
67 void PrintValue(Int_t i=0) const override;
68 void ReadBasket(TBuffer &b) override;
69 void SetAddress(void *add=nullptr) override;
70 virtual void SetVirtual(Bool_t virt=kTRUE) {fVirtual=virt;}
71
72 ClassDefOverride(TLeafObject,4); //A TLeaf for a general object derived from TObject.
73};
74
75#endif
#define b(i)
Definition RSha256.hxx:100
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
A TTree is a list of TBranches.
Definition TBranch.h:89
Buffer base class used for serializing objects.
Definition TBuffer.h:43
TClassRef is used to implement a permanent reference to a TClass object.
Definition TClassRef.h:28
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
A TLeaf for a general object derived from TObject.
Definition TLeafObject.h:31
virtual ~TLeafObject()
Default destructor for a LeafObject.
void ReadBasket(TBuffer &b) override
Read leaf elements from Basket input buffer.
TClass * GetClass() const
Definition TLeafObject.h:59
void FillBasket(TBuffer &b) override
Pack leaf elements in Basket output buffer.
virtual Int_t * GenerateOffsetArrayBase(Int_t, Int_t)
Definition TLeafObject.h:58
Bool_t CanGenerateOffsetArray() override
Definition TLeafObject.h:56
TLeafObject()
Default constructor for LeafObject.
Bool_t IsOnTerminalBranch() const override
Return true if this leaf is does not have any sub-branch/leaf.
TObject * GetObject() const
Definition TLeafObject.h:61
const char * GetTypeName() const override
Returns name of leaf type.
Bool_t fVirtual
Support for polymorphism, when set classname is written with object.
Definition TLeafObject.h:36
Bool_t IsVirtual() const
Definition TLeafObject.h:65
void PrintValue(Int_t i=0) const override
Prints leaf value.
EStatusBitsOldValues
In version of ROOT older then v6.12, kWarn was set to BIT(12) which overlaps with TBranch::kBranchObj...
Definition TLeafObject.h:48
void * GetValuePointer() const override
Definition TLeafObject.h:63
Bool_t Notify() override
This method must be overridden to handle object notification.
void ** fObjAddress
! Address of Pointer to object
Definition TLeafObject.h:35
TClassRef fClass
! pointer to class
Definition TLeafObject.h:34
void SetAddress(void *add=nullptr) override
Set leaf buffer data address.
TMethodCall * GetMethodCall(const char *name)
Returns pointer to method corresponding to name.
virtual void SetVirtual(Bool_t virt=kTRUE)
Definition TLeafObject.h:70
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition TLeaf.h:57
Method or function calling interface.
Definition TMethodCall.h:37
Mother of all ROOT objects.
Definition TObject.h:41