#ifndef ROOT_TLeaf
#define ROOT_TLeaf
#ifndef ROOT_TBranch
#include "TBranch.h"
#endif
#ifndef ROOT_Riosfwd
#include "Riosfwd.h"
#endif
class TClonesArray;
class TBrowser;
class TLeaf : public TNamed {
protected:
Int_t fNdata;
Int_t fLen;
Int_t fLenType;
Int_t fOffset;
Bool_t fIsRange;
Bool_t fIsUnsigned;
TLeaf *fLeafCount;
TBranch *fBranch;
TLeaf(const TLeaf&);
TLeaf& operator=(const TLeaf&);
template <typename T> struct GetValueHelper {
static T Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValue(i); }
};
public:
enum {
kIndirectAddress = BIT(11),
kNewValue = BIT(12)
};
TLeaf();
TLeaf(TBranch *parent, const char* name, const char* type);
virtual ~TLeaf();
virtual void Browse(TBrowser* b);
virtual void Export(TClonesArray*, Int_t) {}
virtual void FillBasket(TBuffer& b);
TBranch *GetBranch() const { return fBranch; }
virtual TLeaf *GetLeafCount() const { return fLeafCount; }
virtual TLeaf *GetLeafCounter(Int_t& countval) const;
virtual Int_t GetLen() const;
virtual Int_t GetLenStatic() const { return fLen; }
virtual Int_t GetLenType() const { return fLenType; }
virtual Int_t GetMaximum() const { return 0; }
virtual Int_t GetMinimum() const { return 0; }
virtual Int_t GetNdata() const { return fNdata; }
virtual Int_t GetOffset() const { return fOffset; }
virtual void *GetValuePointer() const { return 0; }
virtual const char *GetTypeName() const { return ""; }
virtual Double_t GetValue(Int_t i = 0) const;
virtual Long64_t GetValueLong64(Int_t i = 0) const { return GetValue(i); }
virtual LongDouble_t GetValueLongDouble(Int_t i = 0) const { return GetValue(i); }
template <typename T > T GetTypedValue(Int_t i = 0) const { return GetValueHelper<T>::Exec(this, i); }
virtual void Import(TClonesArray*, Int_t) {}
virtual Bool_t IsOnTerminalBranch() const { return kTRUE; }
virtual Bool_t IsRange() const { return fIsRange; }
virtual Bool_t IsUnsigned() const { return fIsUnsigned; }
virtual void PrintValue(Int_t i = 0) const;
virtual void ReadBasket(TBuffer&) {}
virtual void ReadBasketExport(TBuffer&, TClonesArray*, Int_t) {}
virtual void ReadValue(std::istream& , Char_t = ' ') {
Error("ReadValue", "Not implemented!");
}
Int_t ResetAddress(void* add, Bool_t destructor = kFALSE);
virtual void SetAddress(void* add = 0);
virtual void SetBranch(TBranch* branch) { fBranch = branch; }
virtual void SetLeafCount(TLeaf* leaf);
virtual void SetLen(Int_t len = 1) { fLen = len; }
virtual void SetOffset(Int_t offset = 0) { fOffset = offset; }
virtual void SetRange(Bool_t range = kTRUE) { fIsRange = range; }
virtual void SetUnsigned() { fIsUnsigned = kTRUE; }
ClassDef(TLeaf,2);
};
template <> struct TLeaf::GetValueHelper<Long64_t> {
static Long64_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLong64(i); }
};
template <> struct TLeaf::GetValueHelper<ULong64_t> {
static ULong64_t Exec(const TLeaf *leaf, Int_t i = 0) { return (ULong64_t)leaf->GetValueLong64(i); }
};
template <> struct TLeaf::GetValueHelper<LongDouble_t> {
static LongDouble_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLongDouble(i); }
};
inline Double_t TLeaf::GetValue(Int_t ) const { return 0.0; }
inline void TLeaf::PrintValue(Int_t ) const {}
inline void TLeaf::SetAddress(void* ) {}
#endif