class
Lapis::Core::StaticSignalTable
- Lapis::Core::StaticSignalTable
- Reference
- Object
Overview
Zero-allocation static signal dispatch table.
Stores all signal slots and listener records in pre-allocated flat Slice
pools with an intrusive free-list for recycled listener records.
Defined in:
lapis/core/static_signal_table.crConstant Summary
-
DEFAULT_MAX_LISTENERS =
4096 -
DEFAULT_MAX_SLOTS =
1024 -
FNV_OFFSET_BASIS =
14695981039346656037_u64 -
FNV_PRIME =
1099511628211_u64 -
MAX_STACK_SNAPSHOT =
64
Constructors
-
.current : StaticSignalTable
Alias for
StaticSignalTable.global. -
.global : StaticSignalTable
Global singleton dispatch table used by Lapis
TypedSignalandsignalmacros. - .new(max_slots : Int32 = DEFAULT_MAX_SLOTS, max_listeners : Int32 = DEFAULT_MAX_LISTENERS)
Class Method Summary
-
.combine_key(emitter_id : UInt64, signal_hash : UInt64) : UInt64
Mixes
(emitter_id, signal_hash)into a well-distributed 64-bit probe key. -
.fnv1a_64(name : String) : UInt64
Computes the 64-bit FNV-1a hash of a signal name with zero heap allocations.
- .hash_signal_name(name : String) : UInt64
-
.next_anonymous_emitter_id : UInt64
Generates a unique monotonic emitter ID for standalone
StaticSignalSlotinstances. -
.reset_global! : Void
Resets the global dispatch table state in-place without reallocating backing slices.
Instance Method Summary
-
#active_listener_count(emitter_id : UInt64, signal_name : String) : Int32
Returns the number of active listeners for
(emitter_id, signal_name). - #active_listener_count_by_hash(emitter_id : UInt64, signal_hash : UInt64) : Int32
- #active_listeners : Int32
- #active_slots : Int32
-
#bind(emitter_id : UInt64, signal_name : String, callback : Proc(*T, R), once : Bool = false, subscription : Godot::SignalSubscription | Nil = nil, match_proc_pointer : Pointer(Void) = Pointer(Void).null, match_closure_data : Pointer(Void) = Pointer(Void).null) : UInt64 forall T, R
Binds a compile-time typed
Proc(*T, R)to(emitter_id, signal_name). -
#bind_by_hash(emitter_id : UInt64, signal_hash : UInt64, callback : Proc(*T, R), once : Bool = false, subscription : Godot::SignalSubscription | Nil = nil, match_proc_pointer : Pointer(Void) = Pointer(Void).null, match_closure_data : Pointer(Void) = Pointer(Void).null) : UInt64 forall T, R
Binds a compile-time typed
Proc(*T, R)using a precomputedsignal_hash. -
#bind_raw(emitter_id : UInt64, signal_name : String, callback : Proc(UInt64, Pointer(Void), Int32, R), once : Bool = false) : UInt64 forall R
Binds a raw C-ABI / arena-staged callback
Proc(UInt64, Pointer(Void), Int32, R). -
#clear! : Void
Resets the entire table in-place with zero heap allocations.
-
#clear_emitter(emitter_id : UInt64) : Int32
Clears all signal slots and listeners associated with
emitter_id(as emitter or receiver). -
#clear_signal(emitter_id : UInt64, signal_name : String) : Int32
Clears all listeners registered for
(emitter_id, signal_name). - #connect(emitter_id : UInt64, signal_name : String, type0 : T0.class, type1 : T1.class, type2 : T2.class, type3 : T3.class, once : Bool = false, &block : T0, T1, T2, T3 -> Void) : UInt64 forall T0, T1, T2, T3
- #connect(emitter_id : UInt64, signal_name : String, type0 : T0.class, type1 : T1.class, once : Bool = false, &block : T0, T1 -> Void) : UInt64 forall T0, T1
- #connect(emitter_id : UInt64, signal_name : String, type0 : T0.class, type1 : T1.class, type2 : T2.class, once : Bool = false, &block : T0, T1, T2 -> Void) : UInt64 forall T0, T1, T2
-
#connect(emitter_id : UInt64, signal_name : String, once : Bool = false, &block : -> Void) : UInt64
Block-based typed connection helpers (0..4 arguments).
- #connect(emitter_id : UInt64, signal_name : String, type0 : T0.class, once : Bool = false, &block : T0 -> Void) : UInt64 forall T0
-
#emission_count(emitter_id : UInt64, signal_name : String) : UInt64
Returns the total number of emissions recorded for
(emitter_id, signal_name). - #emission_count_by_hash(emitter_id : UInt64, signal_hash : UInt64) : UInt64
-
#emit(emitter_id : UInt64, signal_name : String, *args : *T) : Int32 forall T
Emits a strongly-typed signal by name with strictly ZERO GC heap allocations.
-
#emit_by_hash(emitter_id : UInt64, signal_hash : UInt64, *args : *T) : Int32 forall T
Emits a strongly-typed signal using a precomputed 64-bit
signal_hashwith strictly ZERO GC heap allocations. -
#emit_payload(emitter_id : UInt64, signal_name : String, value : T, arena : FrameArena = FrameArena.current) : Int32 forall T
Stages
value : TintoFrameArena(linear frame scratchpad) and dispatches both typedProc(T, Void)listeners and rawRawSignalCallbacklisteners receiving the arena-allocated pointer andsizeof(T)with zero GC heap allocations. -
#emit_raw(emitter_id : UInt64, signal_name : String, payload_ptr : Pointer(Void) = Pointer(Void).null, payload_bytes : Int32 = 0) : Int32
Emits a raw pointer / byte-sized payload to all
RawSignalCallbacklisteners registered on(emitter_id, signal_name)with zero GC heap allocations. -
#emit_standalone_zero_arg(emitter_id : UInt64, signal_name : String) : Int32
Dispatches 0-arg listeners bound directly to
StaticSignalTable(without a mirroringSignalSubscription) when a signal is emitted via dynamicObject#emit_signal(name). -
#has_listeners?(emitter_id : UInt64, signal_name : String) : Bool
Returns
trueif(emitter_id, signal_name)has at least one active listener. - #listener_capacity : Int32
- #once(emitter_id : UInt64, signal_name : String, type0 : T0.class, type1 : T1.class, type2 : T2.class, type3 : T3.class, &block : T0, T1, T2, T3 -> Void) : UInt64 forall T0, T1, T2, T3
- #once(emitter_id : UInt64, signal_name : String, type0 : T0.class, type1 : T1.class, type2 : T2.class, &block : T0, T1, T2 -> Void) : UInt64 forall T0, T1, T2
- #once(emitter_id : UInt64, signal_name : String, type0 : T0.class, type1 : T1.class, &block : T0, T1 -> Void) : UInt64 forall T0, T1
- #once(emitter_id : UInt64, signal_name : String, type0 : T0.class, &block : T0 -> Void) : UInt64 forall T0
-
#once(emitter_id : UInt64, signal_name : String, &block : -> Void) : UInt64
One-shot block connection helpers (0..4 arguments).
- #slot(emitter_id : UInt64, signal_name : String, t0 : T0.class, t1 : T1.class, t2 : T2.class, t3 : T3.class) : StaticSignalSlot(T0, T1, T2, T3) forall T0, T1, T2, T3
- #slot(emitter_id : UInt64, signal_name : String, t0 : T0.class, t1 : T1.class, t2 : T2.class) : StaticSignalSlot(T0, T1, T2) forall T0, T1, T2
- #slot(emitter_id : UInt64, signal_name : String, t0 : T0.class, t1 : T1.class) : StaticSignalSlot(T0, T1) forall T0, T1
- #slot(emitter_id : UInt64, signal_name : String, t0 : T0.class) : StaticSignalSlot(T0) forall T0
-
#slot(emitter_id : UInt64, signal_name : String) : StaticSignalSlot()
Returns a typed
StaticSignalSlot(*T)handle bound to(emitter_id, signal_name). - #slot_capacity : Int32
-
#standalone_listener_count(emitter_id : UInt64, signal_name : String) : Int32
Returns the count of active listeners bound directly to
StaticSignalTablewithout a mirroringGodot::SignalSubscription. -
#stats : StaticSignalTableStats
Captures a value-type telemetry snapshot of the table.
- #total_emissions : UInt64
-
#unbind(token : UInt64) : Bool
Unbinds a listener by its 64-bit registration token.
-
#unbind_proc(emitter_id : UInt64, signal_name : String, proc_ptr : Pointer(Void), closure_ptr : Pointer(Void)) : Bool
Unbinds the most recently registered active listener matching
(proc_ptr, closure_ptr). -
#unbind_proc(emitter_id : UInt64, signal_name : String, callback : Proc(*T, R)) : Bool forall T, R
Unbinds the most recently registered active listener matching
callback. - #unbind_proc_by_hash(emitter_id : UInt64, signal_hash : UInt64, proc_ptr : Pointer(Void), closure_ptr : Pointer(Void)) : Bool
-
#unbind_proc_by_hash(emitter_id : UInt64, signal_hash : UInt64, callback : Proc(*T, R)) : Bool forall T, R
Unbinds the most recently registered active listener matching
callbackby precomputed hash. -
#unbind_subscription(sub : Godot::SignalSubscription) : Bool
Unbinds any listener associated with the given
Godot::SignalSubscription.
Instance methods inherited from class Object
try?(&)try? try?
Constructor Detail
Global singleton dispatch table used by Lapis TypedSignal and signal macros.
Class Method Detail
Mixes (emitter_id, signal_hash) into a well-distributed 64-bit probe key.
Computes the 64-bit FNV-1a hash of a signal name with zero heap allocations.
Generates a unique monotonic emitter ID for standalone StaticSignalSlot instances.
Resets the global dispatch table state in-place without reallocating backing slices.
Instance Method Detail
Returns the number of active listeners for (emitter_id, signal_name).
Binds a compile-time typed Proc(*T, R) to (emitter_id, signal_name).
Returns a unique 64-bit listener token that can be passed to #unbind.
Binds a compile-time typed Proc(*T, R) using a precomputed signal_hash.
Binds a raw C-ABI / arena-staged callback Proc(UInt64, Pointer(Void), Int32, R).
Clears all signal slots and listeners associated with emitter_id (as emitter or receiver).
Clears all listeners registered for (emitter_id, signal_name).
Block-based typed connection helpers (0..4 arguments).
Returns the total number of emissions recorded for (emitter_id, signal_name).
Emits a strongly-typed signal by name with strictly ZERO GC heap allocations. Returns the number of active listeners invoked.
Emits a strongly-typed signal using a precomputed 64-bit signal_hash
with strictly ZERO GC heap allocations.
Stages value : T into FrameArena (linear frame scratchpad) and dispatches
both typed Proc(T, Void) listeners and raw RawSignalCallback listeners
receiving the arena-allocated pointer and sizeof(T) with zero GC heap allocations.
Emits a raw pointer / byte-sized payload to all RawSignalCallback listeners
registered on (emitter_id, signal_name) with zero GC heap allocations.
Dispatches 0-arg listeners bound directly to StaticSignalTable (without a mirroring
SignalSubscription) when a signal is emitted via dynamic Object#emit_signal(name).
Returns true if (emitter_id, signal_name) has at least one active listener.
One-shot block connection helpers (0..4 arguments).
Returns the count of active listeners bound directly to StaticSignalTable
without a mirroring Godot::SignalSubscription.
Unbinds the most recently registered active listener matching (proc_ptr, closure_ptr).
Unbinds the most recently registered active listener matching callback.
Unbinds the most recently registered active listener matching callback by precomputed hash.
Unbinds any listener associated with the given Godot::SignalSubscription.