The 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 the Threads Module with the base classes for handle-body implementation, as shown in Figure 9.
See Chapter 7 of the Threads Module User's Guide for a complete information on how to use the Smart Pointer package.
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
Table 6 contains an alphabetical listing of the public classes and global functions and macros in the Smart Pointer package.
Class Name | Description |
A class for maintaining a reference count. More efficient than RWTCounter<RWMutexLock> where possible. | |
Base class for body classes. | |
Base class for handle classes. | |
A typedef that implements the multithread-safe reference-counter, which can be used as the counter template parameter for RWTCountingPointer. | |
A smart pointer class that is intended for use as a handle to a reference-counting body. | |
A class for maintaining a reference count. Uses the template type as a lock for atomicity. | |
A base class for classes that must maintain a reference count. | |
Defines a reference-counted pointer that provides reference counting semantics for objects that do not directly support reference counting. | |
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. | |
Base class for the smart-pointer classes in the pointer package. | |
Ensures that a class has only one instance, and provides a global point of access to it. | |
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. |
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.