libqi-api
2.1.4.13
|
#include <future.hpp>
Public Types | |
typedef FutureType< T >::type | ValueType |
Public Member Functions | |
Promise (FutureCallbackType async=FutureCallbackType_Async) | |
Promise (boost::function< void(qi::Promise< T >)> cancelCallback, FutureCallbackType async=FutureCallbackType_Async) | |
void | setValue (const ValueType &value) |
void | setError (const std::string &msg) |
void | setCanceled () |
void | reset () |
Future< T > | future () const |
Get a future linked to this promise. Can be called multiple times. More... | |
ValueType & | value () |
void | trigger () |
Protected Member Functions | |
void | setup (boost::function< void(qi::Promise< T >)> cancelCallback, FutureCallbackType async=FutureCallbackType_Async) |
Promise (Future< T > &f) | |
Protected Attributes | |
Future< T > | _f |
Friends | |
template<typename FT , typename PT > | |
void | adaptFuture (const Future< FT > &f, Promise< PT > &p) |
template<typename FT , typename PT , typename CONV > | |
void | adaptFuture (const Future< FT > &f, Promise< PT > &p, CONV converter) |
Similar to adaptFuture(f, p) but with a custom converter. More... | |
A Promise is used to create and satisfy a Future.
Definition at line 49 of file future.hpp.
typedef FutureType<T>::type qi::Promise< T >::ValueType |
Definition at line 444 of file future.hpp.
|
inlineexplicit |
Create a standard promise.
async | specify how callbacks registered with Future::connect are called: synchronously from the Promise setter, or asynchronously from a thread pool. |
Definition at line 451 of file future.hpp.
|
inlineexplicit |
Create a canceleable promise. If Future<T>::cancel is invoked, onCancel() will be called. It is expected to call setValue(), setError() or setCanceled() as quickly as possible, but can do so in an asynchronous way.
Definition at line 461 of file future.hpp.
|
inlineexplicitprotected |
Definition at line 509 of file future.hpp.
|
inline |
Get a future linked to this promise. Can be called multiple times.
Definition at line 493 of file future.hpp.
|
inline |
Definition at line 488 of file future.hpp.
|
inline |
set the cancel state, and notify all futures throw if state != running
Definition at line 483 of file future.hpp.
|
inline |
set the error, and notify all futures throw if state != running
Definition at line 476 of file future.hpp.
|
inlineprotected |
Definition at line 503 of file future.hpp.
|
inline |
notify all future that a value has been set. throw if state != running
Definition at line 469 of file future.hpp.
|
inline |
Trigger the promise with the current value.
Definition at line 501 of file future.hpp.
|
inline |
Gives access to the underlying value for in-place modification. trigger() must be called after the value is written to trigger the promise.
Definition at line 498 of file future.hpp.
|
friend |
Feed a promise from a future of possibly different type. Will monitor f
, and bounce its state to p
. Error and canceled state are bounced as is. Valued state is bounced through FutureValueConverter<FT, PT>::convert()
Definition at line 316 of file future.hxx.
|
friend |
Similar to adaptFuture(f, p) but with a custom converter.
Definition at line 326 of file future.hxx.
|
protected |
Definition at line 511 of file future.hpp.