SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Protected Member Functions
RWBufferedPageHeap Class Referenceabstract

Deprecated. Abstract base class representing a virtual page heap accessed through a buffer. More...

#include <rw/bufpage.h>

Inheritance diagram for RWBufferedPageHeap:
RWVirtualPageHeap RWDiskPageHeap

Public Member Functions

 RWBufferedPageHeap (unsigned pgsize, unsigned nbufs=10)
 
virtual ~RWBufferedPageHeap ()
 
virtual size_t allocate ()=0
 
virtual void deallocate (size_t h)
 
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 h, void *buf)=0
 
virtual bool swapOut (size_t h, void *buf)=0
 

Detailed Description

Deprecated:
As of SourcePro 1.

RWBufferedPageHeap is deprecated and is no longer supported. It may be removed from future releases.

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 supplies and maintains 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(size_t,void*) and swapOut(size_t,void*).

The specializing class should also supply appropriate definitions for the public functions allocate() and deallocate(size_t).

For a sample implementation of a specializing class, see class RWDiskPageHeap.

Synopsis
#include <rw/bufpage.h>
(Abstract base class )
Persistence
None

Constructor & Destructor Documentation

RWBufferedPageHeap::RWBufferedPageHeap ( unsigned  pgsize,
unsigned  nbufs = 10 
)

Constructs a buffered page heap with page size pgsize. The number of buffers (each of size pgsize) that are allocated on the heap is specified by nbufs. If there is insufficient memory to satisfy the request, the state of the resultant object as returned by member function isValid() is false, otherwise true.

virtual RWBufferedPageHeap::~RWBufferedPageHeap ( )
virtual

Deallocates all internal buffers.

Member Function Documentation

virtual size_t RWBufferedPageHeap::allocate ( )
pure virtual

It is the responsibility of the specializing class to supply a definition for this pure virtual function. The specializing class should allocate a page and return a unique handle for it. It should return zero if it cannot satisfy the request. The size of the page is set by the constructor.

Implements RWVirtualPageHeap.

Implemented in RWDiskPageHeap.

virtual void RWBufferedPageHeap::deallocate ( size_t  h)
virtual

Redefined from class RWVirtualPageHeap. It is never an error to call this function with argument zero. Even though this is not a pure virtual function, it is the responsibility of the specializing class to supply an appropriate definition for this function. All this definition does is release any buffers associated with the handle h. Just as the actual page allocation is done by the specializing class through virtual function allocate(), so must the actual deallocation be done by overriding deallocate().

Implements RWVirtualPageHeap.

Reimplemented in RWDiskPageHeap.

virtual void RWBufferedPageHeap::dirty ( size_t  h)
virtual

Declare the page associated with handle h to be "dirty." That is, it has changed since it was last locked. The page must be locked before calling this function.

Implements RWVirtualPageHeap.

bool RWBufferedPageHeap::isValid ( )
inline

Returns true if self is in a valid state. A possible reason why the object might not be valid is insufficient memory to allocate the internal buffers.

virtual void* RWBufferedPageHeap::lock ( size_t  )
virtual

Lock the page, swapping it into physical memory, and return an address for it. Returns rwnil if the specializing class is unable to honor the lock. The returned pointer should be regarded as pointing to a buffer of the page size.

Implements RWVirtualPageHeap.

virtual bool RWBufferedPageHeap::swapIn ( size_t  h,
void *  buf 
)
protectedpure virtual

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.

Implemented in RWDiskPageHeap.

virtual bool RWBufferedPageHeap::swapOut ( size_t  h,
void *  buf 
)
protectedpure virtual

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.

Implemented in RWDiskPageHeap.

virtual void RWBufferedPageHeap::unlock ( size_t  )
virtual

Unlock a page. A page must be locked before calling this function. After calling this function, the address returned by lock() is no longer valid.

Implements RWVirtualPageHeap.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.