Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
EventsManager Class Reference

Manager for Events. More...

#include <event.h>

Public Member Functions

 EventsManager ()
 Construct a new Events Manager object.
 
 ~EventsManager ()
 Destroy the Events Manager object.
 
template<class T >
EventHandler< T >::subId subscribe (const typename EventHandler< T >::callbackType &callback)
 Subscribe to T event.
 
template<class T >
EventHandler< T >::subId subscribe (typename EventHandler< T >::callbackType &&callback)
 Subscribe to T event.
 
template<class T >
void unsubscribe (typename EventHandler< T >::subId subId)
 Unsubscribe to T event.
 
template<class T >
void fire (T &event)
 Fire T event.
 

Static Public Member Functions

static EventsManagerinst ()
 Gets the instance of the events manager.
 

Detailed Description

Manager for Events.

Member Function Documentation

◆ fire()

template<class T >
void EventsManager::fire ( T & event)
inline

Fire T event.

Fire event for all functions that are subscribed to it

Template Parameters
Tthe event
Parameters
eventthe event value

◆ inst()

EventsManager * EventsManager::inst ( )
static

Gets the instance of the events manager.

Returns
EventsManager* a pointer to the events manager

◆ subscribe() [1/2]

template<class T >
EventHandler< T >::subId EventsManager::subscribe ( const typename EventHandler< T >::callbackType & callback)
inline

Subscribe to T event.

Subscribes function to the event

Template Parameters
Tthe event to subscribe to
Parameters
callbackthe function to subscribe
Returns
EventHandler<T>::subId the handler used for unsuscribing

◆ subscribe() [2/2]

template<class T >
EventHandler< T >::subId EventsManager::subscribe ( typename EventHandler< T >::callbackType && callback)
inline

Subscribe to T event.

Subscribes an r-value function to the event

Template Parameters
Tthe event to subscribe to
Parameters
callbackthe r-value function to subscribe
Returns
EventHandler<T>::subId the handler used for unsuscribing

◆ unsubscribe()

template<class T >
void EventsManager::unsubscribe ( typename EventHandler< T >::subId subId)
inline

Unsubscribe to T event.

Unsuscribe to the event

Template Parameters
Tthe event to unsubscribe to
Parameters
subIdthe handler of the function

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