TFileCacheRead.h

Go to the documentation of this file.
00001 // @(#)root/io:$Id: TFileCacheRead.h 31503 2009-12-02 10:36:50Z brun $
00002 // Author: Rene Brun   19/05/2006
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_TFileCacheRead
00013 #define ROOT_TFileCacheRead
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TFileCacheRead                                                       //
00019 //                                                                      //
00020 // TFile cache when reading                                             //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TObject
00025 #include "TObject.h"
00026 #endif
00027 
00028 class TFile;
00029 class TBranch;
00030 
00031 class TFileCacheRead : public TObject {
00032 
00033 protected:
00034    Int_t         fBufferSizeMin;  //Original size of fBuffer
00035    Int_t         fBufferSize;     //Allocated size of fBuffer (at a given time)
00036    Int_t         fBufferLen;      //Current buffer length (<= fBufferSize)
00037 
00038    Bool_t        fAsyncReading;
00039 
00040    Int_t         fNseek;          //Number of blocks to be prefetched
00041    Int_t         fNtot;           //Total size of prefetched blocks
00042    Int_t         fNb;             //Number of long buffers
00043    Int_t         fSeekSize;       //Allocated size of fSeek
00044    Long64_t     *fSeek;           //[fNseek] Position on file of buffers to be prefetched
00045    Long64_t     *fSeekSort;       //[fNseek] Position on file of buffers to be prefetched (sorted)
00046    Int_t        *fSeekIndex;      //[fNseek] sorted index table of fSeek
00047    Long64_t     *fPos;            //[fNb] start of long buffers
00048    Int_t        *fSeekLen;        //[fNseek] Length of buffers to be prefetched
00049    Int_t        *fSeekSortLen;    //[fNseek] Length of buffers to be prefetched (sorted)
00050    Int_t        *fSeekPos;        //[fNseek] Position of sorted blocks in fBuffer
00051    Int_t        *fLen;            //[fNb] Length of long buffers
00052    TFile        *fFile;           //Pointer to file
00053    char         *fBuffer;         //[fBufferSize] buffer of contiguous prefetched blocks
00054    Bool_t        fIsSorted;       //True if fSeek array is sorted
00055    Bool_t        fIsTransferred;   //True when fBuffer contains something valid
00056 
00057 private:
00058    TFileCacheRead(const TFileCacheRead &);            //cannot be copied
00059    TFileCacheRead& operator=(const TFileCacheRead &);
00060 
00061 public:
00062    TFileCacheRead();
00063    TFileCacheRead(TFile *file, Int_t buffersize);
00064    virtual ~TFileCacheRead();
00065    virtual void        AddBranch(TBranch * /*b*/, Bool_t /*subbranches*/ = kFALSE) {}
00066    virtual void        AddBranch(const char * /*branch*/, Bool_t /*subbranches*/ = kFALSE) {}
00067    virtual Int_t       GetBufferSize() const { return fBufferSize; };
00068    virtual Int_t       GetUnzipBuffer(char ** /*buf*/, Long64_t /*pos*/, Int_t /*len*/, Bool_t * /*free*/) { return -1; }
00069    virtual Bool_t      IsAsyncReading() const { return fAsyncReading; };
00070    virtual Bool_t      IsLearning() const {return kFALSE;}
00071    virtual void        Prefetch(Long64_t pos, Int_t len);
00072    virtual void        Print(Option_t *option="") const;
00073    virtual Int_t       ReadBufferExt(char *buf, Long64_t pos, Int_t len, Int_t &loc);
00074    virtual Int_t       ReadBuffer(char *buf, Long64_t pos, Int_t len);
00075    virtual void        SetFile(TFile *file);
00076    virtual void        SetSkipZip(Bool_t /*skip*/ = kTRUE) {} // This function is only used by TTreeCacheUnzip (ignore it)
00077    virtual void        Sort();
00078 
00079    ClassDef(TFileCacheRead,1)  //TFile cache when reading
00080 };
00081 
00082 #endif

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