Face Engine SDK  5.25.0
A face detection, recognition and tracking engine.
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

List of all members.

Public Member Functions

 Promise () noexcept
 Constructor for empty Promise.
 Promise (Promise &&) noexcept
Promiseoperator= (Promise &&) noexcept
Result< Error > cancel () noexcept
 Cancel method. Think of it as acceptance of cancel requested by.
Result< Error > fail () noexcept
 Fail method. Think of it as valid failure to run some promised function. Only makes sense if underlying state is Promised.
Result< Error > fulfill (DataType &&promisedData) noexcept
 Fulfill promise with data. Only makes sense if underlying state is Promised.
Future< DataType > future (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

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

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 ( )

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)

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)

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

Returns current state of future-promise pair.

Returns:
Current state
See also:
FuturePromiseState.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines