Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::EventSlot Struct Reference

Fixed-size container for a single event. More...

#include <Event.h>

Public Member Functions

template<typename T>
requires (DerivedFrom<Event, T>)
constexpr void Set (const T &event) noexcept
 Sets the payload of this slot to the given event.
template<typename T>
requires (DerivedFrom<Event, T>)
constexpr T & As () noexcept
 Casts the payload to the given event type.
template<typename T>
requires (DerivedFrom<Event, T>)
constexpr const T & As () const noexcept
 Casts the payload to the given event type (const version).
template<typename T>
requires (DerivedFrom<Event, T>)
constexpr bool Is () const noexcept
 Checks if the slot contains an event of the given type.
constexpr bool InCategory (u8 cat) const noexcept
 Checks if the event belongs to the given category.

Public Attributes

u8 Type
 Event type identifier.
u8 Category
 Event category bitmask.
cw_byte Padding [14]
 Padding to align Payload on 16-byte boundary.
cw_byte Payload [MaxEventPayloadSize]
 Raw storage for event data.

Detailed Description

Fixed-size container for a single event.

This structure stores an event's type, category, and raw payload in a tightly-packed, SIMD-aligned layout. Designed for zero-heap, high-performance event queues.

Member Function Documentation

◆ As() [1/2]

template<typename T>
requires (DerivedFrom<Event, T>)
const T & Raven::EventSlot::As ( ) const
inlineconstexprnoexcept

Casts the payload to the given event type (const version).

Template Parameters
TEvent type to cast to.
Returns
Const reference to the stored event.

◆ As() [2/2]

template<typename T>
requires (DerivedFrom<Event, T>)
T & Raven::EventSlot::As ( )
inlineconstexprnoexcept

Casts the payload to the given event type.

Template Parameters
TEvent type to cast to.
Returns
Reference to the stored event.

◆ InCategory()

bool Raven::EventSlot::InCategory ( u8 cat) const
inlineconstexprnoexcept

Checks if the event belongs to the given category.

Parameters
catCategory bitmask to check.
Returns
True if the event is in the category.

◆ Is()

template<typename T>
requires (DerivedFrom<Event, T>)
bool Raven::EventSlot::Is ( ) const
inlineconstexprnoexcept

Checks if the slot contains an event of the given type.

Template Parameters
TEvent type to check.
Returns
True if the type matches, false otherwise.

◆ Set()

template<typename T>
requires (DerivedFrom<Event, T>)
void Raven::EventSlot::Set ( const T & event)
inlineconstexprnoexcept

Sets the payload of this slot to the given event.

Template Parameters
TType of the event (must derive from Event and be trivially copyable).
Parameters
eventEvent instance to copy into the slot.

Member Data Documentation

◆ Category

u8 Raven::EventSlot::Category

Event category bitmask.

◆ Padding

cw_byte Raven::EventSlot::Padding[14]

Padding to align Payload on 16-byte boundary.

◆ Payload

cw_byte Raven::EventSlot::Payload[MaxEventPayloadSize]

Raw storage for event data.

◆ Type

u8 Raven::EventSlot::Type

Event type identifier.


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