rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWHandleBase Class Reference
[Smart Pointers]

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:
RWAsymmetricKey RWByteInputStream RWByteOutputStream RWCancellation RWCharInputStream RWCharOutputStream RWDataInputStream RWDataOutputStream RWFunctor0 RWHttpClient RWMimeContentDisposition RWMimeContentType RWMimeHeader RWMimePart RWRunnableHandle RWRunnableTrap RWSecureSocketContext RWSecureSocketSession RWSymbol RWTEscrowHandle< Redeemable > RWTFunctor1< S1 > RWTFunctor1< Arg1 > RWTFunctor1< Key > RWTFunctor2< S1, S2 > RWTFunctor2< Arg1, Arg2 > RWTFunctor2< Key, S1 > RWTFunctorR0< SR > RWTFunctorR0< Result > RWTFunctorR1< SR, S1 > RWTFunctorR1< Result, Arg1 > RWTFunctorR1< SR, Key > RWTFunctorR2< SR, S1, S2 > RWTFunctorR2< Result, Arg1, Arg2 > RWTFunctorR2< SR, Key, S1 > RWThreadAttribute RWThreadManager RWThreadPool RWTIOUTrap< Redeemable > RWUCharInputStream RWUCharOutputStream RWWCharInputStream RWWCharOutputStream RWX509Certificate

List of all members.

Public Member Functions

bool operator== (const RWHandleBase &second) const
bool operator< (const RWHandleBase &second) const
bool operator!= (const RWHandleBase &second) const
bool isValid (void) const

Protected Member Functions

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

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.

Examples

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


Constructor & Destructor Documentation

RWHandleBase::RWHandleBase ( void   )  [inline, protected]

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

RWHandleBase::RWHandleBase ( RWStaticCtor   )  [inline, protected]

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

RWHandleBase::RWHandleBase ( RWBodyBase body  )  [inline, protected]

Binds a new handle instance to a body instance.

RWHandleBase::RWHandleBase ( const RWHandleBase second  )  [inline, protected]

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

RWHandleBase::~RWHandleBase ( void   )  [inline, protected]

Destructor.


Member Function Documentation

RWBodyBase & RWHandleBase::body ( void   )  const [inline, protected]

Gets a reference for the body instance, if any.

Exceptions:
RWTHRInvalidPointer Thrown if this handle is not attached to a body.

Reimplemented in RWFunctorList0, RWTFunctorList1< S1 >, RWTFunctorList2< S1, S2 >, RWTFunctorMap1< Key >, RWTFunctorMap2< Key, S1 >, RWTFunctorMapR1< SR, Key >, RWTFunctorMapR2< SR, Key, S1 >, RWFunctor0, RWTFunctor1< S1 >, RWTFunctor2< S1, S2 >, RWTFunctorR0< SR >, RWTFunctorR1< SR, S1 >, RWTFunctorR2< SR, S1, S2 >, RWHttpClient, RWHttpSocketClient, RWHttpsSecureSocketClient, RWTIOUEscrow< Redeemable >, RWTIOUResult< Redeemable >, RWTIOUTrap< Redeemable >, RWMimeContentDescriptionHeader, RWMimeContentDisposition, RWMimeContentDispositionHeader, RWMimeContentIdHeader, RWMimeContentLocationHeader, RWMimeContentTransferEncodingHeader, RWMimeContentType, RWMimeContentTypeHeader, RWMimeGenericHeader, RWMimeHeader, RWMimeMultipart, RWMimePart, RWMimeVersionHeader, RWX509Certificate, RWCancellation, RWRunnableFunction, RWRunnableHandle, RWRunnableServer, RWRunnableTrap, RWServerPool, RWThread, RWThreadAttribute, RWThreadFunction, RWThreadManager, RWThreadPool, RWThreadSelf, RWTFunctorMapR1< RWMimeHeader, RWCString >, RWTFunctorMapR1< RWHttpClient, RWCString >, RWTFunctor1< Key >, RWTFunctor1< Arg1 >, RWTFunctor1< RWTEscrowHandle< Redeemable > >, RWTFunctor2< Key, S1 >, RWTFunctor2< const RWRunnable &, RWExecutionState >, RWTFunctor2< Arg1, Arg2 >, RWTFunctorR0< Return >, RWTFunctorR0< Result >, RWTFunctorR0< bool >, RWTFunctorR1< RWMimeHeader, RWCString >, RWTFunctorR1< SR, Key >, RWTFunctorR1< Result, Arg1 >, RWTFunctorR1< RWHttpClient, RWCString >, RWTFunctorR2< Result, Arg1, Arg2 >, RWTFunctorR2< SR, Key, S1 >, and RWTIOUEscrow< Return >.

bool RWHandleBase::isValid ( void   )  const [inline]

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

Reimplemented in RWSecureSocketSession.

bool RWHandleBase::operator!= ( const RWHandleBase second  )  const [inline]

Returns true if the handle points to different body instance, if any, than pointed to by a second handle second, and otherwise returns false. Throws no exceptions.

bool RWHandleBase::operator< ( const RWHandleBase second  )  const [inline]

Required for collections based on Standard C++ Library collections. (Redefine this operator in derived classes, as necessary.) Throws no exceptions.

Reimplemented in RWMimeContentDisposition, RWMimeContentType, RWMimeHeader, and RWMimePart.

RWHandleBase& RWHandleBase::operator= ( const RWHandleBase second  )  [inline, protected]

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

bool RWHandleBase::operator== ( const RWHandleBase second  )  const [inline]

Returns true if the handle points to the same body instance, if any, as pointed to by a second handle second, and otherwise returns false. Two empty handles are equal. Throws no exceptions.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.