Tools.h++ Class Reference

Table Of Contents
struct Record {
int i;
float f;
char str[15];
};
main(){
RWoffset loc;
RWFile file("file.dat"); // Construct a file
// Construct a cache, using 20 slots for struct Record:
RWCacheManager cache(&file, sizeof(Record), 20);
Record r;
// ...
cache.write(loc, &r);
// ...
cache.read(loc, &r);
}
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. If the total number of
bytes cached would exceed the maximum value of an unsigned int, then
RWCacheManager will quietly decide to cache a smaller number of blocks.
Public Destructor
~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