R-Type
Public Member Functions | List of all members
GameEngine::EventHandler< EventData > Class Template Reference

class that store all the callback functions for a specific event type More...

#include <Event.hpp>

Public Member Functions

 EventHandler (const EventType eventType)
 
void publish (EventData eventData)
 call all the subscribed functions with the given eventData More...
 
void publish ()
 call all the subscribed functions with no data (use when EventData == NoEventData) More...
 
template<typename Function >
void subscribe (const Function &function)
 register the given function to be called when the event is published More...
 

Detailed Description

template<typename EventData = NoEventData>
class GameEngine::EventHandler< EventData >

class that store all the callback functions for a specific event type

Template Parameters
EventDatatype of the data to send to subscribed functions when publishing events

Constructor & Destructor Documentation

◆ EventHandler()

template<typename EventData = NoEventData>
GameEngine::EventHandler< EventData >::EventHandler ( const EventType  eventType)
inline

Member Function Documentation

◆ publish() [1/2]

template<typename EventData = NoEventData>
void GameEngine::EventHandler< EventData >::publish ( )
inline

call all the subscribed functions with no data (use when EventData == NoEventData)

◆ publish() [2/2]

template<typename EventData = NoEventData>
void GameEngine::EventHandler< EventData >::publish ( EventData  eventData)
inline

call all the subscribed functions with the given eventData

Parameters
eventDatadata to be given to subscribed functions

◆ subscribe()

template<typename EventData = NoEventData>
template<typename Function >
void GameEngine::EventHandler< EventData >::subscribe ( const Function &  function)
inline

register the given function to be called when the event is published

Parameters
functionfunction to be registerer

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