Tools.h++ Class Reference

Table Of Contents
Click on the banner to return to the Class Reference home page.
©Copyright 1996 Rogue Wave Software
RWTValVirtualArray<T>
Synopsis
Description
Persistence
Example
Public Constructors
Public Destructor
Public Operators
Public Member Functions
Synopsis
#include <rw/tvrtarry.h>
RWVirtualPageHeap* heap;
RWTValVirtualArray<T> array(1000L, heap);
Description
This class represents a virtual array of elements of type T of almost any length. Individual
elements are brought into physical memory as needed basis. If an element is updated it is
automatically marked as "dirty" and will be rewritten to the swapping medium.
The swap space is provided by an abstract page heap which is specified by the constructor. Any
number of virtual arrays can use the same abstract page heap. You must take care that the
destructor of the abstract page heap is not called before all virtual arrays built from it have
been destroyed.
The class supports reference counting using a copy-on-write technique, so (for example)
returning a virtual array by value from a function is as efficient as it can be. Be aware, however,
that if the copy-on-write machinery finds that a copy must ultimately be made, then for large
arrays this could take quite a bit of time.
For efficiency, more than one element can (and should) be put on a page. The actual number of