Toast Engine
Loading...
Searching...
No Matches
event::EventSystem Struct Reference

Internal dispatch table for the event system. More...

#include <event.hpp>

Classes

struct  EventInfo
 Per-type callback registry. More...

Static Public Member Functions

static void unsubscribeAny (std::type_index type, const std::any &iterator)
 Unsubscribes a callback of the given type.
template<typename T>
static auto info () noexcept -> EventInfo &
template<typename T>
static void registerEvent ()

Static Public Attributes

static std::unordered_map< std::type_index, EventInfo > event_data
 Dispatch table keyed by event type; one entry per registered event type.
static std::shared_mutex registration_mutex
 Guards event_data and unsubscribe_map.
static std::mutex pool_mutex
 Protects the event queue memory pool during concurrent sends.
static std::unordered_map< std::type_index, std::function< void(std::any)> > unsubscribe_map
 Type-erased unsubscribe functions keyed by event type; used by Listener to erase iterators without the concrete type.
static std::vector< std::unique_ptr< void, void(*)(void *)> > deletion_queue
static std::mutex deletion_mutex
 Protects the event queue memory pool during concurrent sends.

Detailed Description

Internal dispatch table for the event system.

One EventInfo entry exists per registered event type. Do not use this struct directly; go through Listener::subscribe() to register callbacks and event::send() to enqueue events.

Member Data Documentation

◆ deletion_queue

std::vector< std::unique_ptr< void, void(*)(void *)> > event::EventSystem::deletion_queue
static

Deferred-delete queue; callbacks that unsubscribed during pollEvents are freed here on the next call to avoid invalidating the processing vector mid-dispatch


The documentation for this struct was generated from the following files:
  • engine/src/toast/events/event.hpp
  • engine/src/toast/events/event.cpp
  • engine/src/toast/events/event.inl