AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AComplexFutureOperation< T > Class Template Reference

Helper class to construct AFuture values. More...

#include <AUI/Thread/AComplexFutureOperation.h>

Classes#

class  NoValueException
 

Public Member Functions#

AFuture< T > makeFuture () noexcept
 Creates AFuture<T> object for this operation.
 
template<typename OtherT>
AComplexFutureOperationoperator<< (AFuture< OtherT > rhs)
 Adds a direct dependency on other AFuture<T>.
 
void supplyValue (T value)
 Pushes the result of operation to it's AFuture<T>.
 
void supplyException ()
 Pushes the result of operation to it's AFuture<T>.
 

Detailed Description#

template<typename T>
class AComplexFutureOperation< T >
Template Parameters
Tfuture type AFuture<T> (void is default)

AComplexFutureOperation is used to handle results and errors of multiple sequential futures.

AComplexFutureOperation is intended to construct a future with makeFuture(). makeFuture() must be called.

If AComplexFutureOperation get destroyed, it reports error to it's future if it does not have a result. AComplexFutureOperation should be carried with AFuture::onSuccess callbacks of other futures or any other callback-based structure, hence the destruction without result is treated as an error.

Member Function Documentation#

◆ makeFuture()#

template<typename T>
AFuture< T > AComplexFutureOperation< T >::makeFuture ( )
inlinenodiscardnoexcept

AFuture<T> can be created only once.

◆ operator<<()#

template<typename T>
template<typename OtherT>
AComplexFutureOperation & AComplexFutureOperation< T >::operator<< ( AFuture< OtherT > rhs)
inline
Parameters
rhsother future

Stores other AFuture to internal AAsyncHolder storage. Passes rhs's onError calls to AComplexFutureOperation's future, if it does not have result.

◆ supplyValue()#

template<typename T>
void AComplexFutureOperation< T >::supplyValue ( T value)
inline
Parameters
valueoperation