SourcePro® 2023.1 |
SourcePro® API Reference Guide |
A writable IOU handle. More...
#include <rw/itc/RWTIOUEscrow.h>
Public Types | |
typedef Redeemable | RedeemableType |
Public Types inherited from RWTEscrowHandle< Redeemable > | |
typedef Redeemable | RedeemableType |
Public Member Functions | |
RWTIOUEscrow (void) | |
RWTIOUEscrow (const RWTEscrowHandle< Redeemable > &escrowHandle) | |
RWTIOUEscrow (const RWTIOUEscrow< Redeemable > &second) | |
~RWTIOUEscrow (void) | |
bool | aborted (void) const |
void | close (const Redeemable &value) |
bool | closeable (void) const |
bool | closed (void) |
bool | inError (void) |
RWTIOUEscrow< Redeemable > | newInstance (void) const |
void | operator() (const Redeemable &value) |
RWTIOUEscrow< Redeemable > & | operator= (const RWTIOUEscrow< Redeemable > &second) |
void | operator= (const Redeemable &value) |
bool | redeemed (void) const |
void | setException (const RWTHRxmsg &xmsg) |
void | setException (const RWCString &msg) |
Public Member Functions inherited from RWTEscrowHandle< Redeemable > | |
RWTEscrowHandle (void) | |
RWTEscrowHandle (RWEscrowImpBase *imp) | |
RWTEscrowHandle (const RWTEscrowHandle< Redeemable > &second) | |
RWTEscrowHandle< Redeemable > & | operator= (const RWTEscrowHandle< Redeemable > &second) |
Public Member Functions inherited from RWHandleBase | |
bool | isValid (void) const |
bool | operator!= (const RWHandleBase &second) const |
bool | operator< (const RWHandleBase &second) const |
bool | operator== (const RWHandleBase &second) const |
Additional Inherited Members | |
Protected Member Functions inherited from RWHandleBase | |
RWHandleBase (void) | |
RWHandleBase (RWStaticCtor) | |
RWHandleBase (RWBodyBase *body) | |
RWHandleBase (const RWHandleBase &second) | |
~RWHandleBase (void) | |
RWBodyBase & | body (void) const |
RWHandleBase & | operator= (const RWHandleBase &second) |
An RWTIOUEscrow is a writable IOU handle. An IOU, also known as a future, is a promise for a value that is forthcoming – 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.
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 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
.
The RWTIOUEscrow is the handle through which a value is eventually written to an underlying escrow object. One or more readers may redeem that value once it is available by using any RWTIOUResult handle that is bound to the same escrow instance.
An RWTIOUEscrow is a reference counted handle to an RWTEscrowImp. It can be copied and passed by value. When the last handle to a given RWTEscrowImp is destroyed, the internal RWTEscrowImp is destroyed.
An RWTIOUEscrow can be initialized by or assigned to an RWTIOUResult, and vice versa. Both are interfaces to the same underlying RWTEscrowImp. RWTIOUEscrow is a write interface, and RWTIOUResult is a read interface.
An exception may be set on an IOU by the holder of an RWTIOUEscrow. This will cause the exception to be thrown when an attempt is made to redeem it.
Similarly, an IOU may be aborted by the holder of an RWTIOUResult. This will cause an exception to be thrown if an attempt is made to redeem the IOU or to set its value.
An RWTIOUEscrow is closeable if a value has not been set, it has not been aborted, and no exception has been set.
typedef Redeemable RWTIOUEscrow< Redeemable >::RedeemableType |
A synonym for the value type of the IOU, or future, result.
|
inline |
Destroys the handle and decrements the reference count of the current escrow instance, if any, deleting the escrow if its reference count reaches zero.
|
inline |
Creates an empty, invalid handle. Use of an instance created by the default constructor results in an RWTHRInvalidPointer exception being thrown. You can determine if an RWTIOUEscrow handle is valid by calling the isValid() member function, which is inherited from the RWHandleBase base class.
|
inline |
Constructs a new handle instance and attaches it to the escrow instance, if any, pointed to by escrowHandle, and increments the escrow's reference count. This constructor allows an RWTIOUEscrow to be constructed from an RWTIOUResult.
|
inline |
Copy constructor. Constructs a new handle instance and attaches it to the escrow instance, if any, pointed to by second, and increments the escrow's reference count.
|
inline |
Returns true
if the IOU has been aborted, otherwise returns false
. Possible exceptions include RWTHRInvalidPointer
.
|
inline |
Stores a value into the underlying escrow. If the IOU has already been closed, the function throws an RWTHREscrowAlreadyClosed exception. If the escrow operation has been aborted, the function throws an RWTHROperationAborted exception. If an exception has been set, that exception is thrown.
|
inline |
Returns true
if the IOU has not been closed, and is not in an error condition or aborted; otherwise returns false
. Possible exceptions include RWTHRInvalidPointer.
|
inline |
Returns true
if the IOU has been closed, otherwise returns false
. Possible exceptions include RWTHRInvalidPointer.
|
inline |
Returns true
if the IOU has been closed with an error, otherwise returns false
. Possible exceptions include RWTHRInvalidPointer.
|
inline |
Creates a new instance of the same class as the current concrete RWTEscrowImp body. Returns a new RWTIOUEscrow handle that points to the new body.
|
inline |
Equivalent to close().
|
inline |
Detaches this handle from its current escrow instance, if any, decrementing the escrow's reference count and deleting the escrow if the count reaches zero. It then attaches to the escrow instance, if any, pointed to by second, and increments the new escrow's reference count.
|
inline |
Equivalent to close().
|
inline |
Returns true
if the IOU has been successfully redeemed at least once, otherwise returns false
. Possible exceptions include RWTHRInvalidPointer.
|
inline |
Used to indicate that IOU result could not be produced because an exception occurred. Causes a copy of the specified exception to be stored inside the IOU escrow object. The stored exception is rethrown in response to any attempt to redeem the IOU. If the IOU has already either been closed normally, closed with an error, or aborted, the error is ignored.
|
inline |
Used to indicate that IOU result could not be produced because an exception occurred. The string message is packaged in an RWTHRxmsg and stored inside the IOU escrow object. The stored exception is thrown in response to any attempt to redeem the IOU. If the IOU has already either been closed normally, closed with an error, or aborted, the error is ignored.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |