Tools.h++ Manual
21-114 104011 Tandem Computers Incorporated
21
RWFileManager
RWFileManager
|
RWFile
Synopsis
typedef long RWoffset;
typedef unsigned long RWspace; // (typically)
#include <rw/filemgr.h>
RWFileManager f("file.dat");
Description Class
RWFileManager
allocates and deallocates storage in a disk file, much
like a “freestore” manager. It does this by maintaining a linked list of free
space within the file.
Note – Class
RWFileManager
inherits class
RWFile
as a public base class,
hence all the public member functions of
RWFile
are visible to
RWFileManager
. They are not listed here.
If a file is managed by an
RWFileManager
then the results are undefined to
read or write to an unallocated space in the file.
Public constructor
RWFileManager(const char* filename);
Construct a
RWFileManager
for the file with path name
filename
. The
RWFileManager
can be constructed with an old file or it can create a new file.
If it is constructed with an old file, then the file must have been originally
created by a
RWFileManager
. A possible exception that could occur is
RWFileErr
.
Public member functions
RWoffset allocate(RWspace s);
Allocates
s
bytes of storage in the file. Returns the offset to the start of the
storage location. The very first allocation for the file is considered "special"
and can be returned at any later time by the function
start()
. A possible
exception that could occur is
RWFileErr
.