26#ifdef ONIXS_FIXENGINE_CXX11
34 class FutureSharedState;
85template<
typename ValueType>
88 typedef Value<ValueType> Type;
94 return static_cast<const Type*
>(
value)->
value();
99 return new Type(
value);
109 explicit Value(
const ValueType & value) : value_(value) {}
111 const ValueType & value()
const {
return value_; }
113 const ValueType value_;
152#ifdef ONIXS_FIXENGINE_CXX11
180#ifdef ONIXS_FIXENGINE_CXX11
208 const
System::FutureSharedState * state_;
266 FutureBase::operator=(other);
270#ifdef ONIXS_FIXENGINE_CXX11
273 : FutureBase(std::move(other)) {}
277 FutureBase::operator=(std::move(other));
296 FutureBase::swap(other);
302 : FutureBase(state) {}
306 : FutureBase(state, t) {}
308 friend class Implementation::FutureHelper;
338#ifdef ONIXS_FIXENGINE_CXX11
393 PromiseBase::operator=(other);
397#ifdef ONIXS_FIXENGINE_CXX11
400 : PromiseBase(std::move(other)) {}
404 PromiseBase::operator=(std::move(other));
413 PromiseBase::swap(other);
430 template<
typename ExceptionType>
459 PromiseBase::operator=(other);
463#ifdef ONIXS_FIXENGINE_CXX11
466 : PromiseBase(std::move(other)) {}
470 PromiseBase::operator=(std::move(other));
479 PromiseBase::swap(other);
496 template<
typename ExceptionType>
#define ONIXS_FIXENGINE_API
#define ONIXS_FIXENGINE_DEFAULT
#define ONIXS_FIXENGINE_NULLPTR
#define ONIXS_FIXENGINE_NOTHROW
#define ONIXS_FIXENGINE_OVERRIDE
The base implementation of the SharedFuture<T>.
ONIXS_FIXENGINE_API void swap(FutureBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API FutureBase & operator=(const FutureBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API FutureBase(const FutureBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API bool hasException() const
Returns true if the asynchronous result associated with this Future has a stored exception,...
friend class FutureHelper
ONIXS_FIXENGINE_API ~FutureBase() ONIXS_FIXENGINE_NOTHROW
Destroys a future object.
ONIXS_FIXENGINE_API const FutureValue & getValue() const
ONIXS_FIXENGINE_API bool isReady() const
Returns true if the asynchronous result associated with this Future is ready (has a value or an excep...
ONIXS_FIXENGINE_API FutureStatus::Enum wait(int timeoutInMs=InfiniteTimeout) const
Waits for the result to become available during the timeout.
ONIXS_FIXENGINE_API bool hasValue() const
Returns true if the asynchronous result associated with this Future has a stored value,...
bool valid() const ONIXS_FIXENGINE_NOTHROW
Check if a future instance is associated with an asynchronous result.
ONIXS_FIXENGINE_API void getVoid() const
ONIXS_FIXENGINE_API FutureBase(const System::FutureSharedState *state) ONIXS_FIXENGINE_NOTHROW
Initializes the instance with shared state.
ONIXS_FIXENGINE_API FutureBase(const System::FutureSharedState *state, moving_init_t) ONIXS_FIXENGINE_NOTHROW
Initializes the instance with shared state.
FutureValue(ValueBase *value)
ValueBase * value() const
FutureValue(const FutureValue &other)
The base implementation of the PromiseFuture<T>.
bool valid()
Check if a future instance is associated with an asynchronous result.
ONIXS_FIXENGINE_API void setExceptionImpl()
ONIXS_FIXENGINE_API void setValue(ValueBase *value)
ONIXS_FIXENGINE_API PromiseBase() ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API ~PromiseBase() ONIXS_FIXENGINE_NOTHROW
Destroys a future object.
ONIXS_FIXENGINE_API void swap(PromiseBase &other) ONIXS_FIXENGINE_NOTHROW
SharedFuture< T > getTypedFuture() const
ONIXS_FIXENGINE_API SharedFuture< FutureValue > getFutureImpl() const
ONIXS_FIXENGINE_API PromiseBase & operator=(const PromiseBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API void setVoid()
virtual ValueBase * clone() const =0
virtual ~ValueBase() ONIXS_FIXENGINE_DEFAULT
static const ValueType & value(const ValueBase *value)
static ValueBase * create(const ValueType &value)
ValueBase * clone() const ONIXS_FIXENGINE_OVERRIDE
Promise() ONIXS_FIXENGINE_NOTHROW
Promise(const Promise< void > &other) ONIXS_FIXENGINE_NOTHROW
The copy constructor.
Promise< void > & operator=(const Promise< void > &other) ONIXS_FIXENGINE_NOTHROW
The copy assignment.
SharedFuture< void > getFuture() const
void set()
Sets the successful result to the given shared state.
void setException(const ExceptionType &exception)
Sets the result to indicate an exception.
void swap(Promise< void > &other) ONIXS_FIXENGINE_NOTHROW
Swaps two Promise objects.
Provides a facility to store a value or an exception that can be acquired asynchronously via a Shared...
void set(const T &value)
Sets the successful result value to the given shared state.
Promise() ONIXS_FIXENGINE_NOTHROW
Promise(const Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy constructor.
void swap(Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
Swaps two Promise objects.
Promise< T > & operator=(const Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy assignment.
void setException(const ExceptionType &exception)
Sets the result to indicate an exception.
SharedFuture< T > getFuture() const
Represents a future result of an asynchronous operation - a result that will eventually appear in the...
SharedFuture() ONIXS_FIXENGINE_NOTHROW
void swap(SharedFuture< T > &other) ONIXS_FIXENGINE_NOTHROW
swaps two SharedFuture objects
SharedFuture< T > & operator=(const SharedFuture< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy assignment.
SharedFuture(const SharedFuture< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy constructor.
Implementation::FutureGetReturn< T >::Type get() const
Returns the result.
The state of a SharedFuture object (similar to std::future_status,.
@ timeout
The shared state did not become ready before the specified timeout duration has passed.
@ ready
The shared state is ready.
@ deferred
The shared state contains a deferred function, so the result will be computed only when explicitly re...