Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWTCountedPointer<Body>


RWTCountedPointer<Body> RWTPointer<Body>

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Data Types

Member Functions

Package

Smart Pointer

Header File

#include <rw/pointer/RWTCountedPointer.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 specified as a template parameter must provide member functions for incrementing and decrementing the reference count. These functions must be declared as void addReference() and unsigned removeReference(). The easiest way to achieve this is by deriving from class RWTCountingBody.

Example

Public Constructors

RWTCountedPointer(Body* bodyP=rwnil);
RWTCountedPointer(RWStaticCtor);
RWTCountedPointer(const RWTCountedPointer<Body>& second);

Public Destructor

~RWTCountedPointer(void);

Public Typedef

typedef Body BodyType; 

Public Member Operators

Body&
operator*(void) const;
Body*
operator->(void) const;  
RWTCountedPointer<Body>&
operator=(Body* ptr);
RWTCountedPointer<Body>&
operator=(const RWTCountedPointer<Body>& second);

Public Member Function

void
orphan(void);

Protected Member Function

void
transfer(Body* bodyP=rwnil);

See Also

RWTCountingBody



Previous fileTop of DocumentContentsIndexNext file

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