SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Base class for all concrete IOU escrow implementations. Not intended for direct use. More...
#include <rw/itc/RWTEscrowImp.h>
Public Types | |
typedef Redeemable | RedeemableType |
typedef RWTFunctor< void(RWTEscrowHandle< Redeemable >)> | RWTIOUResultCallback |
Public Member Functions | |
virtual | ~RWTEscrowImp (void) |
void | abort (void) |
bool | aborted (void) const |
void | addCallback (const RWTIOUResultCallback &iouResultCallback) |
void | close (const Redeemable &value) |
bool | closeable (void) const |
bool | closed (void) const |
bool | inError (void) const |
RWTEscrowHandle< Redeemable > | newInstance (void) const |
const Redeemable & | redeem (void) const |
bool | redeemable (void) const |
bool | redeemed (void) const |
void | removeCallback (const RWTIOUResultCallback &iouResultCallback) |
void | setException (const RWTHRxmsg &xmsg) |
Additional Inherited Members | |
Protected Types inherited from RWTCountingBody< RWMutexLock > | |
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > | LockGuard |
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > | TryLockGuard |
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > | UnlockGuard |
Protected Types inherited from RWTMonitor< RWMutexLock > | |
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > | LockGuard |
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > | TryLockGuard |
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > | UnlockGuard |
Do not use this class directly. This class is the base class for all concrete IOU escrow implementations, providing basic functionality and allowing for extension via virtual functions.
Use this class only through RWTIOUResult and RWTIOUEscrow handles. The interface of RWTEscrowImp is a union of the interfaces provided by RWTIOUResult and RWTIOUEscrow.
typedef Redeemable RWTEscrowImp< Redeemable >::RedeemableType |
A synonym for the value type of the IOU, or future, result.
typedef RWTFunctor<void(RWTEscrowHandle<Redeemable>)> RWTEscrowImp< Redeemable >::RWTIOUResultCallback |
A typedef for a callback function object.
|
virtual |
Virtual destructor.
|
protected |
RWTEscrowImp cannot be explicitly constructed. Rather, construct it implicitly using make() functions in concrete derived classes. The derived-class make() functions return an RWTEscrowHandle for initializing an RWTIOUEscrow or RWTIOUResult.
This type of construction means that a raw RWTEscrowImp pointer will not be visible to your application.
void RWTEscrowImp< Redeemable >::abort | ( | void | ) |
Aborts the operation associated with the escrow, as follows:
This method is ignored if the operation has already been aborted.
bool RWTEscrowImp< Redeemable >::aborted | ( | void | ) | const |
Returns true
if the operation has been aborted, otherwise false
.
void RWTEscrowImp< Redeemable >::addCallback | ( | const RWTIOUResultCallback & | iouResultCallback | ) |
Adds a callback. The callback is fired when the escrow is closed.
void RWTEscrowImp< Redeemable >::close | ( | const Redeemable & | value | ) |
Stores the value, then closes the escrow. If an exception has been set, that exception is thrown.
RWTHREscrowAlreadyClosed | Thrown if the escrow has already been closed. |
RWTHROperationAborted | Thrown if the escrow operation has been aborted. |
bool RWTEscrowImp< Redeemable >::closeable | ( | void | ) | const |
Returns true
if the escrow can be closed, i.e. if no value has been stored into the escrow, and the escrow is not in the error or aborted states. Otherwise, returns false
.
bool RWTEscrowImp< Redeemable >::closed | ( | void | ) | const |
Returns true if a value has been stored, and the escrow is closed. Otherwise, returns false
.
bool RWTEscrowImp< Redeemable >::inError | ( | void | ) | const |
Returns true
if the escrow closed with an error, otherwise false
. If the escrow did close with an error, any subsequent call to redeem receives an exception.
RWTEscrowHandle< Redeemable > RWTEscrowImp< Redeemable >::newInstance | ( | void | ) | const |
Creates a new instance of this RWTEscrowImp type.
const Redeemable & RWTEscrowImp< Redeemable >::redeem | ( | void | ) | const |
Gets the result, blocking if the result is not yet available.
RWTHROperationAborted | Thrown if the escrow (or the associated operation) has been aborted. If an exception is thrown and stored in the escrow, then that exception is re-thrown by this routine. |
bool RWTEscrowImp< Redeemable >::redeemable | ( | void | ) | const |
Returns true
if a proper value has been set, if an error has been set, or if the operation has been aborted; otherwise, returns false
.
This function is used primarily by the reader side to poll the escrow for the availability of a result.
bool RWTEscrowImp< Redeemable >::redeemed | ( | void | ) | const |
Returns true
if the result has been successfully redeemed; otherwise returns false
.
void RWTEscrowImp< Redeemable >::removeCallback | ( | const RWTIOUResultCallback & | iouResultCallback | ) |
Removes the callback if it exists, otherwise does nothing.
void RWTEscrowImp< Redeemable >::setException | ( | const RWTHRxmsg & | xmsg | ) |
Sets an error on the escrow so that an exception is stored inside the escrow. Notifies any callers waiting for the escrow to close so that the callers can redeem the IOU and catch the error. If the escrow has already closed, either normally or abnormally (with an error or by being aborted), then the error is ignored.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |