00001 // @(#)root/io:$Id: TFileCacheWrite.h 23122 2008-04-10 14:56:30Z rdm $ 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_TFileCacheWrite 00013 #define ROOT_TFileCacheWrite 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TFileCacheWrite // 00019 // // 00020 // TFile cache when writing // 00021 // // 00022 ////////////////////////////////////////////////////////////////////////// 00023 00024 #ifndef ROOT_TObject 00025 #include "TObject.h" 00026 #endif 00027 00028 class TFile; 00029 00030 class TFileCacheWrite : public TObject { 00031 00032 protected: 00033 Long64_t fSeekStart; //Seek value of first block in cache 00034 Int_t fBufferSize; //Allocated size of fBuffer 00035 Int_t fNtot; //Total size of cached blocks 00036 TFile *fFile; //Pointer to file 00037 char *fBuffer; //[fBufferSize] buffer of contiguous prefetched blocks 00038 Bool_t fRecursive; //flag to avoid recursive calls 00039 00040 private: 00041 TFileCacheWrite(const TFileCacheWrite &); //cannot be copied 00042 TFileCacheWrite& operator=(const TFileCacheWrite &); 00043 00044 public: 00045 TFileCacheWrite(); 00046 TFileCacheWrite(TFile *file, Int_t buffersize); 00047 virtual ~TFileCacheWrite(); 00048 virtual Bool_t Flush(); 00049 virtual Int_t GetBytesInCache() const { return fNtot; } 00050 virtual void Print(Option_t *option="") const; 00051 virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len); 00052 virtual Int_t WriteBuffer(const char *buf, Long64_t pos, Int_t len); 00053 virtual void SetFile(TFile *file); 00054 00055 ClassDef(TFileCacheWrite,1) //TFile cache when writing 00056 }; 00057 00058 #endif