Warning, file /include/root/TLeaf.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TLeaf
0013 #define ROOT_TLeaf
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #include "TNamed.h"
0045
0046 #include <vector>
0047
0048 #ifdef R__LESS_INCLUDES
0049 class TBranch;
0050 #else
0051 #include "TBranch.h"
0052 #endif
0053
0054 class TClonesArray;
0055 class TBrowser;
0056
0057 class TLeaf : public TNamed {
0058
0059 private:
0060
0061 virtual Int_t GetOffsetHeaderSize() const {return 0;}
0062
0063 protected:
0064
0065 using Counts_t = std::vector<Int_t>;
0066 struct LeafCountValues {
0067 Counts_t fValues;
0068 Long64_t fStartEntry{-1};
0069 };
0070
0071 Int_t fNdata;
0072 Int_t fLen;
0073 Int_t fLenType;
0074 Int_t fOffset;
0075 bool fIsRange;
0076 bool fIsUnsigned;
0077 TLeaf *fLeafCount;
0078 TBranch *fBranch;
0079 LeafCountValues *fLeafCountValues;
0080
0081 TLeaf(const TLeaf&);
0082 TLeaf& operator=(const TLeaf&);
0083
0084 template <typename T> struct GetValueHelper {
0085 static T Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValue(i); }
0086 };
0087
0088 Int_t *GenerateOffsetArrayBase(Int_t base, Int_t events) const;
0089
0090
0091
0092
0093 public:
0094 enum EStatusBits {
0095 kIndirectAddress = BIT(11),
0096 kNewValue = BIT(12)
0097 };
0098
0099 enum class DeserializeType {
0100 kInvalid = 0,
0101 kExternal,
0102 kDestructive = kExternal,
0103 kInPlace,
0104 kZeroCopy,
0105 };
0106
0107 TLeaf();
0108 TLeaf(TBranch *parent, const char *name, const char *type);
0109 ~TLeaf() override;
0110
0111 void Browse(TBrowser *b) override;
0112 virtual bool CanGenerateOffsetArray() {return fLeafCount;}
0113 virtual void Export(TClonesArray *, Int_t) {}
0114 virtual void FillBasket(TBuffer &b);
0115 virtual Int_t *GenerateOffsetArray(Int_t base, Int_t events) { return GenerateOffsetArrayBase(base, events); }
0116 TBranch *GetBranch() const { return fBranch; }
0117 virtual DeserializeType GetDeserializeType() const { return DeserializeType::kExternal; }
0118 virtual TString GetFullName() const;
0119
0120
0121 virtual TLeaf *GetLeafCount() const { return fLeafCount; }
0122 virtual TLeaf *GetLeafCounter(Int_t &countval) const;
0123
0124 virtual const Counts_t *GetLeafCountValues(Long64_t start, Long64_t len);
0125
0126 virtual Int_t GetLen() const;
0127
0128
0129
0130
0131
0132 virtual Int_t GetLenStatic() const { return fLen; }
0133 virtual Int_t GetLenType() const { return fLenType; }
0134 virtual Int_t GetMaximum() const { return 0; }
0135 virtual Int_t GetMinimum() const { return 0; }
0136 virtual Int_t GetNdata() const { return fNdata; }
0137 virtual Int_t GetOffset() const { return fOffset; }
0138 virtual void *GetValuePointer() const { return nullptr; }
0139 virtual const char *GetTypeName() const { return ""; }
0140
0141 virtual Double_t GetValue(Int_t i = 0) const;
0142 virtual Long64_t GetValueLong64(Int_t i = 0) const { return GetValue(i); }
0143 virtual LongDouble_t GetValueLongDouble(Int_t i = 0) const { return GetValue(i); }
0144 template <typename T> T GetTypedValue(Int_t i = 0) const { return GetValueHelper<T>::Exec(this, i); }
0145
0146 virtual bool IncludeRange(TLeaf *) { return false; }
0147 virtual void Import(TClonesArray *, Int_t) {}
0148 virtual bool IsOnTerminalBranch() const { return true; }
0149 virtual bool IsRange() const { return fIsRange; }
0150 virtual bool IsUnsigned() const { return fIsUnsigned; }
0151 virtual void PrintValue(Int_t i = 0) const;
0152 virtual void ReadBasket(TBuffer &) {}
0153 virtual void ReadBasketExport(TBuffer &, TClonesArray *, Int_t) {}
0154 virtual bool ReadBasketFast(TBuffer&, Long64_t) { return false; }
0155 virtual bool ReadBasketSerialized(TBuffer&, Long64_t) { return true; }
0156 virtual void ReadValue(std::istream & , Char_t = ' ') {
0157 Error("ReadValue", "Not implemented!");
0158 }
0159 Int_t ResetAddress(void *add, bool calledFromDestructor = false);
0160 virtual void SetAddress(void *add = nullptr);
0161 virtual void SetBranch(TBranch *branch) { fBranch = branch; }
0162 virtual void SetLeafCount(TLeaf *leaf);
0163 virtual void SetLen(Int_t len = 1) { fLen = len; }
0164 virtual void SetOffset(Int_t offset = 0) { fOffset = offset; }
0165 virtual void SetRange(bool range = true) { fIsRange = range; }
0166 virtual void SetUnsigned() { fIsUnsigned = true; }
0167
0168 ClassDefOverride(TLeaf, 2);
0169 };
0170
0171
0172 template <> struct TLeaf::GetValueHelper<Long64_t> {
0173 static Long64_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLong64(i); }
0174 };
0175 template <> struct TLeaf::GetValueHelper<ULong64_t> {
0176 static ULong64_t Exec(const TLeaf *leaf, Int_t i = 0) { return (ULong64_t)leaf->GetValueLong64(i); }
0177 };
0178 template <> struct TLeaf::GetValueHelper<LongDouble_t> {
0179 static LongDouble_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLongDouble(i); }
0180 };
0181
0182
0183 inline Double_t TLeaf::GetValue(Int_t ) const { return 0.0; }
0184 inline void TLeaf::PrintValue(Int_t ) const {}
0185 inline void TLeaf::SetAddress(void* ) {}
0186
0187 #endif