libqi-api
2.0.6.8
|
#include <future.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. | |
operator const ValueTypeCast & () const | |
FutureState | wait (int msecs=FutureTimeout_Infinite) const |
bool | isFinished () const |
isFinished | |
bool | isRunning () const |
isRunning | |
bool | isCanceled () const |
isCanceled | |
bool | hasError (int msecs=FutureTimeout_Infinite) const |
hasError | |
bool | hasValue (int msecs=FutureTimeout_Infinite) const |
hasValue | |
const std::string & | error (int msecs=FutureTimeout_Infinite) const |
error | |
FutureSync< T > | sync () |
void | cancel () |
bool | isCancelable () const |
void | connect (const Connection &s) |
template<typename FUNCTYPE , typename ARG0 > | |
void | connect (FUNCTYPE fun, ARG0 tracked,...) |
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. |
Definition at line 129 of file future.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.
qi::Future< T >::Future | ( | ) | [inline] |
Definition at line 135 of file future.hpp.
qi::Future< T >::Future | ( | const Future< T > & | b | ) | [inline] |
Definition at line 140 of file future.hpp.
qi::Future< T >::Future | ( | const ValueType & | v, |
FutureCallbackType | async = FutureCallbackType_Async |
||
) | [inline, explicit] |
Definition at line 159 of file future.hpp.
qi::Future< T >::Future | ( | boost::shared_ptr< detail::FutureBaseTyped< T > > | p | ) | [inline] |
Definition at line 293 of file future.hpp.
void qi::Future< T >::_connect | ( | const boost::function< void()> & | s | ) | [inline] |
Definition at line 290 of file future.hpp.
void qi::Future< T >::cancel | ( | ) | [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.
void qi::Future< T >::connect | ( | const Connection & | s | ) | [inline] |
Connect a callback function that will be called once when the Future finishes (that is, switches from running to an other state.
Definition at line 267 of file future.hpp.
void qi::Future< T >::connect | ( | FUNCTYPE | fun, |
ARG0 | tracked, | ||
... | |||
) |
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.
const std::string& qi::Future< T >::error | ( | int | msecs = FutureTimeout_Infinite | ) | const [inline] |
error
msecs |
Definition at line 236 of file future.hpp.
bool qi::Future< T >::hasError | ( | int | msecs = FutureTimeout_Infinite | ) | const [inline] |
hasError
msecs | timeout |
Definition at line 218 of file future.hpp.
bool qi::Future< T >::hasValue | ( | int | msecs = FutureTimeout_Infinite | ) | const [inline] |
hasValue
msecs | timeout |
Definition at line 227 of file future.hpp.
boost::shared_ptr<detail::FutureBaseTyped<T> > qi::Future< T >::impl | ( | ) | [inline] |
Definition at line 292 of file future.hpp.
bool qi::Future< T >::isCancelable | ( | ) | const [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.
bool qi::Future< T >::isCanceled | ( | ) | const [inline] |
bool qi::Future< T >::isFinished | ( | ) | const [inline] |
bool qi::Future< T >::isRunning | ( | ) | const [inline] |
qi::Future< T >::operator const ValueTypeCast & | ( | ) | const [inline] |
same as value() with an infinite timeout.
Definition at line 182 of file future.hpp.
bool qi::Future< T >::operator< | ( | const Future< T > & | b | ) | const [inline] |
Definition at line 155 of file future.hpp.
Future<T>& qi::Future< T >::operator= | ( | const Future< T > & | b | ) | [inline] |
Definition at line 149 of file future.hpp.
bool qi::Future< T >::operator== | ( | const Future< T > & | other | ) | [inline] |
Definition at line 144 of file future.hpp.
FutureSync<T> qi::Future< T >::sync | ( | ) | [inline] |
Definition at line 239 of file future.hpp.
const ValueType& qi::Future< T >::value | ( | int | msecs = FutureTimeout_Infinite | ) | const [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.
FutureState qi::Future< T >::wait | ( | int | msecs = FutureTimeout_Infinite | ) | const [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.
void adaptFuture | ( | const Future< FT > & | f, |
Promise< PT > & | p | ||
) | [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 314 of file future.hxx.
void adaptFuture | ( | const Future< FT > & | f, |
Promise< PT > & | p, | ||
CONV | converter | ||
) | [friend] |
Similar to adaptFuture(f, p) but with a custom converter.
Definition at line 324 of file future.hxx.
friend class FutureSync< T > [friend] |
Definition at line 302 of file future.hpp.
friend class Promise< T > [friend] |
Definition at line 301 of file future.hpp.
boost::shared_ptr< detail::FutureBaseTyped<T> > qi::Future< T >::_p [protected] |
Definition at line 300 of file future.hpp.