Deprecated. Specialized type of buffered page heap that swaps its pages to disk as necessary. More...
#include <rw/diskpage.h>
Public Member Functions | |
RWDiskPageHeap () | |
RWDiskPageHeap (const char *filename, unsigned nbufs=10, unsigned pgsize=512) | |
virtual | ~RWDiskPageHeap () |
virtual size_t | allocate () |
virtual void | deallocate (size_t h) |
Public Member Functions inherited from RWBufferedPageHeap | |
RWBufferedPageHeap (unsigned pgsize, unsigned nbufs=10) | |
virtual | ~RWBufferedPageHeap () |
virtual void | dirty (size_t h) |
bool | isValid () |
virtual void * | lock (size_t h) |
virtual void | unlock (size_t h) |
Public Member Functions inherited from RWVirtualPageHeap | |
RWVirtualPageHeap (unsigned pgsize) | |
virtual | ~RWVirtualPageHeap () |
unsigned | pageSize () const |
Protected Member Functions | |
virtual bool | swapIn (size_t, void *) |
virtual bool | swapOut (size_t, void *) |
RWDiskPageHeap is deprecated and is no longer supported. It may be removed from future releases.
Class RWDiskPageHeap is a specializing type of buffered page heap. It swaps its pages to disk as necessary.
In this example, 100 nodes of a linked list are created and strung together. The list is then walked, confirming that it contains 100 nodes. Each node is a single page. The "pointer" to the next node is actually the handle for the next page.
Program output:
RWDiskPageHeap::RWDiskPageHeap | ( | ) |
Constructs a new disk-based page heap using a temporary file. The number of buffers, each the size of the page size, is 10
. No more than this many pages can be locked at any one time. The size of each page is 512
. To see whether a valid RWDiskPageHeap has been constructed, call member function isValid().
Windows users may be required to call AnsiToOEM
on a Windows character constant for the filename in this constructor, because this constructor uses a C function call that may resolve to a DOS system call. In that case, DOS might not be able to recognize Windows character sets.
RWDiskPageHeap::RWDiskPageHeap | ( | const char * | filename, |
unsigned | nbufs = 10 , |
||
unsigned | pgsize = 512 |
||
) |
Constructs a new disk-based page heap. The heap uses a file with filename filename, otherwise it negotiates with the operating system for a temporary filename. The number of buffers, each the size of the page size, is nbufs. No more than this many pages can be locked at any one time. The size of each page is given by pgsize. To see whether a valid RWDiskPageHeap has been constructed, call member function isValid().
Windows users may be required to call AnsiToOEM
on a Windows character constant for the filename in this constructor, because this constructor uses a C function call that may resolve to a DOS system call. In that case, DOS might not be able to recognize Windows character sets.
|
virtual |
Returns any resources used by the disk page heap back to the operating system. All pages should have been deallocated before the destructor is called.
|
virtual |
Allocates a page off the disk page heap and returns a handle for it. If there is no more space (for example, the disk is full), the function returns 1.
Implements RWBufferedPageHeap.
|
virtual |
Deallocates the page associated with handle h. It is not an error to deallocate a zero handle.
Reimplemented from RWBufferedPageHeap.
|
protectedvirtual |
It is the responsibility of the specializing class to supply a definition for this pure virtual function. The Function swapIn() should copy the page with handle h into the buffer pointed to by buf.
Implements RWBufferedPageHeap.
|
protectedvirtual |
It is the responsibility of the specializing class to supply a definition for this pure virtual function. The function swapOut() should copy the page with handle h from the buffer pointed to by buf to the swapping medium.
Implements RWBufferedPageHeap.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |