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

rwsf::CountingPointer

Group:  Core Design Patterns


Does not inherit

Local Index

Members

Header File

#include rwsf/core/CountingPointer.h

Description

A smart pointer class that is intended for use as a handle to a reference-counted body. Each time an instance of this class is bound to a body instance, it increments a reference count associated with that body. Each time it detaches from a body instance, it decrements the body's associated 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.

rwsf::CountingPointer is a non-intrusive smart pointer type, which maintains a parallel counter to the body. For a class that assumes the body maintains the count, see rwsf::RefCountingPointer.

Public Typedefs

T * PointerType;
T & ReferenceType;

Public Constructors

CountingPointer(PointerType pointer = 0,
    AtomicCounter * counterP = 0);
CountingPointer(const CountingPointer< T > & second);

Public Destructors

~CountingPointer(void);

Public Member Functions

PointerType
get(void) const;
bool
isValid(void) const;
void
swapWith(CountingPointer< T > & second);
void
validate(void) const;

Public Operators

ReferenceType
operator *(void) const;
CountingPointer< T > &
operator=(const CountingPointer< T > & second);
CountingPointer< T > &
operator=(PointerType pointer);
PointerType
operator->(void) const;
operator CountingPointer();
operator typename CountingPointer() 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.