Shaka Player Embedded
|
#include <async_results.h>
Public Types | |
using | result_type = typename std::conditional< std::is_same< T, void >::value, monostate, T >::type |
using | variant_type = variant< result_type, Error > |
Public Member Functions | |
AsyncResults () | |
AsyncResults (std::shared_future< variant_type > future) | |
~AsyncResults () | |
bool | valid () const |
void | wait () |
template<typename Rep , typename Period > | |
std::future_status | wait_for (const std::chrono::duration< Rep, Period > &timeout_duration) const |
template<typename Clock , typename Duration > | |
std::future_status | wait_until (std::chrono::time_point< Clock, Duration > &timeout_time) const |
bool | has_error () const |
template<typename U = T, typename = typename std::enable_if< !std::is_same<U, void>::value>::type> | |
const U & | results () const |
const Error & | error () const |
This represents the results of an asynchronous operation. This type is similar to a std::future. This stores either the resulting value of the operation or the Error object that occurred. AsyncResults<void> don't have results and only store the optional error.
Unlike std::future, this will block the destructor until the operation finishes. This means that if you don't store the results in a variable, the function becomes synchronous.
Definition at line 46 of file async_results.h.
using shaka::AsyncResults< T >::result_type = typename std::conditional<std::is_same<T, void>::value, monostate, T>::type |
Definition at line 49 of file async_results.h.
using shaka::AsyncResults< T >::variant_type = variant<result_type, Error> |
Definition at line 50 of file async_results.h.
|
inline |
Creates an empty results object.
Definition at line 53 of file async_results.h.
|
inline |
Creates an object that will wrap the given std::shared_future.
Definition at line 56 of file async_results.h.
|
inline |
Definition at line 58 of file async_results.h.
|
inline |
Blocks until the results are available and returns the error object. This is only valid if there is an error.
Definition at line 124 of file async_results.h.
|
inline |
Blocks until the results are available and returns whether this contains an error.
Definition at line 106 of file async_results.h.
|
inline |
Blocks until the results are available and returns the response object. This is only valid if there isn't an error.
Definition at line 116 of file async_results.h.
|
inline |
Checks if the future refers to a shared state.
Definition at line 72 of file async_results.h.
|
inline |
Waits until the results are available.
Definition at line 77 of file async_results.h.
|
inline |
Waits for the results to be available, unless the given duration of time passes.
Definition at line 86 of file async_results.h.
|
inline |
Waits for the results to be available, unless it still isn't available when the given time happens.
Definition at line 96 of file async_results.h.