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

Data Structures

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

Public Types

using result_type = R
 
using callback_proto = R(Args...)
 
using callback_type = callback<R(Args...)>
 
using weak_callback_type = weak_callback<R(Args...)>
 

Public Member Functions

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

Constructor & Destructor Documentation

◆ notifier()

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

Create a notifier.

Member Function Documentation

◆ operator co_await()

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

Create an awaiter that can await on this notifier.

◆ operator()()

template<typename R , typename... Args>
void v1::notifier< R(Args...)>::operator() ( Args... 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 R , typename... Args>
template<forward_of< callback_proto > Func>
callback_type v1::notifier< R(Args...)>::subscribe ( Func && func,
callback_flags flags = callback_flags::synchronous )
inlinenoexcept

Add a callback to the notifier.

After the call the caller will take ownership of the returned callback object.

The callback object is a move-only RAII object that will automatically 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: