SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWHandleBase Class Reference

Base class for all handle classes. Increments a reference count for each class instance that is bound to an instance of the RWBodyBase class. More...

#include <rw/pointer/RWHandleBase.h>

Inheritance diagram for RWHandleBase:
RWTEscrowHandle< Return > RWAsymmetricKey RWByteInputStream RWByteOutputStream RWCancellation RWCharInputStream RWCharOutputStream RWDataInputStream RWDataOutputStream RWHttpClient RWMimeContentDisposition RWMimeContentType RWMimeHeader RWMimePart RWRunnableHandle RWRunnableTrap RWSecureSocketContext RWSecureSocketSession RWSymbol RWTEscrowHandle< Redeemable > RWTIOUTrap< Redeemable > RWThreadAttribute RWThreadManager RWThreadPool RWUCharInputStream RWUCharOutputStream RWWCharInputStream RWWCharOutputStream RWX509Certificate

Public Member Functions

bool isValid (void) const
 

Protected Member Functions

 RWHandleBase (const RWHandleBase &second)
 
 RWHandleBase (RWBodyBase *body)
 
 RWHandleBase (RWStaticCtor)
 
 RWHandleBase (void)
 
 ~RWHandleBase (void)
 
RWBodyBasebody (void) const
 
RWHandleBaseoperator= (const RWHandleBase &second)
 

Friends

bool operator== (const RWHandleBase &lhs, const RWHandleBase &rhs)
 

Related Symbols

(Note that these are not member symbols.)

bool operator!= (const RWHandleBase &lhs, const RWHandleBase &rhs)
 

Detailed Description

Base class for handle classes. Each time an instance of this class is bound to an instance of the RWBodyBase class, it increments the reference count maintained by that body. Each time an instance of this class detaches from a body instance, it decrements the body's reference count, until the last handle detaches, reaching zero, whereupon it deletes the body instance. The reference counting relieves clients of the burden of keeping track of when it is safe to delete a body instance.

When a handle is copy-constructed, the new handle attaches to the same body as the original. When one handle is assigned to another handle, the handle on the left side detaches from its current body and attaches to the body pointed to by the handle on the right side.

Example
See HandleBodyEx1.cpp and HandleBodyEx2.cpp, located in the examples directory.

Constructor & Destructor Documentation

◆ RWHandleBase() [1/4]

RWHandleBase::RWHandleBase ( void )
inlineprotected

Default constructor. Constructs an empty, invalid, handle instance. Throws no exceptions.

◆ RWHandleBase() [2/4]

RWHandleBase::RWHandleBase ( RWStaticCtor )
inlineprotected

Constructs a global static handle instance (may be used prior to construction). Throws no exceptions.

◆ RWHandleBase() [3/4]

RWHandleBase::RWHandleBase ( RWBodyBase * body)
inlineexplicitprotected

Binds a new handle instance to a body instance.

◆ RWHandleBase() [4/4]

RWHandleBase::RWHandleBase ( const RWHandleBase & second)
inlineprotected

Binds a new handle instance to the same body instance, if any, that is pointed to by a second handle instance second.

◆ ~RWHandleBase()

RWHandleBase::~RWHandleBase ( void )
inlineprotected

Destructor.

Member Function Documentation

◆ body()

RWBodyBase & RWHandleBase::body ( void ) const
inlineprotected

Gets a reference for the body instance, if any.

Exceptions
RWTHRInvalidPointerThrown if this handle is not attached to a body.

◆ isValid()

bool RWHandleBase::isValid ( void ) const
inline

Returns true if this handle points to a valid body instance. Otherwise, returns false. Throws no exceptions.

◆ operator=()

RWHandleBase & RWHandleBase::operator= ( const RWHandleBase & second)
inlineprotected

Binds this handle instance to the same body instance, if any, that is pointed to by a second handle instance second.

Friends And Related Symbol Documentation

◆ operator!=()

bool operator!= ( const RWHandleBase & lhs,
const RWHandleBase & rhs )
related

Returns the negation of operator==().

◆ operator==

bool operator== ( const RWHandleBase & lhs,
const RWHandleBase & rhs )
friend

Returns true if lhs and rhs point to the same body instance. Two empty handles are considered equal. Throws no exceptions.

Copyright © 2025 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.