4#include "AAsyncHolder.h"
30 AUI_ASSERTX(mFutureStrongReference.inner() ==
nullptr,
"makeFuture() is not called. Please check docs");
31 if (
auto f = mFutureWeakReference.lock()) {
32 if (!(*f)->hasResult()) {
34 throw NoValueException();
36 (*f)->reportException();
49 auto r = std::move(mFutureStrongReference);
50 AUI_ASSERT(mFutureStrongReference.inner() ==
nullptr);
61 template<
typename OtherT>
64 if (
auto f = weakRef.lock()) {
65 if ((*f)->hasResult()) {
71 (*f)->reportException();
75 mAsyncHolder << std::move(rhs);
84 if (
auto l = mFutureWeakReference.lock()) {
86 std::unique_lock lock(inner->mutex);
87 inner->value = std::move(value);
88 inner->cv.notify_all();
89 inner->notifyOnSuccessCallback(lock);
97 if (
auto l = mFutureWeakReference.lock()) {
99 inner->reportException();
Holds a set of futures keeping them valid.
Definition: AAsyncHolder.h:30
Definition: AComplexFutureOperation.h:22
Helper class to construct AFuture values.
Definition: AComplexFutureOperation.h:20
AComplexFutureOperation & operator<<(AFuture< OtherT > rhs)
Adds a direct dependency on other AFuture<T>.
Definition: AComplexFutureOperation.h:62
void supplyException()
Pushes the result of operation to it's AFuture<T>.
Definition: AComplexFutureOperation.h:96
void supplyValue(T value)
Pushes the result of operation to it's AFuture<T>.
Definition: AComplexFutureOperation.h:83
AFuture< T > makeFuture() noexcept
Creates AFuture<T> object for this operation.
Definition: AComplexFutureOperation.h:48
Abstract AUI exception.
Definition: AException.h:29
Represents a value that will be available at some point in the future.
Definition: AFuture.h:620
const AFuture & onError(Callback &&callback) const noexcept
Add onError callback to the future.
Definition: AFuture.h:723
#define AUI_ASSERT(condition)
Asserts that the passed condition evaluates to true.
Definition: Assert.h:55
#define AUI_ASSERTX(condition, what)
Asserts that the passed condition evaluates to true. Adds extra message string.
Definition: Assert.h:74
An std::weak_ptr with AUI extensions.
Definition: SharedPtrTypes.h:51