TBasket.h

Go to the documentation of this file.
00001 // @(#)root/tree:$Id: TBasket.h 35231 2010-09-10 17:59:10Z pcanal $
00002 // Author: Rene Brun   19/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_TBasket
00013 #define ROOT_TBasket
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TBasket                                                              //
00019 //                                                                      //
00020 // The TBasket objects are created at run time to collect TTree entries //
00021 // in buffers. When a Basket is full, it is written to the file.        //
00022 // The Basket is kept in memory if there is enough space.               //
00023 //  (see the fMaxVirtualsize of TTree).                                 //
00024 //                                                                      //
00025 // The Basket class derives from TKey.                                  //
00026 //////////////////////////////////////////////////////////////////////////
00027 
00028 
00029 #ifndef ROOT_TKey
00030 #include "TKey.h"
00031 #endif
00032 
00033 
00034 class TFile;
00035 class TTree;
00036 class TBranch;
00037 
00038 class TBasket : public TKey {
00039 
00040 private:
00041    TBasket(const TBasket&);            // TBasket objects are not copiable.
00042    TBasket& operator=(const TBasket&); // TBasket objects are not copiable.
00043       
00044 protected:
00045    Int_t       fBufferSize;      //fBuffer length in bytes
00046    Int_t       fNevBufSize;      //Length in Int_t of fEntryOffset OR fixed length of each entry if fEntryOffset is null!
00047    Int_t       fNevBuf;          //Number of entries in basket
00048    Int_t       fLast;            //Pointer to last used byte in basket
00049    Bool_t      fHeaderOnly;      //True when only the basket header must be read/written
00050    Int_t      *fDisplacement;    //![fNevBuf] Displacement of entries in fBuffer(TKey)
00051    Int_t      *fEntryOffset;     //[fNevBuf] Offset of entries in fBuffer(TKey)
00052    TBranch    *fBranch;          //Pointer to the basket support branch
00053    Int_t       fCompressedSize;  //!Size of the allocated memroy in fCompressedBuffer
00054    char       *fCompressedBuffer;//!Temporary place holder for the compressed buffer if needed.
00055    
00056 public:
00057    
00058    TBasket();
00059    TBasket(TDirectory *motherDir);
00060    TBasket(const char *name, const char *title, TBranch *branch);
00061    virtual ~TBasket();
00062    
00063    virtual void    AdjustSize(Int_t newsize);
00064    virtual void    DeleteEntryOffset();
00065    virtual Int_t   DropBuffers();
00066    TBranch        *GetBranch() const {return fBranch;}
00067            Int_t   GetBufferSize() const {return fBufferSize;}
00068            Int_t  *GetDisplacement() const {return fDisplacement;}
00069            Int_t  *GetEntryOffset() const {return fEntryOffset;}
00070            Int_t   GetEntryPointer(Int_t Entry);
00071            Int_t   GetNevBuf() const {return fNevBuf;}
00072            Int_t   GetNevBufSize() const {return fNevBufSize;}
00073            Int_t   GetLast() const {return fLast;}
00074    virtual void    MoveEntries(Int_t dentries);
00075    virtual void    PrepareBasket(Long64_t /* entry */) {};
00076            Int_t   ReadBasketBuffers(Long64_t pos, Int_t len, TFile *file);
00077            Int_t   ReadBasketBytes(Long64_t pos, TFile *file);
00078    virtual void    Reset();
00079 
00080            Int_t   LoadBasketBuffers(Long64_t pos, Int_t len, TFile *file);
00081    Long64_t        CopyTo(TFile *to);
00082 
00083            void    SetBranch(TBranch *branch) { fBranch = branch; }
00084            void    SetNevBufSize(Int_t n) { fNevBufSize=n; }
00085    virtual void    SetReadMode();
00086    virtual void    SetWriteMode();
00087    inline  void    Update(Int_t newlast) { Update(newlast,newlast); }; 
00088    virtual void    Update(Int_t newlast, Int_t skipped);
00089    virtual Int_t   WriteBuffer();
00090 
00091    ClassDef(TBasket,2);  //the TBranch buffers
00092 };
00093 
00094 #endif

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