Overload  1.1
Game engine with editor
Public Types | Public Member Functions | List of all members
OvTools::Eventing::Event< ArgTypes > Class Template Reference

#include <Event.h>

Public Types

using Callback = std::function< void(ArgTypes...)>
 

Public Member Functions

ListenerID AddListener (Callback p_callback)
 
ListenerID operator+= (Callback p_callback)
 
bool RemoveListener (ListenerID p_listenerID)
 
bool operator-= (ListenerID p_listenerID)
 
void RemoveAllListeners ()
 
uint64_t GetListenerCount ()
 
void Invoke (ArgTypes... p_args)
 

Detailed Description

template<class... ArgTypes>
class OvTools::Eventing::Event< ArgTypes >

A simple event that contains a set of function callbacks. These functions will be called on invoke

Member Typedef Documentation

◆ Callback

template<class... ArgTypes>
using OvTools::Eventing::Event< ArgTypes >::Callback = std::function<void(ArgTypes...)>

Simple shortcut for a generic function without return value

Member Function Documentation

◆ AddListener()

template<class... ArgTypes>
ListenerID OvTools::Eventing::Event< ArgTypes >::AddListener ( Callback  p_callback)

Add a function callback to this event Also return the ID of the new listener (You should store the returned ID if you want to remove the listener later)

Parameters
p_call

◆ GetListenerCount()

template<class... ArgTypes>
uint64_t OvTools::Eventing::Event< ArgTypes >::GetListenerCount ( )

Return the number of callback registered

◆ Invoke()

template<class... ArgTypes>
void OvTools::Eventing::Event< ArgTypes >::Invoke ( ArgTypes...  p_args)

Call every callbacks attached to this event

Parameters
p_args(Variadic)

◆ operator+=()

template<class... ArgTypes>
ListenerID OvTools::Eventing::Event< ArgTypes >::operator+= ( Callback  p_callback)

Add a function callback to this event Also return the ID of the new listener (You should store the returned ID if you want to remove the listener later)

Parameters
p_call

◆ operator-=()

template<class... ArgTypes>
bool OvTools::Eventing::Event< ArgTypes >::operator-= ( ListenerID  p_listenerID)

Remove a function callback to this event using a Listener (Created when calling AddListener)

Parameters
p_listener

◆ RemoveAllListeners()

template<class... ArgTypes>
void OvTools::Eventing::Event< ArgTypes >::RemoveAllListeners ( )

Remove every listeners to this event

◆ RemoveListener()

template<class... ArgTypes>
bool OvTools::Eventing::Event< ArgTypes >::RemoveListener ( ListenerID  p_listenerID)

Remove a function callback to this event using a Listener (Created when calling AddListener)

Parameters
p_listener

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