template class Poco::ActiveResult
Overview
This class holds the result of an asynchronous method invocation (see class ActiveMethod). Moreā¦
#include <ActiveResult.h> template <class RT> class ActiveResult { public: // typedefs typedef RT ResultType; typedef ActiveResultHolder<ResultType> ActiveResultHolderType; // construction ActiveResult(ActiveResultHolderType* pHolder); ActiveResult(const ActiveResult& result); // methods ActiveResult& operator=(const ActiveResult& result); void swap(ActiveResult& result); ResultType& data() const; void data(ResultType* pValue); void wait(); bool tryWait(long milliseconds); void wait(long milliseconds); bool available() const; bool failed() const; std::string error() const; Exception* exception() const; void notify(); ResultType& data(); void error(const std::string& msg); void error(const Exception& exc); };
Detailed Documentation
This class holds the result of an asynchronous method invocation (see class ActiveMethod).
It is used to pass the result from the execution thread back to the invocation thread.
Methods
ActiveResult& operator=(const ActiveResult& result)
Assignment operator.
ResultType& data() const
Returns a reference to the result data.
void wait()
Pauses the caller until the result becomes available.
bool tryWait(long milliseconds)
Waits up to the specified interval for the result to become available.
Returns true if the result became available, false otherwise.
void wait(long milliseconds)
Waits up to the specified interval for the result to become available.
Throws a TimeoutException if the result did not became available.
bool available() const
Returns true if a result is available.
bool failed() const
Returns true if the active method failed (and threw an exception).
Information about the exception can be obtained by calling error().
std::string error() const
If the active method threw an exception, a textual representation of the exception is returned.
An empty string is returned if the active method completed successfully.
Exception* exception() const
If the active method threw an exception, a clone of the exception object is returned, otherwise null.
void notify()
Notifies the invoking thread that the result became available.
For internal use only.
ResultType& data()
Returns a non-const reference to the result data.
For internal use only.
void error(const std::string& msg)
Sets the failed flag and the exception message.
void error(const Exception& exc)
Sets the failed flag and the exception message.