HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions
v1::notifier< Result(Args...)> Class Template Reference

Data Structures

class  awaiter_type
 An awaiter object which can wait on a notifier. More...
 

Public Types

using result_type = Result
 
using callback_proto = Result(Args...)
 
using function_type = std::function<callback_proto>
 
using callback_token = std::shared_ptr<function_type>
 
using weak_callback_token = std::weak_ptr<function_type>
 

Public Member Functions

constexpr notifier () noexcept=default
 Create a notifier.
 
constexpr notifier (notifier &&) noexcept=default
 
constexpr notifier (notifier const &) noexcept=default
 
constexpr notifieroperator= (notifier &&) noexcept=default
 
constexpr notifieroperator= (notifier const &) noexcept=default
 
awaiter_type operator co_await () const noexcept
 Create an awaiter that can await on this notifier.
 
callback_token subscribe (forward_of< callback_proto > auto &&callback, callback_flags flags=callback_flags::synchronous) noexcept
 Add a callback to the notifier.
 
template<typename F >
void loop_local_post_function (F &&) const noexcept
 
template<typename F >
void loop_main_post_function (F &&) const noexcept
 
template<typename F >
void loop_timer_post_function (F &&) const noexcept
 
void operator() (Args const &...args) const noexcept
 Call the subscribed callbacks with the given arguments.
 

Constructor & Destructor Documentation

◆ notifier()

template<typename Result , typename... Args>
constexpr v1::notifier< Result(Args...)>::notifier ( )
constexprdefaultnoexcept

Create a notifier.

Member Function Documentation

◆ operator co_await()

template<typename Result , typename... Args>
awaiter_type v1::notifier< Result(Args...)>::operator co_await ( ) const
inlinenoexcept

Create an awaiter that can await on this notifier.

◆ operator()()

template<typename Result , typename... Args>
void v1::notifier< Result(Args...)>::operator() ( Args const &... args) const
inlinenoexcept

Call the subscribed callbacks with the given arguments.

Note
This function is not reentrant.
Parameters
argsThe arguments to pass with the invocation of the callback

◆ subscribe()

template<typename Result , typename... Args>
callback_token v1::notifier< Result(Args...)>::subscribe ( forward_of< callback_proto > auto && callback,
callback_flags flags = callback_flags::synchronous )
inlinenoexcept

Add a callback to the notifier.

Ownership of the callback belongs with the caller of subscribe(). The caller will receive a token, a move-only RAII object that will unsubscribe the callback when the token is destroyed.

Parameters
flagsThe callback-flags used to determine how the callback is called.
callbackA function object to call when being notified.
Returns
A RAII object which when destroyed will unsubscribe the callback.

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