#include <Runtime/Core/Public/Events.h>
template<typename Ret, bool Fixed, size_t MaxBinds = 16, typename... Args>
MultiCallback struct
Multi-binding delegate — dispatches to MaxBinds simultaneous listeners.
| Template parameters | |
|---|---|
| Ret | Return type (typically void for multicast use). |
| Fixed | true for fixed-size in-place storage, false for dynamic. |
| MaxBinds | Capacity (Fixed) or growth increment (dynamic). |
| Args | Argument types forwarded to all bindings on invocation. |
Two storage strategies selected at compile time:
Fixed=true— bindings stored in astd::array; trivially copyable, no heap.Fixed=false— bindings stored in astd::vector; grows dynamically.
Public types
Constructors, destructors, conversion operators
- __attribute__((always_inline)) const
- Invoke all bound listeners in registration order.
Public functions
-
template<typename T, Ret(T::*)(Args...) MemFn>void Bind(T* obj)
- Bind a member function to the next available slot.
-
void BindStatic(typename CB::
Fn fn, void* ctx = nullptr) - Bind a free function or thunk to the next available slot.
-
template<typename T, Ret(T::*)(Args...) MemFn>void Unbind(T* obj)
- Remove the first binding that matches
objandMemFn. -
void UnbindStatic(typename CB::
Fn fn, void* ctx = nullptr) - Remove the first static binding that matches
fnandctx. - void UnbindByContext(void* ctx)
- Remove all bindings whose context pointer equals
ctx. - void Reset()
- Clear all bindings.
- auto IsBound() const -> bool
- Returns true if at least one slot is currently bound.
Public variables
- MultiCallbackStorage<CB, Fixed, MaxBinds> Bindings
Function documentation
template<typename Ret, bool Fixed, size_t MaxBinds, typename... Args>
template<typename T, Ret(T::*)(Args...) MemFn>
void MultiCallback<Ret, Fixed, MaxBinds, Args>:: Bind(T* obj)
Bind a member function to the next available slot.
template<typename Ret, bool Fixed, size_t MaxBinds, typename... Args>
void MultiCallback<Ret, Fixed, MaxBinds, Args>:: BindStatic(typename CB:: Fn fn,
void* ctx = nullptr)
Bind a free function or thunk to the next available slot.
template<typename Ret, bool Fixed, size_t MaxBinds, typename... Args>
void MultiCallback<Ret, Fixed, MaxBinds, Args>:: UnbindByContext(void* ctx)
Remove all bindings whose context pointer equals ctx.