Face Engine SDK 5.25.0
A face detection, recognition and tracking engine.
Loading...
Searching...
No Matches
fsdk::Promise< T > Class Template Reference

Promise class to support asynchronous data retrieval Look into std::promise semantics to understand it. More...

#include <Future.h>

Inheritance diagram for fsdk::Promise< T >:
fsdk::Noncopyable

Public Types

using Error = PromiseError
 Alias for associated error type.
 
using DataType = T
 Alias for stored data type.
 

Public Member Functions

 Promise () noexcept
 Constructor for empty Promise.
 
 Promise (Promise &&) noexcept
 
Promiseoperator= (Promise &&) noexcept
 
Result< Errorcancel () noexcept
 Cancel method. Think of it as acceptance of cancel requested by.
 
Result< Errorfail () noexcept
 Fail method. Think of it as valid failure to run some promised function. Only makes sense if underlying state is Promised.
 
Result< Errorfulfill (DataType &&promisedData) noexcept
 Fulfill promise with data. Only makes sense if underlying state is Promised.
 
Future< DataTypefuture (Result< Error > &error) noexcept
 Create tethered future object. Only makes sense if underlying state is Empty.
 
FuturePromiseState state () const noexcept
 Returns current state of future-promise pair.
 

Static Public Member Functions

static void swap (Promise &first, Promise &second) noexcept
 Static method that swaps internal data between two passed promises.
 

Detailed Description

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

Promise class to support asynchronous data retrieval Look into std::promise semantics to understand it.

Note
Is not instantiable using this header only.
Template Parameters
Tdata type to store.

Member Function Documentation

◆ cancel()

template<typename T >
Result< Error > fsdk::Promise< T >::cancel ( )
noexcept

Cancel method. Think of it as acceptance of cancel requested by.

See also
Future::cancel. Only makes sense if underlying state is CancelRequested.
Returns
Result type containing
See also
Error code.

◆ fail()

template<typename T >
Result< Error > fsdk::Promise< T >::fail ( )
noexcept

Fail method. Think of it as valid failure to run some promised function. Only makes sense if underlying state is Promised.

Returns
Result type containing
See also
Error code.

◆ fulfill()

template<typename T >
Result< Error > fsdk::Promise< T >::fulfill ( DataType && promisedData)
noexcept

Fulfill promise with data. Only makes sense if underlying state is Promised.

Parameters
promisedDataRvalue reference to promised data.
Returns
Result type containing
See also
Error code.

◆ future()

template<typename T >
Future< DataType > fsdk::Promise< T >::future ( Result< Error > & error)
noexcept

Create tethered future object. Only makes sense if underlying state is Empty.

Parameters
errorReference to error object to indicate of failure
Returns
Future object tethered to this promise.

◆ state()

template<typename T >
FuturePromiseState fsdk::Promise< T >::state ( ) const
noexcept

Returns current state of future-promise pair.

Returns
Current state
See also
FuturePromiseState.

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