Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:12

0001 // @(#)root/tree:$Id$
0002 // Author: Rene Brun   14/01/2001
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TLeafElement
0013 #define ROOT_TLeafElement
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TLeafElement                                                          //
0019 //                                                                      //
0020 // A TLeaf for a general object derived from TObject.                   //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include <atomic>
0025 
0026 #include "TDataType.h"
0027 #include "TLeaf.h"
0028 #include "TBranchElement.h"
0029 
0030 class TMethodCall;
0031 
0032 class TLeafElement : public TLeaf {
0033 
0034 protected:
0035    char               *fAbsAddress;   ///<! Absolute leaf Address
0036    Int_t               fID;           ///<  element serial number in fInfo
0037    Int_t               fType;         ///<  leaf type
0038    mutable std::atomic<DeserializeType> fDeserializeTypeCache{ DeserializeType::kInvalid }; ///<! Cache of the type of deserialization.
0039    mutable std::atomic<EDataType> fDataTypeCache{EDataType::kOther_t}; ///<! Cache of the EDataType of deserialization.
0040 
0041 private:
0042    Int_t            GetOffsetHeaderSize() const override {return 1;}
0043 
0044 public:
0045    TLeafElement();
0046    TLeafElement(TBranch *parent, const char *name, Int_t id, Int_t type);
0047    ~TLeafElement() override;
0048 
0049    bool             CanGenerateOffsetArray() override { return fLeafCount && fLenType; }
0050    virtual Int_t   *GenerateOffsetArrayBase(Int_t /*base*/, Int_t /*events*/) { return nullptr; }
0051    DeserializeType  GetDeserializeType() const override;
0052 
0053    Int_t            GetID() const { return fID; }
0054    TString          GetFullName() const override;
0055    Int_t            GetLen() const override { return ((TBranchElement*)fBranch)->GetNdata()*fLen; }
0056    TMethodCall     *GetMethodCall(const char *name);
0057    Int_t            GetMaximum() const override { return ((TBranchElement*)fBranch)->GetMaximum(); }
0058    Int_t            GetNdata() const override { return ((TBranchElement*)fBranch)->GetNdata()*fLen; }
0059    const char      *GetTypeName() const override { return ((TBranchElement*)fBranch)->GetTypeName(); }
0060 
0061    Double_t         GetValue(Int_t i=0) const override { return ((TBranchElement*)fBranch)->GetValue(i, fLen, false);}
0062    Long64_t         GetValueLong64(Int_t i = 0) const override { return ((TBranchElement*)fBranch)->GetTypedValue<Long64_t>(i, fLen, false); }
0063    LongDouble_t     GetValueLongDouble(Int_t i = 0) const override { return ((TBranchElement*)fBranch)->GetTypedValue<LongDouble_t>(i, fLen, false); }
0064    template<typename T> T GetTypedValueSubArray(Int_t i=0, Int_t j=0) const {return ((TBranchElement*)fBranch)->GetTypedValue<T>(i, j, true);}
0065 
0066    bool             ReadBasketFast(TBuffer&, Long64_t) override;
0067 
0068    void            *GetValuePointer() const override { return ((TBranchElement*)fBranch)->GetValuePointer(); }
0069    bool             IncludeRange(TLeaf *) override;
0070    bool             IsOnTerminalBranch() const override;
0071    void             PrintValue(Int_t i=0) const override {((TBranchElement*)fBranch)->PrintValue(i);}
0072    void             SetLeafCount(TLeaf *leaf) override { fLeafCount = leaf; }
0073 
0074    ClassDefOverride(TLeafElement,1);  //A TLeaf for a general object derived from TObject.
0075 };
0076 
0077 #endif