Provides a thread-safe way for surveying the outcome, henceforth referred to as status, of one operation (action).
More...
List of all members.
Public Member Functions |
|
| Status () |
| | Create an unused status object, not initially associated with an operation.
|
| | Status (boost::shared_ptr< OperationStatus > status) |
| | Create a status object tracking the outcome of the operation associated with the given OperationStatus object.
|
|
Status & | operator= (boost::shared_ptr< OperationStatus > status) |
| OperationOutcome | get_outcome () const |
| | Get the operation's outcome.
|
| bool | has_completed () const |
| | Get whether the operation's status is available.
|
| bool | succeeded () const |
| | Waits until the operation has completed and returns true if it succeeded.
|
| bool | failed () const |
| | Waits until the operation has completed and returns false if it failed.
|
| bool | wait_until_completed () const |
| | Wait until has_completed() is true.
|
| std::string | get_error_message () const |
| | Return's the error message in case of failure.
|
Detailed Description
Provides a thread-safe way for surveying the outcome, henceforth referred to as status, of one operation (action).
It provides the "end user" with methods for querying whether a status is yet available and blocking until a status is available.
- See also:
- Result, DelayedDispatch, OperationStatus
Constructor & Destructor Documentation
| Status |
( |
boost::shared_ptr< OperationStatus > |
status |
) |
|
Create a status object tracking the outcome of the operation associated with the given OperationStatus object.
- Parameters:
-
| status | The OperationStatus object associated with the operation to track. |
Member Function Documentation
Waits until the operation has completed and returns false if it failed.
Note if the operation succeeds but the client is disconnected before the client is notified failed() will return true, even though the operation didn't really fail.
- Precondition:
- The object is not unused, e.g. it tracks the outcome of an operation.
- Exceptions:
-
| std::logic_error | The status object is unused. |
| std::string get_error_message |
( |
|
) |
const |
Return's the error message in case of failure.
- Precondition:
- Defined only when the outcome is
OPERATION_FAILED.
- Exceptions:
-
| std::logic_error | The status object is unused. |
| OperationOutcome get_outcome |
( |
|
) |
const |
Get the operation's outcome.
- Precondition:
- Defined only when has_completed() is
true. The object must also not be unused.
- Exceptions:
-
| std::logic_error | Thrown if the preconditions are not met. |
| bool has_completed |
( |
|
) |
const |
Get whether the operation's status is available.
- Precondition:
- The object is not unused, e.g. it tracks the outcome of an operation.
- Exceptions:
-
| std::logic_error | The status object is unused. |
Waits until the operation has completed and returns true if it succeeded.
- Precondition:
- The object is not unused, e.g. it tracks the outcome of an operation.
- Exceptions:
-
| std::logic_error | The status object is unused. |
| bool wait_until_completed |
( |
|
) |
const |
Wait until has_completed() is true.
If the operation outcome is already available the method will return promptly.
- Precondition:
- The object is not unused, e.g. it tracks the outcome of an operation.
- Returns:
- Returns
true if the client was disconnected before a response was received, false otherwise.
- Exceptions:
-
| std::logic_error | The status object is unused. |
The documentation for this class was generated from the following files: