TLeaf.h

Go to the documentation of this file.
00001 // @(#)root/tree:$Id: TLeaf.h 36407 2010-10-22 02:04:08Z pcanal $
00002 // Author: Rene Brun   12/01/96
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TLeaf
00013 #define ROOT_TLeaf
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TLeaf                                                                //
00019 //                                                                      //
00020 // A TTree object is a list of TBranch.                                 //
00021 // A TBranch object is a list of TLeaf.                                 //
00022 // A TLeaf describes the branch data types.                             //
00023 //                                                                      //
00024 //////////////////////////////////////////////////////////////////////////
00025 
00026 
00027 #ifndef ROOT_TBranch
00028 #include "TBranch.h"
00029 #endif
00030 #ifndef ROOT_Riosfwd
00031 #include "Riosfwd.h"
00032 #endif
00033 
00034 class TClonesArray;
00035 class TBrowser;
00036 
00037 class TLeaf : public TNamed {
00038 
00039 protected:
00040 
00041    Int_t       fNdata;           //! Number of elements in fAddress data buffer
00042    Int_t       fLen;             //  Number of fixed length elements
00043    Int_t       fLenType;         //  Number of bytes for this data type
00044    Int_t       fOffset;          //  Offset in ClonesArray object (if one)
00045    Bool_t      fIsRange;         //  (=kTRUE if leaf has a range, kFALSE otherwise)
00046    Bool_t      fIsUnsigned;      //  (=kTRUE if unsigned, kFALSE otherwise)
00047    TLeaf      *fLeafCount;       //  Pointer to Leaf count if variable length (we do not own the counter)
00048    TBranch    *fBranch;          //! Pointer to supporting branch (we do not own the branch)
00049 
00050    TLeaf(const TLeaf&);
00051    TLeaf& operator=(const TLeaf&);
00052 
00053 public:
00054    enum {
00055       kIndirectAddress = BIT(11), // Data member is a pointer to an array of basic types.
00056       kNewValue = BIT(12)         // Set if we own the value buffer and so must delete it ourselves.
00057    };
00058 
00059    TLeaf();
00060    TLeaf(TBranch *parent, const char* name, const char* type);
00061    virtual ~TLeaf();
00062 
00063    virtual void     Browse(TBrowser* b);
00064    virtual void     Export(TClonesArray*, Int_t) {}
00065    virtual void     FillBasket(TBuffer& b);
00066    TBranch         *GetBranch() const { return fBranch; }
00067    virtual TLeaf   *GetLeafCount() const { return fLeafCount; }
00068    virtual TLeaf   *GetLeafCounter(Int_t& countval) const;
00069    virtual Int_t    GetLen() const;
00070    virtual Int_t    GetLenStatic() const { return fLen; }
00071    virtual Int_t    GetLenType() const { return fLenType; }
00072    virtual Int_t    GetMaximum() const { return 0; }
00073    virtual Int_t    GetMinimum() const { return 0; }
00074    virtual Int_t    GetNdata() const { return fNdata; }
00075    virtual Int_t    GetOffset() const { return fOffset; }
00076    virtual void    *GetValuePointer() const { return 0; }
00077    virtual const char *GetTypeName() const { return ""; }
00078    virtual Double_t GetValue(Int_t i = 0) const;
00079    virtual void     Import(TClonesArray*, Int_t) {}
00080    virtual Bool_t   IsOnTerminalBranch() const { return kTRUE; }
00081    virtual Bool_t   IsRange() const { return fIsRange; }
00082    virtual Bool_t   IsUnsigned() const { return fIsUnsigned; }
00083    virtual void     PrintValue(Int_t i = 0) const;
00084    virtual void     ReadBasket(TBuffer&) {}
00085    virtual void     ReadBasketExport(TBuffer&, TClonesArray*, Int_t) {}
00086    virtual void     ReadValue(istream& /*s*/) {}
00087            Int_t    ResetAddress(void* add, Bool_t destructor = kFALSE);
00088    virtual void     SetAddress(void* add = 0);
00089    virtual void     SetBranch(TBranch* branch) { fBranch = branch; }
00090    virtual void     SetLeafCount(TLeaf* leaf);
00091    virtual void     SetLen(Int_t len = 1) { fLen = len; }
00092    virtual void     SetOffset(Int_t offset = 0) { fOffset = offset; }
00093    virtual void     SetRange(Bool_t range = kTRUE) { fIsRange = range; }
00094    virtual void     SetUnsigned() { fIsUnsigned = kTRUE; }
00095 
00096    ClassDef(TLeaf,2);  //Leaf: description of a Branch data type
00097 };
00098 
00099 inline Double_t TLeaf::GetValue(Int_t /*i = 0*/) const { return 0.0; }
00100 inline void     TLeaf::PrintValue(Int_t /* i = 0*/) const {}
00101 inline void     TLeaf::SetAddress(void* /* add = 0 */) {}
00102 
00103 #endif

Generated on Tue Jul 5 14:26:59 2011 for ROOT_528-00b_version by  doxygen 1.5.1