cesium-native  0.41.0
CesiumAsync::Promise< T > Class Template Reference

A promise that can be resolved or rejected by an asynchronous task. More...

#include <CesiumAsync/Promise.h>

Public Member Functions

void resolve (T &&value) const
 Will be called when the task completed successfully. More...
 
void resolve (const T &value) const
 Will be called when the task completed successfully. More...
 
template<typename TException >
void reject (TException error) const
 Will be called when the task failed. More...
 
void reject (const std::exception_ptr &error) const
 Will be called when the task failed. More...
 
Future< T > getFuture () const
 Gets the Future that resolves or rejects when this Promise is resolved or rejected. More...
 

Friends

class AsyncSystem
 

Detailed Description

template<typename T>
class CesiumAsync::Promise< T >

A promise that can be resolved or rejected by an asynchronous task.

Template Parameters
TThe type of the object that the promise will be resolved with.

Definition at line 18 of file Promise.h.

Member Function Documentation

◆ getFuture()

template<typename T >
Future<T> CesiumAsync::Promise< T >::getFuture ( ) const
inline

Gets the Future that resolves or rejects when this Promise is resolved or rejected.

This method may only be called once.

Returns
The future.

Definition at line 61 of file Promise.h.

◆ reject() [1/2]

template<typename T >
void CesiumAsync::Promise< T >::reject ( const std::exception_ptr &  error) const
inline

Will be called when the task failed.

Parameters
errorThe error, captured with std::current_exception, that caused the task to fail.

Definition at line 49 of file Promise.h.

◆ reject() [2/2]

template<typename T >
template<typename TException >
void CesiumAsync::Promise< T >::reject ( TException  error) const
inline

Will be called when the task failed.

Parameters
errorThe error that caused the task to fail.

Definition at line 39 of file Promise.h.

◆ resolve() [1/2]

template<typename T >
void CesiumAsync::Promise< T >::resolve ( const T &  value) const
inline

Will be called when the task completed successfully.

Parameters
valueThe value that was computed by the asynchronous task.

Definition at line 32 of file Promise.h.

◆ resolve() [2/2]

template<typename T >
void CesiumAsync::Promise< T >::resolve ( T &&  value) const
inline

Will be called when the task completed successfully.

Parameters
valueThe value that was computed by the asynchronous task.

Definition at line 25 of file Promise.h.


The documentation for this class was generated from the following file: