Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

7.6 Smart Pointer Class Architecture

The Smart Pointer package includes handle-body, singleton, smart pointer, and helper classes.

In the smart pointer category are the generic template classes for pointer-like object creation. Using these classes, you can create objects that act like pointers but provide some special behavior, such as reference-counting.

All classes in the smart pointer category derive from the abstract template class RWTPointer, as shown in Figure 42. RWTPointer is an opaque pointer, a pointer wrapper without dereferencing operations. Dereferencing operations are implemented in the derived concrete types, so they can have specialized behavior. RWTPointer provides a minimal common set of operations, such as the isValid() function.

Figure 42 -- Smart pointer classes

Handle-body implementations built with the Smart Pointer package are based on the RWHandleBase and RWBodyBase classes (see Figure 43). These classes implement the basic functionality required for reference-counting. RWHandleBase provides constructors, destructor, assignment operator, equality and inequality operators, and the isValid() member, while RWBodyBase maintains the multithread-safe reference count.

Figure 43 -- Handle-body and singleton classes

The helper category contains accessory classes used by the smart pointer and handle-body classes (shown in Figure 44). For example, the implementation of reference counting falls in this category.

Figure 44 -- Helper classes



Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.