Face Engine SDK  4.6.0
A face detection, recognition and tracking engine.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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. More...
 
Result< Errorfail () noexcept
 Fail method. Think of it as valid failure to run some promised function. Only makes sense if underlying state is Promised. More...
 
Result< Errorfulfill (DataType &&promisedData) noexcept
 Fulfill promise with data. Only makes sense if underlying state is Promised. More...
 
Future< DataTypefuture (Result< Error > &error) noexcept
 Create tethered future object. Only makes sense if underlying state is Empty. More...
 
FuturePromiseState state () const noexcept
 Returns current state of future-promise pair. More...
 

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

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.
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.
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.
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.
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: