#ifndef ROOT_TFileCacheRead
#define ROOT_TFileCacheRead
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TFile
#include "TFile.h"
#endif
class TBranch;
class TFilePrefetch;
class TFileCacheRead : public TObject {
protected:
TFilePrefetch* fPrefetch;
Int_t fBufferSizeMin;
Int_t fBufferSize;
Int_t fBufferLen;
Long64_t fBytesRead;
Long64_t fBytesReadExtra;
Int_t fReadCalls;
Long64_t fNoCacheBytesRead;
Int_t fNoCacheReadCalls;
Bool_t fAsyncReading;
Bool_t fEnablePrefetching;
Int_t fNseek;
Int_t fNtot;
Int_t fNb;
Int_t fSeekSize;
Long64_t *fSeek;
Long64_t *fSeekSort;
Int_t *fSeekIndex;
Long64_t *fPos;
Int_t *fSeekLen;
Int_t *fSeekSortLen;
Int_t *fSeekPos;
Int_t *fLen;
TFile *fFile;
char *fBuffer;
Bool_t fIsSorted;
Bool_t fIsTransferred;
Long64_t fPrefetchedBlocks;
Int_t fBNseek;
Int_t fBNtot;
Int_t fBNb;
Int_t fBSeekSize;
Long64_t *fBSeek;
Long64_t *fBSeekSort;
Int_t *fBSeekIndex;
Long64_t *fBPos;
Int_t *fBSeekLen;
Int_t *fBSeekSortLen;
Int_t *fBSeekPos;
Int_t *fBLen;
Bool_t fBIsSorted;
Bool_t fBIsTransferred;
void SetEnablePrefetchingImpl(Bool_t setPrefetching = kFALSE);
private:
TFileCacheRead(const TFileCacheRead &);
TFileCacheRead& operator=(const TFileCacheRead &);
public:
TFileCacheRead();
TFileCacheRead(TFile *file, Int_t buffersize, TObject *tree = 0);
virtual ~TFileCacheRead();
virtual void AddBranch(TBranch * , Bool_t = kFALSE) {}
virtual void AddBranch(const char * , Bool_t = kFALSE) {}
virtual void AddNoCacheBytesRead(Long64_t len) { fNoCacheBytesRead += len; }
virtual void AddNoCacheReadCalls(Int_t reads) { fNoCacheReadCalls += reads; }
virtual void Close(Option_t *option="");
virtual Int_t GetBufferSize() const { return fBufferSize; };
virtual Long64_t GetBytesRead() const { return fBytesRead; }
virtual Long64_t GetNoCacheBytesRead() const { return fNoCacheBytesRead; }
virtual Long64_t GetBytesReadExtra() const { return fBytesReadExtra; }
TFile *GetFile() const { return fFile; }
Int_t GetNseek() const { return fNseek; }
Int_t GetNtot() const { return fNtot; }
virtual Int_t GetReadCalls() const { return fReadCalls; }
virtual Int_t GetNoCacheReadCalls() const { return fNoCacheReadCalls; }
virtual Int_t GetUnzipBuffer(char ** , Long64_t , Int_t , Bool_t * ) { return -1; }
Long64_t GetPrefetchedBlocks() const { return fPrefetchedBlocks; }
virtual Bool_t IsAsyncReading() const { return fAsyncReading; };
virtual void SetEnablePrefetching(Bool_t setPrefetching = kFALSE);
virtual Bool_t IsEnablePrefetching() const { return fEnablePrefetching; };
virtual Bool_t IsLearning() const {return kFALSE;}
virtual void Prefetch(Long64_t pos, Int_t len);
virtual void Print(Option_t *option="") const;
virtual Int_t ReadBufferExt(char *buf, Long64_t pos, Int_t len, Int_t &loc);
virtual Int_t ReadBufferExtNormal(char *buf, Long64_t pos, Int_t len, Int_t &loc);
virtual Int_t ReadBufferExtPrefetch(char *buf, Long64_t pos, Int_t len, Int_t &loc);
virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
virtual void SetFile(TFile *file, TFile::ECacheAction action = TFile::kDisconnect);
virtual void SetSkipZip(Bool_t = kTRUE) {}
virtual void Sort();
virtual void SecondSort();
virtual void SecondPrefetch(Long64_t, Int_t);
virtual TFilePrefetch* GetPrefetchObj();
virtual void WaitFinishPrefetch();
ClassDef(TFileCacheRead,2)
};
#endif