Tools.h++ Manual
104011 Tandem Computers Incorporated 21-51
21
Public constructor
RWCacheManager(RWFile* file, unsigned blocksz, unsigned
mxblks = 10);
Construct a cache for the
RWFile
pointed to by
file
. The length of the fixed-
size blocks is given by
blocksz
. The number of cached blocks is given by
mxblks
.
~RWCacheManager();
Performs any pending I/O operations (i.e., calls
flush()
) and deallocates any
allocated memory.
Public member functions
RWBoolean flush();
Perform any pending I/O operations. Returns
TRUE
if the flush was
successful,
FALSE
otherwise.
void invalidate();
Invalidate the cache.
RWBoolean read(RWoffset locn, void* dat);
Return the data located at offset
locn
of the associated
RWFile
. The data is
put in the buffer pointed to by
dat
. This buffer must be at least as long as the
block size specified when the cache was constructed. Returns
TRUE
if the
operation was successful, otherwise
FALSE
.
RWBoolean write(RWoffset locn, void* dat);
Write the block of data pointed to by
dat
to the offset
locn
of the associated
RWFile
. The number of bytes written is given by the block size specified
when the cache was constructed. The actual write to disk may be deferred.
Use member function
flush()
to perform any pending output. Returns
TRUE
if the operation was successful, otherwise
FALSE
.