class

EventDispatcher

Module
Events
Header
#include "Events/EventDispatcher.h"
Namespace
Mowo

Type aliases

AliasDescription
using EventCallback = std::function<void(Event&)>

Public functions

ReturnsNameDescription
uint64_tSubscribe
boolUnsubscribeA listener removed from inside its own dispatch is nulled in place and compacted after the walk — erasing mid-iteration invalidated the loop.
voidDispatch
boolDispatchType-filtered dispatch: runs func only when the event is a T.
voidClearClearing from inside a handler must not free the vector the dispatch walk is iterating — null the callbacks instead; the walk skips them and compacts its own type's vector afterwards.
voidClearClear listeners for a specific event type

Function details

Subscribe

C++
template<typename T> uint64_t Subscribe(std::function<void(T&)> callback)

Unsubscribe

C++
bool Unsubscribe(uint32_t typeID, uint64_t id)

A listener removed from inside its own dispatch is nulled in place and compacted after the walk — erasing mid-iteration invalidated the loop.

Dispatch

C++
void Dispatch(Event& event)

Dispatch

C++
template<typename T, typename F> bool Dispatch(Event& event, F&& func)

Type-filtered dispatch: runs func only when the event is a T.

Clear

C++
void Clear()

Clearing from inside a handler must not free the vector the dispatch walk is iterating — null the callbacks instead; the walk skips them and compacts its own type's vector afterwards.

Clear

C++
template<typename T> void Clear()

Clear listeners for a specific event type

Generated from Events/EventDispatcher.h via events.json · Oct 26, 2026Version 1.0.0