Logo ROOT  
Reference Guide
TLeafElement.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Rene Brun 14/01/2001
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_TLeafElement
13 #define ROOT_TLeafElement
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TLeafElement //
19 // //
20 // A TLeaf for a general object derived from TObject. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include <atomic>
25 
26 #include "TDataType.h"
27 #include "TLeaf.h"
28 #include "TBranchElement.h"
29 
30 class TMethodCall;
31 
32 class TLeafElement : public TLeaf {
33 
34 protected:
35  char *fAbsAddress; ///<! Absolute leaf Address
36  Int_t fID; ///< element serial number in fInfo
37  Int_t fType; ///< leaf type
38  mutable std::atomic<DeserializeType> fDeserializeTypeCache{ DeserializeType::kInvalid }; ///<! Cache of the type of deserialization.
39  mutable std::atomic<EDataType> fDataTypeCache{EDataType::kOther_t}; ///<! Cache of the EDataType of deserialization.
40 
41 private:
42  virtual Int_t GetOffsetHeaderSize() const {return 1;}
43 
44 public:
45  TLeafElement();
46  TLeafElement(TBranch *parent, const char *name, Int_t id, Int_t type);
47  virtual ~TLeafElement();
48 
50  virtual Int_t *GenerateOffsetArrayBase(Int_t /*base*/, Int_t /*events*/) { return nullptr; }
51  virtual DeserializeType GetDeserializeType() const;
52 
53  virtual TString GetFullName() const;
54  virtual Int_t GetLen() const {return ((TBranchElement*)fBranch)->GetNdata()*fLen;}
55  TMethodCall *GetMethodCall(const char *name);
56  virtual Int_t GetMaximum() const {return ((TBranchElement*)fBranch)->GetMaximum();}
57  virtual Int_t GetNdata() const {return ((TBranchElement*)fBranch)->GetNdata()*fLen;}
58  virtual const char *GetTypeName() const {return ((TBranchElement*)fBranch)->GetTypeName();}
59 
60  virtual Double_t GetValue(Int_t i=0) const { return ((TBranchElement*)fBranch)->GetValue(i, fLen, kFALSE);}
61  virtual Long64_t GetValueLong64(Int_t i = 0) const { return ((TBranchElement*)fBranch)->GetTypedValue<Long64_t>(i, fLen, kFALSE); }
62  virtual LongDouble_t GetValueLongDouble(Int_t i = 0) const { return ((TBranchElement*)fBranch)->GetTypedValue<LongDouble_t>(i, fLen, kFALSE); }
63  template<typename T> T GetTypedValueSubArray(Int_t i=0, Int_t j=0) const {return ((TBranchElement*)fBranch)->GetTypedValue<T>(i, j, kTRUE);}
64 
65  virtual bool ReadBasketFast(TBuffer&, Long64_t);
67 
68  virtual void *GetValuePointer() const { return ((TBranchElement*)fBranch)->GetValuePointer(); }
69  virtual Bool_t IncludeRange(TLeaf *);
70  virtual Bool_t IsOnTerminalBranch() const;
71  virtual void PrintValue(Int_t i=0) const {((TBranchElement*)fBranch)->PrintValue(i);}
72  virtual void SetLeafCount(TLeaf *leaf) {fLeafCount = leaf;}
73 
74  ClassDef(TLeafElement,1); //A TLeaf for a general object derived from TObject.
75 };
76 
77 #endif
TLeafElement::GetValue
virtual Double_t GetValue(Int_t i=0) const
Definition: TLeafElement.h:60
TLeafElement::fDeserializeTypeCache
std::atomic< DeserializeType > fDeserializeTypeCache
! Cache of the type of deserialization.
Definition: TLeafElement.h:38
TLeafElement::GetTypedValueSubArray
T GetTypedValueSubArray(Int_t i=0, Int_t j=0) const
Definition: TLeafElement.h:63
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TLeafElement::GetMethodCall
TMethodCall * GetMethodCall(const char *name)
Returns pointer to method corresponding to name name is a string with the general form "method(list o...
Definition: TLeafElement.cxx:155
TBranchElement
Definition: TBranchElement.h:39
TLeafElement::GetValueLong64
virtual Long64_t GetValueLong64(Int_t i=0) const
Definition: TLeafElement.h:61
TLeafElement::GetFullName
virtual TString GetFullName() const
Return the full name (including the parent's branch names) of the leaf.
Definition: TLeafElement.cxx:163
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TLeafElement::TLeafElement
TLeafElement()
Default constructor for LeafObject.
Definition: TLeafElement.cxx:30
TLeafElement::GetTypeName
virtual const char * GetTypeName() const
Definition: TLeafElement.h:58
TLeafElement::GenerateOffsetArrayBase
virtual Int_t * GenerateOffsetArrayBase(Int_t, Int_t)
Definition: TLeafElement.h:50
Int_t
int Int_t
Definition: RtypesCore.h:45
TLeafElement::~TLeafElement
virtual ~TLeafElement()
Default destructor for a LeafObject.
Definition: TLeafElement.cxx:104
TLeafElement::ReadBasketFast
virtual bool ReadBasketFast(TBuffer &, Long64_t)
Deserialize N events from an input buffer.
Definition: TLeafElement.cxx:144
TBuffer
Definition: TBuffer.h:43
TLeafElement
Definition: TLeafElement.h:32
TString
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
bool
TLeafElement::GetNdata
virtual Int_t GetNdata() const
Definition: TLeafElement.h:57
TLeafElement::GetMaximum
virtual Int_t GetMaximum() const
Definition: TLeafElement.h:56
TLeafElement::fAbsAddress
char * fAbsAddress
! Absolute leaf Address
Definition: TLeafElement.h:35
TLeaf::fLenType
Int_t fLenType
Number of bytes for this data type.
Definition: TLeaf.h:73
TBranch
Definition: TBranch.h:89
TLeafElement::fType
Int_t fType
leaf type
Definition: TLeafElement.h:37
TDataType.h
TBranchElement.h
TLeafElement::GetValueLongDouble
virtual LongDouble_t GetValueLongDouble(Int_t i=0) const
Definition: TLeafElement.h:62
TLeaf.h
TLeaf::DeserializeType::kDestructive
@ kDestructive
TLeaf
Definition: TLeaf.h:57
TLeaf::fLen
Int_t fLen
Number of fixed length elements in the leaf's data.
Definition: TLeaf.h:72
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TLeafElement::fID
Int_t fID
element serial number in fInfo
Definition: TLeafElement.h:36
TLeaf::DeserializeType::kInvalid
@ kInvalid
TLeafElement::IsOnTerminalBranch
virtual Bool_t IsOnTerminalBranch() const
Return true if this leaf is does not have any sub-branch/leaf.
Definition: TLeafElement.cxx:185
TLeafElement::CanGenerateOffsetArray
virtual Bool_t CanGenerateOffsetArray()
Definition: TLeafElement.h:49
TLeafElement::PrintValue
virtual void PrintValue(Int_t i=0) const
Definition: TLeafElement.h:71
kOther_t
@ kOther_t
Definition: TDataType.h:38
TLeafElement::GetOffsetHeaderSize
virtual Int_t GetOffsetHeaderSize() const
Definition: TLeafElement.h:42
LongDouble_t
long double LongDouble_t
Definition: RtypesCore.h:61
TLeafElement::SetLeafCount
virtual void SetLeafCount(TLeaf *leaf)
Set the leaf count of this leaf.
Definition: TLeafElement.h:72
Double_t
double Double_t
Definition: RtypesCore.h:59
TLeafElement::IncludeRange
virtual Bool_t IncludeRange(TLeaf *)
Copy/set fMinimum and fMaximum to include/be wide than those of the parameter.
Definition: TLeafElement.cxx:171
TLeafElement::GetValuePointer
virtual void * GetValuePointer() const
Definition: TLeafElement.h:68
TLeafElement::GetDeserializeType
virtual DeserializeType GetDeserializeType() const
Determine if this TLeafElement supports bulk IO.
Definition: TLeafElement.cxx:111
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TLeafElement::fDataTypeCache
std::atomic< EDataType > fDataTypeCache
! Cache of the EDataType of deserialization.
Definition: TLeafElement.h:39
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:52
TLeaf::fLeafCount
TLeaf * fLeafCount
Pointer to Leaf count if variable length (we do not own the counter)
Definition: TLeaf.h:77
TLeafElement::GetLen
virtual Int_t GetLen() const
Return the number of effective elements of this leaf, for the current entry.
Definition: TLeafElement.h:54
TMethodCall
Definition: TMethodCall.h:37
type
int type
Definition: TGX11.cxx:121
TLeaf::DeserializeType
DeserializeType
Definition: TLeaf.h:99
TLeaf::fBranch
TBranch * fBranch
! Pointer to supporting branch (we do not own the branch)
Definition: TLeaf.h:78
TLeafElement::ReadBasketSerialized
virtual bool ReadBasketSerialized(TBuffer &, Long64_t)
Definition: TLeafElement.h:66
int