Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWTIOUResult<Redeemable>


RWTIOUResult<Redeemable> RWTEscrowHandle<Redeemable>

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

Data Types

Member Functions

Package

Interthread Communication

Header File

#include <rw/itc/RWTIOUResult.h> 

Description

An RWTIOUResult<Redeemable> is a readable IOU handle. An IOU, sometimes known as a future, is a promise for a value that is forthcoming. It is a placeholder for that value. Usually the writer of an IOU and the reader (or readers) of an IOU are in different threads of control. In this sense IOUs are a mechanism for interthread communication.

The template parameter Redeemable is the value type of IOU result. This type must provide a public copy-constructor and must allow dynamic allocation using operator new().

An IOU is a write once/read many structure. It may only be written to once, but may be read any number of times.

The RWTIOUResult<Redeemable> handle is a reference counted handle to an RWTEscrowImp<Redeemable>. It can be copied and passed by value. When the last handle to a given RWTEscrowImp<Redeemable> is destroyed, then the internal RWTEscrowImp<Redeemable> is destroyed.

An RWTIOUResult<Redeemable> can be initialized by or assigned to an RWTIOUEscrow<Redeemable>, and visa versa. Both are interfaces to the same underlying RWTIOUEscrowImp<Redeemable>. RWTIOUResult<Redeemable> is a read interface, and RWTIOUEscrow<Redeemable> is a write interface.

The holder of the RWTIOUResult<Redeemable> decides how and when to redeem the value held by the IOU. IOU redemption is the process of getting the result from the IOU when it is available. There are 3 ways to redeem an RWTIOUResult<Redeemable>:

An IOU may be aborted by the holder of an RWTIOUResult<Redeemable>. This will cause an exception to be thrown if an attempt is made to redeem the IOU or to set its value.

Similarly an exception may be set on an IOU by the holder of an RWTIOUEscrow<Redeemable>. This will cause the exception to be thrown when an attempt is made to redeem it.

An RWTIOUResult<Redeemable> is redeemable if a value has been set, if it has been aborted, or if an exception has been set.

Example

Public Typedefs

typedef Redeemable RedeemableType;
typedef RWTFunctor1<RWTEscrowHandle<Redeemable> RWIOUResultCallback;

Public Constructors

RWTIOUResult(void);
RWTIOUResult(const RWTEscrowHandle<Redeemable>& escrowHandle);
RWTIOUResult(const RWTIOUResult<Redeemable>& second);

Public Destructor

~RWTIOUResult(void)

Public Member Operators

RWTIOUResult<Redeemable>&
operator=(const RWTIOUResult<Redeemable>& second)
Redeemable
operator()(void) const;
operator Redeemable() const;

Public Member Functions

void
abort(void) const;
RWBoolean
aborted(void) const;
void
addCallback(const RWIOUResultCallback& callback)
RWBoolean
inError(void) const;
Redeemable
redeem(void) const;
RWBoolean
redeemable(void) const;
RWBoolean
redeemed(void) const;
void
removeCallback(const RWIOUResultCallback& callback);

See Also

RWTIOUEscrow<Redeemable>, RWTEscrowHandle<Redeemable>, RWTEscrowImp<Redeemable>,
RWTThreadEscrowImp<Redeemable>
, rwtMakeIOUCallback



Previous fileTop of DocumentContentsIndexNext file

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