Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
17class TFile;
18
19class TFileCacheWrite : public TObject {
20
21protected:
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
29private:
30 TFileCacheWrite(const TFileCacheWrite &) = delete; //cannot be copied
32
33public:
35 TFileCacheWrite(TFile *file, Int_t bufsize);
36 ~TFileCacheWrite() override;
37 virtual Bool_t Flush();
38 virtual Int_t GetBytesInCache() const { return fNtot; }
39 void Print(Option_t *option="") const override;
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 ClassDefOverride(TFileCacheWrite,1) //TFile cache when writing
45};
46
47#endif
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Int_t fBufferSize
Allocated size of fBuffer.
Int_t fNtot
Total size of cached blocks.
char * fBuffer
[fBufferSize] buffer of contiguous prefetched blocks
virtual Bool_t Flush()
Flush the current write buffer to the file.
TFile * fFile
Pointer to file.
TFileCacheWrite()
Default Constructor.
TFileCacheWrite & operator=(const TFileCacheWrite &)=delete
~TFileCacheWrite() override
Destructor.
Bool_t fRecursive
flag to avoid recursive calls
void Print(Option_t *option="") const override
Print class internal structure.
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.
TFileCacheWrite(const TFileCacheWrite &)=delete
virtual void SetFile(TFile *file)
Set the file using this cache.
Long64_t fSeekStart
Seek value of first block in cache.
virtual Int_t GetBytesInCache() const
virtual Int_t WriteBuffer(const char *buf, Long64_t pos, Int_t len)
Write buffer at position pos in the write buffer.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Definition TFile.h:130
TObject()
TObject constructor.
Definition TObject.h:259