Maipa's Standard Library Extension 1.5.6
mstd
Loading...
Searching...
No Matches
mstd::event_handler< Args > Class Template Reference

#include <event_handler.hpp>

Inheritance diagram for mstd::event_handler< Args >:
[legend]
Collaboration diagram for mstd::event_handler< Args >:
[legend]

Public Types

using event_type = void(Args&&...)
using event_action_handler = action_t<Args&&...>
using events_type = stable_vector<event_action_handler>
using id_type = _MSTD_TYPENAME17 events_type::size_type

Public Member Functions

_MSTD_CONSTEXPR20 event_handler () noexcept=default
_MSTD_CONSTEXPR20 ~event_handler () noexcept=default
_MSTD_CONSTEXPR20 id_type add_callback (const event_action_handler &callback)
_MSTD_CONSTEXPR20 bool remove_callback (const id_type callbackId)
_MSTD_CONSTEXPR20 void remove_all_callbacks ()
template<class... InvokeArgs>
_MSTD_CONSTEXPR20 void invoke (InvokeArgs &&... args) const
_MSTD_CONSTEXPR20 id_type operator+= (const event_action_handler &callback)
_MSTD_CONSTEXPR20 bool operator-= (const id_type callbackId)
template<class... InvokeArgs>
_MSTD_CONSTEXPR20 void operator() (InvokeArgs &&... args) const

Private Attributes

events_type _events = {}

Member Typedef Documentation

◆ event_action_handler

template<class... Args>
using mstd::event_handler< Args >::event_action_handler = action_t<Args&&...>

◆ event_type

template<class... Args>
using mstd::event_handler< Args >::event_type = void(Args&&...)

◆ events_type

template<class... Args>
using mstd::event_handler< Args >::events_type = stable_vector<event_action_handler>

◆ id_type

template<class... Args>
using mstd::event_handler< Args >::id_type = _MSTD_TYPENAME17 events_type::size_type

Constructor & Destructor Documentation

◆ event_handler()

template<class... Args>
_MSTD_CONSTEXPR20 mstd::event_handler< Args >::event_handler ( )
defaultnoexcept

◆ ~event_handler()

template<class... Args>
_MSTD_CONSTEXPR20 mstd::event_handler< Args >::~event_handler ( )
defaultnoexcept

Member Function Documentation

◆ add_callback()

template<class... Args>
_MSTD_CONSTEXPR20 id_type mstd::event_handler< Args >::add_callback ( const event_action_handler & callback)
inline

◆ invoke()

template<class... Args>
template<class... InvokeArgs>
_MSTD_CONSTEXPR20 void mstd::event_handler< Args >::invoke ( InvokeArgs &&... args) const
inline

◆ operator()()

template<class... Args>
template<class... InvokeArgs>
_MSTD_CONSTEXPR20 void mstd::event_handler< Args >::operator() ( InvokeArgs &&... args) const
inline

◆ operator+=()

template<class... Args>
_MSTD_CONSTEXPR20 id_type mstd::event_handler< Args >::operator+= ( const event_action_handler & callback)
inline

◆ operator-=()

template<class... Args>
_MSTD_CONSTEXPR20 bool mstd::event_handler< Args >::operator-= ( const id_type callbackId)
inline

◆ remove_all_callbacks()

template<class... Args>
_MSTD_CONSTEXPR20 void mstd::event_handler< Args >::remove_all_callbacks ( )
inline

◆ remove_callback()

template<class... Args>
_MSTD_CONSTEXPR20 bool mstd::event_handler< Args >::remove_callback ( const id_type callbackId)
inline

Member Data Documentation

◆ _events

template<class... Args>
events_type mstd::event_handler< Args >::_events = {}
private