| Face Engine SDK 4.9.0 A face detection, recognition and tracking engine.

Public Types | Public Member Functions | Static Public Member Functions | List of all members
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 >:

## 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
Promise & | operator= (Promise &&) noexcept
Result< Error > | cancel () noexcept
| Cancel method. Think of it as acceptance of cancel requested by. More...
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. More...
Result< Error > | fulfill (DataType &&promisedData) noexcept
| Fulfill promise with data. Only makes sense if underlying state is Promised. More...
Future< DataType > | future (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

  T | data 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

  promisedData | Rvalue 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

  error | Reference 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:

- include/fsdk/Types/Future.h