26 #ifdef ONIXS_FIXENGINE_CXX11 34 class FutureSharedState;
53 namespace Implementation {
85 template<
typename ValueType>
94 return static_cast<const Type*
>(value)->value();
99 return new Type(value);
104 return create(value_);
109 explicit Value(
const ValueType & value) : value_(value) {}
111 const ValueType & value()
const {
return value_; }
113 const ValueType value_;
125 return state_ != ONIXS_FIXENGINE_NULLPTR;
152 #ifdef ONIXS_FIXENGINE_CXX11 180 #ifdef ONIXS_FIXENGINE_CXX11 208 const System::FutureSharedState * state_;
210 friend class FutureHelper;
252 template <
typename T>
261 : FutureBase(other) {}
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;
318 namespace Implementation {
338 #ifdef ONIXS_FIXENGINE_CXX11 378 template <
typename T>
388 : PromiseBase(other) {}
393 PromiseBase::operator=(other);
397 #ifdef ONIXS_FIXENGINE_CXX11 400 : PromiseBase(std::move(other)) {}
404 PromiseBase::operator=(std::move(other));
413 PromiseBase::swap(other);
418 return getTypedFuture<T>();
422 void set(
const T & value)
430 template<
typename ExceptionType>
454 : PromiseBase(other) {}
459 PromiseBase::operator=(other);
463 #ifdef ONIXS_FIXENGINE_CXX11 466 : PromiseBase(std::move(other)) {}
470 PromiseBase::operator=(std::move(other));
479 PromiseBase::swap(other);
484 return getTypedFuture<void>();
496 template<
typename ExceptionType>
SharedFuture(const SharedFuture< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy constructor.
SharedFuture< T > & operator=(const SharedFuture< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy assignment.
void swap(Promise< void > &other) ONIXS_FIXENGINE_NOTHROW
Swaps two Promise objects.
#define ONIXS_FIXENGINE_NOTHROW
#define ONIXS_FIXENGINE_DEFAULT
SharedFuture< T > getTypedFuture() const
Provides a facility to store a value or an exception that can be acquired asynchronously via a Shared...
Promise() ONIXS_FIXENGINE_NOTHROW
#define ONIXS_FIXENGINE_API
The base implementation of the SharedFuture<T>.
SharedFuture() ONIXS_FIXENGINE_NOTHROW
void setException(const ExceptionType &exception)
Sets the result to indicate an exception.
Promise< T > & operator=(const Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy assignment.
SharedFuture< T > getFuture() const
SharedFuture< void > getFuture() const
The state of a SharedFuture object (similar to std::future_status,.
The shared state did not become ready before the specified timeout duration has passed.
void swap(Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
Swaps two Promise objects.
bool valid() const ONIXS_FIXENGINE_NOTHROW
Check if a future instance is associated with an asynchronous result.
static const ValueType & value(const ValueBase *value)
The shared state is ready.
void swap(SharedFuture< T > &other) ONIXS_FIXENGINE_NOTHROW
swaps two SharedFuture objects
Promise() ONIXS_FIXENGINE_NOTHROW
The base implementation of the PromiseFuture<T>.
Promise(const Promise< void > &other) ONIXS_FIXENGINE_NOTHROW
The copy constructor.
ValueBase * value() const
Promise(const Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
The copy constructor.
Promise< void > & operator=(const Promise< void > &other) ONIXS_FIXENGINE_NOTHROW
The copy assignment.
Represents a future result of an asynchronous operation - a result that will eventually appear in the...
static ValueBase * create(const ValueType &value)
void setException(const ExceptionType &exception)
Sets the result to indicate an exception.
ValueBase * clone() const ONIXS_FIXENGINE_OVERRIDE