Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
30class TMethodCall;
31
32class TLeafElement : public TLeaf {
33
34protected:
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
41private:
42 Int_t GetOffsetHeaderSize() const override {return 1;}
43
44public:
46 TLeafElement(TBranch *parent, const char *name, Int_t id, Int_t type);
47 ~TLeafElement() override;
48
49 bool CanGenerateOffsetArray() override { return fLeafCount && fLenType; }
50 virtual Int_t *GenerateOffsetArrayBase(Int_t /*base*/, Int_t /*events*/) { return nullptr; }
51 DeserializeType GetDeserializeType() const override;
52
53 Int_t GetID() const { return fID; }
54 TString GetFullName() const override;
55 Int_t GetLen() const override { return ((TBranchElement*)fBranch)->GetNdata()*fLen; }
56 TMethodCall *GetMethodCall(const char *name);
57 Int_t GetMaximum() const override { return ((TBranchElement*)fBranch)->GetMaximum(); }
58 Int_t GetNdata() const override { return ((TBranchElement*)fBranch)->GetNdata()*fLen; }
59 const char *GetTypeName() const override { return ((TBranchElement*)fBranch)->GetTypeName(); }
60
61 Double_t GetValue(Int_t i=0) const override { return ((TBranchElement*)fBranch)->GetValue(i, fLen, false);}
62 Long64_t GetValueLong64(Int_t i = 0) const override { return ((TBranchElement*)fBranch)->GetTypedValue<Long64_t>(i, fLen, false); }
63 LongDouble_t GetValueLongDouble(Int_t i = 0) const override { return ((TBranchElement*)fBranch)->GetTypedValue<LongDouble_t>(i, fLen, false); }
64 template<typename T> T GetTypedValueSubArray(Int_t i=0, Int_t j=0) const {return ((TBranchElement*)fBranch)->GetTypedValue<T>(i, j, true);}
65
66 bool ReadBasketFast(TBuffer&, Long64_t) override;
67
68 void *GetValuePointer() const override { return ((TBranchElement*)fBranch)->GetValuePointer(); }
69 bool IncludeRange(TLeaf *) override;
70 bool IsOnTerminalBranch() const override;
71 void PrintValue(Int_t i=0) const override {((TBranchElement*)fBranch)->PrintValue(i);}
72 void SetLeafCount(TLeaf *leaf) override { fLeafCount = leaf; }
73
74 ClassDefOverride(TLeafElement,1); //A TLeaf for a general object derived from TObject.
75};
76
77#endif
int Int_t
Definition RtypesCore.h:45
long double LongDouble_t
Definition RtypesCore.h:61
long long Long64_t
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
@ kOther_t
Definition TDataType.h:32
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 Branch for the case of an object.
A TTree is a list of TBranches.
Definition TBranch.h:93
Buffer base class used for serializing objects.
Definition TBuffer.h:43
A TLeaf for the general case when using the branches created via a TStreamerInfo (i....
void PrintValue(Int_t i=0) const override
T GetTypedValueSubArray(Int_t i=0, Int_t j=0) const
Int_t GetID() const
TMethodCall * GetMethodCall(const char *name)
Returns pointer to method corresponding to name name is a string with the general form "method(list o...
char * fAbsAddress
! Absolute leaf Address
bool CanGenerateOffsetArray() override
std::atomic< DeserializeType > fDeserializeTypeCache
! Cache of the type of deserialization.
Int_t GetMaximum() const override
const char * GetTypeName() const override
bool ReadBasketFast(TBuffer &, Long64_t) override
Deserialize N events from an input buffer.
~TLeafElement() override
Default destructor for a LeafObject.
LongDouble_t GetValueLongDouble(Int_t i=0) const override
Int_t fType
leaf type
bool IsOnTerminalBranch() const override
Return true if this leaf is does not have any sub-branch/leaf.
void * GetValuePointer() const override
bool IncludeRange(TLeaf *) override
Copy/set fMinimum and fMaximum to include/be wide than those of the parameter.
Int_t GetLen() const override
Return the number of effective elements of this leaf, for the current entry.
std::atomic< EDataType > fDataTypeCache
! Cache of the EDataType of deserialization.
virtual Int_t * GenerateOffsetArrayBase(Int_t, Int_t)
Double_t GetValue(Int_t i=0) const override
Int_t GetNdata() const override
Int_t fID
element serial number in fInfo
void SetLeafCount(TLeaf *leaf) override
Set the leaf count of this leaf.
Int_t GetOffsetHeaderSize() const override
TString GetFullName() const override
Return the full name (including the parent's branch names) of the leaf.
DeserializeType GetDeserializeType() const override
Determine if this TLeafElement supports bulk IO.
Long64_t GetValueLong64(Int_t i=0) const override
TLeafElement()
Default constructor for LeafObject.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition TLeaf.h:57
Int_t fLenType
Number of bytes for this data type.
Definition TLeaf.h:73
Int_t fLen
Number of fixed length elements in the leaf's data.
Definition TLeaf.h:72
DeserializeType
Definition TLeaf.h:99
TBranch * fBranch
! Pointer to supporting branch (we do not own the branch)
Definition TLeaf.h:78
TLeaf * fLeafCount
Pointer to Leaf count if variable length (we do not own the counter)
Definition TLeaf.h:77
Method or function calling interface.
Definition TMethodCall.h:37
Basic string class.
Definition TString.h:139