Class thl::ParameterHandle#
-
template<typename T>
class ParameterHandle# Lightweight handle for real-time safe per-sample parameter access.
Obtained via State::get_handle<T>(). Provides ~1–5 ns atomic load/store, bypassing the RCU path entirely. Only supports numeric types (double, float, int, bool).
Stores a ParameterRecord* internally, giving access to both the atomic cache and immutable metadata (definition, range, key, ID, flags) without any additional lookups.
A handle is valid as long as the owning State is alive and State::clear() has not been called. After clear() or State destruction, using a handle is undefined behaviour.
- Handle Lifetime
The atomic cache is the single source of truth for numeric values. Both State::set_in_root() and ParameterHandle::store() write to the same native-type atomic, so the state always stays in sync.
- Consistency
set_in_root() additionally fires listener notifications.
ParameterHandle::store() is silent (no notifications, no RCU update).
Only native-type handles are supported: get_handle<T>() requires T to match the parameter’s stored type.
Note
REAL-TIME SAFE — load() and store() are wait-free atomic operations with relaxed memory ordering.
- Template Parameters:
T – Numeric type: double, float, int, or bool