Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TBasket.h

Go to the documentation of this file.
00001 // @(#)root/tree:$Name:  $:$Id: TBasket.h,v 1.8 2003/04/30 16:29:31 brun Exp $
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 
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.                                  //
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 protected:
00041     Int_t       fBufferSize;      //fBuffer length in bytes
00042     Int_t       fNevBufSize;      //Length in Int_t of fEntryOffset
00043     Int_t       fNevBuf;          //Number of entries in basket
00044     Int_t       fLast;            //Pointer to last used byte in basket
00045     Bool_t      fHeaderOnly;      //True when only the basket header must be read/written
00046     Int_t      *fDisplacement;    
00047     Int_t      *fEntryOffset;     //[fNevBuf] Offset of entries in fBuffer(TKey)
00048     TBranch    *fBranch;          //Pointer to the basket support branch
00049 
00050 public:
00051     enum { kNotDecompressed = BIT(15) };
00052 
00053     TBasket();
00054     TBasket(const char *name, const char *title, TBranch *branch);
00055     virtual ~TBasket();
00056 
00057     virtual void    AdjustSize(Int_t newsize);
00058     virtual void    DeleteEntryOffset();
00059     virtual Int_t   DropBuffers();
00060     TBranch        *GetBranch() const {return fBranch;}
00061             Int_t   GetBufferSize() const {return fBufferSize;}
00062             Int_t  *GetDisplacement() const {return fDisplacement;}
00063             Int_t  *GetEntryOffset() const {return fEntryOffset;}
00064             Int_t   GetEntryPointer(Int_t Entry);
00065             Int_t   GetNevBuf() const {return fNevBuf;}
00066             Int_t   GetNevBufSize() const {return fNevBufSize;}
00067             Int_t   GetLast() const {return fLast;}
00068             Int_t   ReadBasketBuffers(Seek_t pos, Int_t len, TFile *file);
00069             Int_t   ReadBasketBytes(Seek_t pos, TFile *file);
00070 
00071             void    SetBranch(TBranch *branch) {fBranch = branch;}
00072             void    SetNevBufSize(Int_t n) {fNevBufSize=n;}
00073     virtual void    SetReadMode();
00074     virtual void    SetWriteMode();
00075     inline  void    Update(Int_t newlast) { Update(newlast,newlast); }; 
00076     virtual void    Update(Int_t newlast, Int_t skipped);
00077     virtual Int_t   WriteBuffer();
00078 
00079     ClassDef(TBasket,2)  //the TBranch buffers
00080 };
00081 
00082 #endif

Generated on Thu Dec 18 14:52:16 2003 for ROOT by doxygen1.2.16