MillicastSDK 2.0.0
|
#include <promise.h>
Public Member Functions | |
Promise (std::unique_ptr< detail::PromiseImpl< T > > impl) | |
Promise (const Promise &)=delete | |
Promise (Promise &&)=delete | |
Promise & | operator= (const Promise &)=delete |
Promise & | operator= (Promise &&)=delete |
Promise< T > & | on_result (const typename detail::PromiseResultCbType< T >::Type &cb) |
Promise< T > & | on_error (const std::function< void(const Error &)> &cb) |
void | done () |
Represents a result of asynchronous operation performed by the client.
New subscriber and viewer APIs return Promise types to allow the caller to set up callbacks for the completion or failure of the operation. The Promise class stores the application-provided callbacks, and upon its destruction causes the callbacks to be set up for execution on the internal client's helper thread.
The callbacks set by the application will never be invoked until the Promise object is destroyed, and all will be invoked on the internal client's helper thread.
|
inline |
|
delete |
|
delete |
|
inline |
Triggers setting the current callbacks to the SDK internal operation as if the Promise object was destroyed.
Use this function if you capture promise rvalue reference in some wrapper, which may for example want to set the callbacks and then wait until done (to synchronise).
|
inline |
Sets the error callback, invoked when the operation represented by the promise fails.
cb | - the callback. |
|
inline |
Sets the result callback, invoked when the operation represented by the promise is complete with success.
cb | - the callback - std::function<void(T&&)>, or std::function<void()> if T=void. |
|
delete |
|
delete |