Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress C++ API Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

rwsf::RefCountingPointer

Group:  Core Design Patterns


Does not inherit

Local Index

Members

Header File

#include rwsf/core/RefCountingPointer.h

Description

A smart pointer class that is intended for use as a handle to a reference-counting body. Each time an instance of this class is bound to a body instance, it increments the reference count maintained by that body. Each time it detaches from a body instance, it decrements the body's reference count; and if the reference count reaches zero, it deletes the body instance. The reference counting relieves clients of the burden of having to keep track of when it is safe to delete a body instance.

The class T specified as a template parameter must provide member functions for incrementing and decrementing the reference count, are responsible for deleting the instance of T when the count reaches 0.

The class rwsf::RefCountingObject can be used as a base class in order to provide this functionality in user-defined types.

Note

For classes that do not implement the addRef() and releaseRef() methods above, see rwsf::CountingPointer for a non-intrusive smart-pointer solution.

rwsf::CountingPointer, rwsf::RefCountingObject

Public Typedefs

T * PointerType;
T & ReferenceType;

Public Constructors

RefCountingPointer(PointerType pointer = 0);
RefCountingPointer(const RefCountingPointer< T > & second);
RefCountingPointer(const RefCountingPointer< O > & second);

Public Destructors

~RefCountingPointer(void);

Public Member Functions

bool
isValid(void) const;

Public Operators

ReferenceType
operator *(void) const;
RefCountingPointer< T > &
operator=(const RefCountingPointer< T > & second);
RefCountingPointer< T > &
operator=(const RefCountingPointer< O > & second);
RefCountingPointer< T > &
operator=(PointerType second);
PointerType
operator->(void) const;
operator typename RefCountingPointer() const;


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.