CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::EntityEventDispatcher< E > Class Template Referencefinal

A type-safe event dispatcher implementation for events of type E. More...

#include <CeresEngine/Entity/EventDispatcher.hpp>

Inheritance diagram for CeresEngine::EntityEventDispatcher< E >:
CeresEngine::AbstractEntityEventDispatcher

Public Member Functions

void emit (const Entity &entity, const E &event) const
 Emits a event.
 
template<typename Subscriber >
WeakEventConnection subscribe (Subscriber &&subscriber)
 Subscribe a new subscriber of type Subscriber.
 
- Public Member Functions inherited from CeresEngine::AbstractEntityEventDispatcher
virtual ~AbstractEntityEventDispatcher ()=default
 Defaulted virtual destructor.
 

Private Attributes

UnsafeEvent< void(const Entity &, const E &)> mSignal
 A signal that effectively propagates the event.
 

Detailed Description

template<typename E>
class CeresEngine::EntityEventDispatcher< E >

A type-safe event dispatcher implementation for events of type E.

Template Parameters
Ethe event type

Member Function Documentation

◆ emit()

template<typename E >
void CeresEngine::EntityEventDispatcher< E >::emit ( const Entity entity,
const E event 
) const

Emits a event.

Parameters
entityThe entity that has emitted the event
eventThe event being emitted

◆ subscribe()

template<typename E >
template<typename Subscriber >
WeakEventConnection CeresEngine::EntityEventDispatcher< E >::subscribe ( Subscriber &&  subscriber)

Subscribe a new subscriber of type Subscriber.

Template Parameters
Subscriberthe subscriber type
Parameters
subscriberThe subscriber
Returns
A connection that can be used to disconnect the subscriber from the event dispatcher.

Member Data Documentation

◆ mSignal

A signal that effectively propagates the event.


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