HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions
tt::notifier< Args > Class Template Reference

#include <TTauri/Foundation/notifier.hpp>

Public Types

using callback_type = std::function<void(Args const &...)>
 

Public Member Functions

size_t add (callback_type callback) noexcept
 Add a callback to the notifier.
 
size_t add_and_call (callback_type callback, Args const &... args) noexcept
 Add a callback to the notifier and invoke it.
 
void remove (size_t id) noexcept
 Remove a callback from the notifier.
 
void operator() (Args const &... args) const noexcept
 Call the registerd callbacks with the given arguments.
 

Detailed Description

template<typename... Args>
class tt::notifier< Args >

A notifier which can be used to call a set of registred callbacks.

This class is thread-safe; however you must not use this object from within the callback.

Template Parameters
ArgsThe argument types of the callback function.

Member Function Documentation

◆ add()

template<typename... Args>
size_t tt::notifier< Args >::add ( callback_type callback)
inlinenoexcept

Add a callback to the notifier.

Parameters
callbackThe callback to register.
Returns
An id used to unregister a callback from the notifier.

◆ add_and_call()

template<typename... Args>
size_t tt::notifier< Args >::add_and_call ( callback_type callback,
Args const &... args )
inlinenoexcept

Add a callback to the notifier and invoke it.

Parameters
callbackThe callback to register.
argsThe arguments to pass with the invocation of the callback
Returns
An id used to unregister a callback from the notifier.

◆ operator()()

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

Call the registerd callbacks with the given arguments.

Parameters
argsThe arguments to pass with the invocation of the callback

◆ remove()

template<typename... Args>
void tt::notifier< Args >::remove ( size_t id)
inlinenoexcept

Remove a callback from the notifier.

Parameters
idThe id returned from add() and add_and_call().

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