Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:45

0001 // @(#)root/io:$Id$
0002 // Author: Rene Brun   19/05/2006
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TFileCacheWrite
0013 #define ROOT_TFileCacheWrite
0014 
0015 #include "TObject.h"
0016 
0017 class TFile;
0018 
0019 class TFileCacheWrite : public TObject {
0020 
0021 protected:
0022    Long64_t      fSeekStart;      ///< Seek value of first block in cache
0023    Int_t         fBufferSize;     ///< Allocated size of fBuffer
0024    Int_t         fNtot;           ///< Total size of cached blocks
0025    TFile        *fFile;           ///< Pointer to file
0026    char         *fBuffer;         ///< [fBufferSize] buffer of contiguous prefetched blocks
0027    Bool_t        fRecursive;      ///< flag to avoid recursive calls
0028 
0029 private:
0030    TFileCacheWrite(const TFileCacheWrite &) = delete;            //cannot be copied
0031    TFileCacheWrite& operator=(const TFileCacheWrite &) = delete;
0032 
0033 public:
0034    TFileCacheWrite();
0035    TFileCacheWrite(TFile *file, Int_t buffersize);
0036    ~TFileCacheWrite() override;
0037    virtual Bool_t      Flush();
0038    virtual Int_t       GetBytesInCache() const { return fNtot; }
0039            void        Print(Option_t *option="") const override;
0040    virtual Int_t       ReadBuffer(char *buf, Long64_t pos, Int_t len);
0041    virtual Int_t       WriteBuffer(const char *buf, Long64_t pos, Int_t len);
0042    virtual void        SetFile(TFile *file);
0043 
0044    ClassDefOverride(TFileCacheWrite,1)  //TFile cache when writing
0045 };
0046 
0047 #endif