Tools.h++ Manual

21-48 104011 Tandem Computers Incorporated
21
RWBufferedPageHeap
RWBufferedPageHeap
|
RWVirtualPageHeap
Synopsis
#include <rw/bufpage.h>
(Abstract base class)
Description This is an abstract base class that represents an abstract page heap buffered
through a set of memory buffers. It inherits from the abstract base class
RWVirtualPageHeap
which represents an abstract page heap.
RWBufferedPageHeap
will supply and maintain a set of memory buffers.
Specializing classes should supply the actual physical mechanism to swap
pages in and out of these buffers by supplying definitions for the pure virtual
functions
swapIn(RWHandle, void*) and swapOut(RWHandle,
void*)
.
The specializing class should also supply appropriate definitions for the public
functions
allocate()
and
deallocate(RWHandle)
.
For a sample implementation of a specializing class, see class
RWDiskPageHeap
.
Public constructor
RWBufferedPageHeap(unsigned pgsize, unsigned nbufs=10);
Constructs a buffered page heap with page size
pgsize
. The number of
buffers (each of size
pgsize
) that will be allocated on the heap will be
nbufs
.
If there is insufficient memory to satisfy the request, then the state of the
resultant object as returned by member function
isValid()
will be
FALSE
,
otherwise,
TRUE
.
Protected member functions
virtual RWBoolean swapIn(RWHandle h, void* buf) = 0;
virtual RWBoolean swapOut(RWHandle, h void* buf) = 0;
It is the responsibility of the specializing class to supply definitions for these
two pure virtual functions. Function
swapOut()
should copy the page with
handle
h
from the buffer pointed to by buf to the swapping medium. Function
swapIn()
should copy the page with handle
h
into the buffer pointed to by
buf
.