Face Engine SDK  5.8.0
A face detection, recognition and tracking engine.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
fsdk::Future< T > Class Template Reference

Future class to support asynchronous data retrieval Look into std::future semantics to understand it. More...

#include <Future.h>

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

Public Types

using USec = int32_t
 Alias for micro seconds type.
 
using Error = FutureError
 Alias for associated error type.
 
using DataType = T
 Alias for stored data type.
 

Public Member Functions

 Future () noexcept
 Constructor for empty useless shell of a future.
 
 Future (Future &&mv) noexcept
 
Futureoperator= (Future &&) noexcept
 
Result< Errorcancel (const ExecutionPolicy policy) noexcept
 Cancel method. Might be called on some heavy long running task that is not needed anymore. Only makes sense if underlying state is Promised. More...
 
FuturePromiseState state () const noexcept
 Returns current state of future-promise pair. More...
 
Result< ErrortakeInto (DataType &container) noexcept
 Method to retrieve data out of fulfilled future. Only makes sense if current state is Fulfilled. More...
 
Result< Errorwait () const noexcept
 Blocks called thread until internal state changes to Fulfilled, Canceled or Failed. More...
 
Result< ErrorwaitFor (const USec usec) const noexcept
 Blocks called thread until internal state changes to Fulfilled, Canceled or Failed, OR passed time is over. More...
 

Static Public Member Functions

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

Detailed Description

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

Future class to support asynchronous data retrieval Look into std::future 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::Future< T >::cancel ( const ExecutionPolicy  policy)
noexcept

Cancel method. Might be called on some heavy long running task that is not needed anymore. Only makes sense if underlying state is Promised.

Parameters
policyPolicy on how to behave: block till state becomes Canceled or run async.
Returns
Result type containing
See Also
Error code.
template<typename T >
FuturePromiseState fsdk::Future< T >::state ( ) const
noexcept

Returns current state of future-promise pair.

Returns
Current state
See Also
FuturePromiseState.
template<typename T >
Result<Error> fsdk::Future< T >::takeInto ( DataType container)
noexcept

Method to retrieve data out of fulfilled future. Only makes sense if current state is Fulfilled.

Parameters
containerReference to DataType object to fill with future' data.
Returns
Result type containing
See Also
Error code.
template<typename T >
Result<Error> fsdk::Future< T >::wait ( ) const
noexcept

Blocks called thread until internal state changes to Fulfilled, Canceled or Failed.

Returns
Result type containing
See Also
Error code.
template<typename T >
Result<Error> fsdk::Future< T >::waitFor ( const USec  usec) const
noexcept

Blocks called thread until internal state changes to Fulfilled, Canceled or Failed, OR passed time is over.

Parameters
usecUpper bound of microseconds to wait.
Returns
Result type containing
See Also
Error code.

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