tec::EventSystem

More...

#include <event-system.hpp>

Public Functions

Name
std::shared_ptr< EventSystem< T > > Get()
~EventSystem()
void Subscribe(const eid entity_id, EventQueue< T > * subscriber)
Subscribes to be notified of events.
void Subscribe(EventQueue< T > * subscriber)
Subscribes to be notified of events for all entity IDs.
void Unsubscribe(const eid entity_id, EventQueue< T > * subscriber)
Unsubscribes to notification of events.
void Unsubscribe(EventQueue< T > * subscriber)
Unsubscribes to notification of events.
void Emit(const eid entity_id, std::shared_ptr< T > data)
Emits an event to subscribers for a given entity_id and to all subscribers listening for events for any entity_id.
void Emit(std::shared_ptr< T > data)
Emits an event to all subscribers listening for events for any entity_id.

Detailed Description

template <typename T >
class tec::EventSystem;

Public Functions Documentation

function Get

static inline std::shared_ptr< EventSystem< T > > Get()

function ~EventSystem

inline ~EventSystem()

function Subscribe

inline void Subscribe(
    const eid entity_id,
    EventQueue< T > * subscriber
)

Subscribes to be notified of events.

Parameters:

  • const unsigned int entity_id ID of the entity to subscribe to.
  • const EventQueue* subscriber The subscriber to add.

Return: void

function Subscribe

inline void Subscribe(
    EventQueue< T > * subscriber
)

Subscribes to be notified of events for all entity IDs.

Parameters:

  • const Receiver* subscriber The subscriber to add.

Return: void

function Unsubscribe

inline void Unsubscribe(
    const eid entity_id,
    EventQueue< T > * subscriber
)

Unsubscribes to notification of events.

Parameters:

  • const unsigned int entity_id ID of the entity to unsubscribe from.
  • const Receiver* subscriber The subscriber to remove.

Return: void

function Unsubscribe

inline void Unsubscribe(
    EventQueue< T > * subscriber
)

Unsubscribes to notification of events.

Parameters:

  • const Receiver* subscriber The subscriber to remove.

Return: void

function Emit

inline void Emit(
    const eid entity_id,
    std::shared_ptr< T > data
)

Emits an event to subscribers for a given entity_id and to all subscribers listening for events for any entity_id.

Parameters:

  • const unsigned int entity_id ID of the entity the event happen to.
  • const T* data The event data.

Return: void

function Emit

inline void Emit(
    std::shared_ptr< T > data
)

Emits an event to all subscribers listening for events for any entity_id.

Parameters:

  • const T* data The changed data.

Return: void


Updated on 2022-07-24 at 19:27:35 +0000