libqi-api
2.1.4.13
|
#include <eventloop.hpp>
Public Types | |
typedef FutureType< T >::type | ValueType |
typedef FutureType< T >::typecast | ValueTypeCast |
typedef boost::function< void(Future < T >) > | Connection |
Public Member Functions | |
Future () | |
Future (const Future< T > &b) | |
bool | operator== (const Future< T > &other) |
Future< T > & | operator= (const Future< T > &b) |
bool | operator< (const Future< T > &b) const |
Future (const ValueType &v, FutureCallbackType async=FutureCallbackType_Async) | |
const ValueType & | value (int msecs=FutureTimeout_Infinite) const |
Return the value associated to a Future. More... | |
operator const ValueTypeCast & () const | |
FutureState | wait (int msecs=FutureTimeout_Infinite) const |
bool | isFinished () const |
isFinished More... | |
bool | isRunning () const |
isRunning More... | |
bool | isCanceled () const |
isCanceled More... | |
bool | hasError (int msecs=FutureTimeout_Infinite) const |
hasError More... | |
bool | hasValue (int msecs=FutureTimeout_Infinite) const |
hasValue More... | |
const std::string & | error (int msecs=FutureTimeout_Infinite) const |
error More... | |
FutureSync< T > | sync () |
void | cancel () |
bool | isCancelable () const |
template<typename AF > | |
void | connect (const AF &fun, FutureCallbackType type=FutureCallbackType_Async) |
template<typename FUNCTYPE , typename ARG0 > | |
void | connect (FUNCTYPE fun, ARG0 tracked,..., FutureCallbackType type=FutureCallbackType_Async) |
void | _connect (const boost::function< void()> &s) |
boost::shared_ptr < detail::FutureBaseTyped< T > > | impl () |
Future (boost::shared_ptr< detail::FutureBaseTyped< T > > p) | |
Protected Attributes | |
boost::shared_ptr < detail::FutureBaseTyped< T > > | _p |
Friends | |
class | Promise< T > |
class | FutureSync< T > |
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... | |
Definition at line 32 of file eventloop.hpp.
typedef boost::function<void (Future<T>) > qi::Future< T >::Connection |
Definition at line 262 of file future.hpp.
typedef FutureType<T>::type qi::Future< T >::ValueType |
Definition at line 131 of file future.hpp.
typedef FutureType<T>::typecast qi::Future< T >::ValueTypeCast |
Definition at line 132 of file future.hpp.
|
inline |
Definition at line 135 of file future.hpp.
|
inline |
Definition at line 140 of file future.hpp.
|
inlineexplicit |
Definition at line 159 of file future.hpp.
|
inline |
Definition at line 303 of file future.hpp.
|
inline |
Definition at line 300 of file future.hpp.
|
inline |
cancel() the asynchronous operation if possible Exact effect is controlled by the cancel implementation, but it is expected to set a value or an error to the Future as fast as possible. Note that cancelation may be asynchronous.
ExceptionState_FutureNotCancelable | if isCancelable() is false. |
Definition at line 250 of file future.hpp.
|
inline |
Connect a callback function that will be called once when the Future finishes (that is, switches from running to an other state).
If type is sync, connect may block and call the callback synchronously if the future is already set.
Definition at line 271 of file future.hpp.
void qi::Future< T >::connect | ( | FUNCTYPE | fun, |
ARG0 | tracked, | ||
..., | |||
FutureCallbackType | type = FutureCallbackType_Async |
||
) |
Connect a callback with binding and tracking support.
If the first argument is a weak_ptr or a pointer inheriting from qi::Trackable, the callback will not be called if tracked object was destroyed.
|
inline |
error
msecs |
Definition at line 236 of file future.hpp.
|
inline |
hasError
msecs | timeout |
Definition at line 218 of file future.hpp.
|
inline |
hasValue
msecs | timeout |
Definition at line 227 of file future.hpp.
|
inline |
Definition at line 302 of file future.hpp.
|
inline |
return true if the future can be canceled. This does not mean that cancel will succeed.
Definition at line 257 of file future.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
same as value() with an infinite timeout.
Definition at line 182 of file future.hpp.
|
inline |
Definition at line 155 of file future.hpp.
|
inline |
Definition at line 149 of file future.hpp.
|
inline |
Definition at line 144 of file future.hpp.
|
inline |
Definition at line 239 of file future.hpp.
|
inline |
Return the value associated to a Future.
msecs | timeout |
This function can throw for many reason:
if an error is set, then value throw a FutureUserException, others errors are FutureException.
Definition at line 178 of file future.hpp.
|
inline |
Wait for future to contain a value or an error
msecs | Maximum time to wait in milliseconds, 0 means return immediately. |
Definition at line 188 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.
|
friend |
Definition at line 312 of file future.hpp.
|
friend |
Definition at line 311 of file future.hpp.
|
protected |
Definition at line 310 of file future.hpp.