ROOT  6.06/09
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 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18 
19 class TFile;
20 
21 class TFileCacheWrite : public TObject {
22 
23 protected:
24  Long64_t fSeekStart; ///< Seek value of first block in cache
25  Int_t fBufferSize; ///< Allocated size of fBuffer
26  Int_t fNtot; ///< Total size of cached blocks
27  TFile *fFile; ///< Pointer to file
28  char *fBuffer; ///< [fBufferSize] buffer of contiguous prefetched blocks
29  Bool_t fRecursive; ///< flag to avoid recursive calls
30 
31 private:
32  TFileCacheWrite(const TFileCacheWrite &); //cannot be copied
34 
35 public:
37  TFileCacheWrite(TFile *file, Int_t buffersize);
38  virtual ~TFileCacheWrite();
39  virtual Bool_t Flush();
40  virtual Int_t GetBytesInCache() const { return fNtot; }
41  virtual void Print(Option_t *option="") const;
42  virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
43  virtual Int_t WriteBuffer(const char *buf, Long64_t pos, Int_t len);
44  virtual void SetFile(TFile *file);
45 
46  ClassDef(TFileCacheWrite,1) //TFile cache when writing
47 };
48 
49 #endif
Int_t fNtot
Total size of cached blocks.
long long Long64_t
Definition: RtypesCore.h:69
const char Option_t
Definition: RtypesCore.h:62
TFileCacheWrite & operator=(const TFileCacheWrite &)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
char * fBuffer
[fBufferSize] buffer of contiguous prefetched blocks
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual ~TFileCacheWrite()
Destructor.
virtual Bool_t Flush()
Flush the current write buffer to the file.
virtual void Print(Option_t *option="") const
Print class internal structure.
TFile * fFile
Pointer to file.
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...
Bool_t fRecursive
flag to avoid recursive calls
Mother of all ROOT objects.
Definition: TObject.h:58
virtual Int_t WriteBuffer(const char *buf, Long64_t pos, Int_t len)
Write buffer at position pos in the write buffer.
Int_t fBufferSize
Allocated size of fBuffer.
virtual Int_t GetBytesInCache() const
Long64_t fSeekStart
Seek value of first block in cache.
virtual void SetFile(TFile *file)
Set the file using this cache.
A cache when writing files over the network.