library: libTree #include "TBasket.h"

# TBasket

class description - source file - inheritance tree (.pdf)

## class TBasket : public TKey

| Inheritance Chart:
`TObject`
| <- | `TNamed`
| <- | `TKey`
| <- | `TBasket` |

        public:

                          TBasket()
                          TBasket(const char* name, const char* title, TBranch* branch)
                          TBasket(const TBasket&)
                  virtual ~TBasket()
             virtual void AdjustSize(Int_t newsize)
           static TClass* Class()
             virtual void DeleteEntryOffset()
            virtual Int_t DropBuffers()
                 TBranch* GetBranch() const
                    Int_t GetBufferSize() const
                   Int_t* GetDisplacement() const
                   Int_t* GetEntryOffset() const
                    Int_t GetEntryPointer(Int_t Entry)
                    Int_t GetLast() const
                    Int_t GetNevBuf() const
                    Int_t GetNevBufSize() const
          virtual TClass* IsA() const
             virtual void MoveEntries(Int_t dentries)
                 TBasket& operator=(const TBasket&)
             virtual void PrepareBasket(Long64_t)
                    Int_t ReadBasketBuffers(Long64_t pos, Int_t len, TFile* file)
                    Int_t ReadBasketBytes(Long64_t pos, TFile* file)
                     void SetBranch(TBranch* branch)
                     void SetNevBufSize(Int_t n)
             virtual void SetReadMode()
             virtual void SetWriteMode()
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                     void Update(Int_t newlast)
             virtual void Update(Int_t newlast, Int_t skipped)
            virtual Int_t WriteBuffer()

### Data Members

        protected:

             Int_t fBufferSize    fBuffer length in bytes
             Int_t fNevBufSize    Length in Int_t of fEntryOffset OR fixed length of each entry if fEntryOffset is null!
             Int_t fNevBuf        Number of entries in basket
             Int_t fLast          Pointer to last used byte in basket
            Bool_t fHeaderOnly    True when only the basket header must be read/written
            Int_t* fDisplacement  ![fNevBuf] Displacement of entries in fBuffer(TKey)
            Int_t* fEntryOffset   [fNevBuf] Offset of entries in fBuffer(TKey)
          TBranch* fBranch        Pointer to the basket support branch

## Class Description

      Manages buffers for branches of a Tree.
      See picture in TTree.

TBasket()

                   Default contructor

TBasket(const char *name, const char *title, TBranch *branch)

                Basket normal constructor

~TBasket()

              Basket destructor

void AdjustSize(Int_t newsize)

          Increase the size of the current fBuffer up to newsize

void DeleteEntryOffset()

      delete fEntryOffset array

Int_t DropBuffers()

          Drop buffers of this basket if it is not the current basket

Int_t GetEntryPointer(Int_t entry)

    *-*-*-*-*-*-*Get pointer to buffer for internal entry*-*-*-*-*-*
    *-*          ========================================

void MoveEntries(Int_t dentries)

     remove the first dentries of this basket, moving entries at dentries
     to the start of the buffer

Int_t ReadBasketBuffers(Long64_t pos, Int_t len, TFile *file)

    *-*-*-*-*-*-*-*-*Read basket buffers in memory and cleanup*-*-*-*-*-*-*
    *-*              =========================================

           Read a basket buffer. Check if buffers of previous ReadBasket
           should not be dropped. Remember, we keep buffers
           in memory up to fMaxVirtualSize.

Int_t ReadBasketBytes(Long64_t pos, TFile *file)

    *-*-*-*-*-*-*-*-*Read basket buffers in memory and cleanup*-*-*-*-*-*-*
    *-*              =========================================

           Read first bytes of a logical record starting at position pos
           return record length (first 4 bytes of record)

void SetReadMode()

     Set read mode of basket.

void SetWriteMode()

     Set write mode of basket.

void Streamer(TBuffer &b)

    *-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*              =========================================

void Update(Int_t offset, Int_t skipped)

        Update basket header and EntryOffset table

Int_t WriteBuffer()

     Write buffer of this basket on the current file

     The function returns the number of bytes committed to the memory.
     If a write error occurs, the number of bytes returned is -1.
     If no data are written, the number of bytes returned is 0.

### Inline Functions

               TBranch* GetBranch() const
                  Int_t GetBufferSize() const
                 Int_t* GetDisplacement() const
                 Int_t* GetEntryOffset() const
                  Int_t GetNevBuf() const
                  Int_t GetNevBufSize() const
                  Int_t GetLast() const
                   void PrepareBasket(Long64_t)
                   void SetBranch(TBranch* branch)
                   void SetNevBufSize(Int_t n)
                   void Update(Int_t newlast, Int_t skipped)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void StreamerNVirtual(TBuffer& b)
                TBasket TBasket(const TBasket&)
               TBasket& operator=(const TBasket&)

Author: Rene Brun 19/01/96
Last update: root/tree:$Name: $:$Id: TBasket.cxx,v 1.33 2005/05/19 11:54:55 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *