Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

2.5 Smart Pointer Package

2.5.1 Description

The Threads.h++ Smart Pointer package includes a generic singleton template class, a simple pointer wrapper, and two varieties of thread-safe reference-counted pointers. The classes that provide these features are shown in Figure 8. The Smart Pointer package also provides Threads.h++ with the base classes for handle-body implementation, as shown in Figure 9.

See Chapter 7 of the Threads.h++ User's Guide for a complete information on how to use the Smart Pointer package.

2.5.2 Smart Pointer Class Hierarchy

Figure 8 -- Smart Pointer class hierarchy

The classes in the hierarchy include formal template parameters that represent the types of associated objects. These parameters include:

Body - The type of the pointed-to object

Counter - The type of the reference-counter

Mutex - The type of the synchronization mechanism

Figure 9 -- Handle-body base classes.

2.5.3 Index of Smart Pointer Classes

Table 7 contains an alphabetical listing of the public classes and global functions and macros in the Smart Pointer package.

Table 7 -- Index of Smart Pointer classes 

 
Class NameDescription
RWBodyBase
Base class for body classes.
RWHandleBase
Base class for handle classes.
RWSafeCounter
A typedef that implements the multithread-safe reference-counter, which can be used as the counter template parameter for RWTCountingPointer.
RWTCountedPointer<Body>
A smart pointer class that is intended for use as a handle to a reference-counting body.
RWTCounter<Mutex>
The counter type used by the RWTCountingPointer class.
RWTCountingBody<Mutex>
A base class for classes that must maintain a reference count.
RWTCountingPointer<Body, Counter=RWSafeCounter>
Defines a reference-counted pointer that provides reference counting semantics for objects that do not directly support reference counting.
RWTOnlyPointer<Body>
An abstraction that simplifies the use of pointers referring to objects on the heap. It doesn't do reference-counting on the body; rather, it is based on the idea of strict ownership semantics.
RWTPointer<Body>
Base class for the smart-pointer classes in the pointer package.
RWTSingleton<T>
Ensures that a class has only one instance, and provides a global point of access to it.
RWUnsafeCounter
A typedef that implements an unsafe counter that can be used for reference counting where multithread safety is not required. This typedef can be used as the counter template parameter for RWTCountingPointer.



Previous fileTop of DocumentContentsIndexNext file

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