OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::msgbus::future< T > Class Template Reference

Message bus future class. More...

#include <eagine/message_bus/future.hpp>

Public Member Functions

 future ()=default
 Default constructor.
 
 future (nothing_t) noexcept
 Constructs empty stateless future.
 
 operator bool () const noexcept
 Checks if the future has state (is associated with a promise).
 
template<typename R , typename P >
auto set_timeout (std::chrono::duration< R, P > dur) -> future< T > &
 Sets the timeout for this future if there is shared state.
 
auto on_success (const std::function< void(T)> &handler) -> future< T > &
 Sets the on-success handler. More...
 
auto on_timeout (const std::function< void()> &handler) -> future< T > &
 Sets the on-timeout handler. More...
 
template<typename Handler , typename = std::enable_if_t<std::is_invocable_v<Handler, T>>>
auto then (Handler handler) -> future< T > &
 Wraps the given handler object and sets it as the on-success handler. More...
 
template<typename Handler , typename = std::enable_if_t<std::is_invocable_v<Handler>>>
auto otherwise (Handler handler) -> future< T > &
 Wraps the given handler object and sets it as the on-timeout handler. More...
 
auto get_promise () -> promise< T >
 Returns the associated promise it there is shared state.
 

Detailed Description

template<typename T>
class eagine::msgbus::future< T >

Message bus future class.

See also
promise
pending_promises

Member Function Documentation

◆ on_success()

template<typename T >
auto eagine::msgbus::future< T >::on_success ( const std::function< void(T)> &  handler) -> future<T>&
inline

Sets the on-success handler.

See also
then
on_timeout

◆ on_timeout()

template<typename T >
auto eagine::msgbus::future< T >::on_timeout ( const std::function< void()> &  handler) -> future<T>&
inline

Sets the on-timeout handler.

See also
on_success

◆ otherwise()

template<typename T >
template<typename Handler , typename = std::enable_if_t<std::is_invocable_v<Handler>>>
auto eagine::msgbus::future< T >::otherwise ( Handler  handler) -> future<T>&
inline

Wraps the given handler object and sets it as the on-timeout handler.

See also
on_timeout
then

◆ then()

template<typename T >
template<typename Handler , typename = std::enable_if_t<std::is_invocable_v<Handler, T>>>
auto eagine::msgbus::future< T >::then ( Handler  handler) -> future<T>&
inline

Wraps the given handler object and sets it as the on-success handler.

See also
on_success
otherwise

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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).