Logo ROOT  
Reference Guide
TFileCacheWrite.h
Go to the documentation of this file.
1 // @(#)root/io:$Id$
2 // Author: Rene Brun 19/05/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TFileCacheWrite
13 #define ROOT_TFileCacheWrite
14 
15 #include "TObject.h"
16 
17 class TFile;
18 
19 class TFileCacheWrite : public TObject {
20 
21 protected:
22  Long64_t fSeekStart; ///< Seek value of first block in cache
23  Int_t fBufferSize; ///< Allocated size of fBuffer
24  Int_t fNtot; ///< Total size of cached blocks
25  TFile *fFile; ///< Pointer to file
26  char *fBuffer; ///< [fBufferSize] buffer of contiguous prefetched blocks
27  Bool_t fRecursive; ///< flag to avoid recursive calls
28 
29 private:
30  TFileCacheWrite(const TFileCacheWrite &) = delete; //cannot be copied
31  TFileCacheWrite& operator=(const TFileCacheWrite &) = delete;
32 
33 public:
35  TFileCacheWrite(TFile *file, Int_t buffersize);
36  virtual ~TFileCacheWrite();
37  virtual Bool_t Flush();
38  virtual Int_t GetBytesInCache() const { return fNtot; }
39  virtual void Print(Option_t *option="") const;
40  virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
41  virtual Int_t WriteBuffer(const char *buf, Long64_t pos, Int_t len);
42  virtual void SetFile(TFile *file);
43 
44  ClassDef(TFileCacheWrite,1) //TFile cache when writing
45 };
46 
47 #endif
TFileCacheWrite::fSeekStart
Long64_t fSeekStart
Seek value of first block in cache.
Definition: TFileCacheWrite.h:22
TFileCacheWrite::fBuffer
char * fBuffer
[fBufferSize] buffer of contiguous prefetched blocks
Definition: TFileCacheWrite.h:26
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
Int_t
int Int_t
Definition: RtypesCore.h:45
TFileCacheWrite::GetBytesInCache
virtual Int_t GetBytesInCache() const
Definition: TFileCacheWrite.h:38
TFileCacheWrite::ReadBuffer
virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len)
Called by the read cache to check if the requested data is not in the write cache buffer.
Definition: TFileCacheWrite.cxx:108
bool
TFileCacheWrite::fBufferSize
Int_t fBufferSize
Allocated size of fBuffer.
Definition: TFileCacheWrite.h:23
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TFileCacheWrite::SetFile
virtual void SetFile(TFile *file)
Set the file using this cache.
Definition: TFileCacheWrite.cxx:153
TFileCacheWrite::operator=
TFileCacheWrite & operator=(const TFileCacheWrite &)=delete
TFileCacheWrite::TFileCacheWrite
TFileCacheWrite()
Default Constructor.
Definition: TFileCacheWrite.cxx:37
TFile
Definition: TFile.h:54
TFileCacheWrite::fNtot
Int_t fNtot
Total size of cached blocks.
Definition: TFileCacheWrite.h:24
TFileCacheWrite::fRecursive
Bool_t fRecursive
flag to avoid recursive calls
Definition: TFileCacheWrite.h:27
TObject.h
TFileCacheWrite::Print
virtual void Print(Option_t *option="") const
Print class internal structure.
Definition: TFileCacheWrite.cxx:94
file
Definition: file.py:1
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TFileCacheWrite::fFile
TFile * fFile
Pointer to file.
Definition: TFileCacheWrite.h:25
TFileCacheWrite
Definition: TFileCacheWrite.h:19
TFileCacheWrite::Flush
virtual Bool_t Flush()
Flush the current write buffer to the file.
Definition: TFileCacheWrite.cxx:79
TFileCacheWrite::WriteBuffer
virtual Int_t WriteBuffer(const char *buf, Long64_t pos, Int_t len)
Write buffer at position pos in the write buffer.
Definition: TFileCacheWrite.cxx:121
TFileCacheWrite::~TFileCacheWrite
virtual ~TFileCacheWrite()
Destructor.
Definition: TFileCacheWrite.cxx:70
int