User manual

old releases - latest release - trunk

Status Class Reference

Inheritance diagram for Status:
Collaboration diagram for Status:

List of all members.


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

Public Member Functions

 Status () throw ()
 Create an unused status object, not initially associated with an operation.
 Status (boost::shared_ptr< OperationStatus > status) throw ()
 Create a status object tracking the outcome of the operation associated with the given OperationStatus object.
Statusoperator= (boost::shared_ptr< OperationStatus > status) throw ()
OperationOutcome get_outcome () const throw (std::logic_error)
 Get the operation's outcome.
bool has_completed () const throw (std::logic_error)
 Get whether the operation's status is available.
bool succeeded () const throw (std::logic_error)
 Waits until the operation has completed and returns true if it succeeded.
bool failed () const throw (std::logic_error)
 Waits until the operation has completed and returns false if it failed.
bool wait_until_completed () const throw (std::logic_error)
 Wait until has_completed() is true.
std::string get_error_message () const throw (std::logic_error)
 Return's the error message in case of failure.

Private Attributes

boost::shared_ptr
< OperationStatus
m_status
 The object internally storing the data pertaining to the operation being tracked.

Constructor & Destructor Documentation

Status ( boost::shared_ptr< OperationStatus status  )  throw ()

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

OperationOutcome get_outcome (  )  const throw (std::logic_error)

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 throw (std::logic_error)

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.

bool succeeded (  )  const throw (std::logic_error)

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 failed (  )  const throw (std::logic_error)

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.

bool wait_until_completed (  )  const throw (std::logic_error)

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.

std::string get_error_message (  )  const throw (std::logic_error)

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.


Member Data Documentation

boost::shared_ptr<OperationStatus> m_status [private]

The object internally storing the data pertaining to the operation being tracked.

Defined only when if the assignment operator or non-default constructor is called.


The documentation for this class was generated from the following files: