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

Only native-type handles are supported: get_handle<T>() requires T to match the parameter’s stored type.

Note

REAL-TIME SAFEload() and store() are wait-free atomic operations with relaxed memory ordering.

Template Parameters:

T – Numeric type: double, float, int, or bool

Public Functions

ParameterHandle() = default#
inline T load() const#
inline void store(T value)#
inline bool is_valid() const#
inline const ParameterDefinition &def() const#
inline const Range &range() const#
inline std::string_view key() const#
inline uint32_t id() const#
inline ParameterType type() const#
inline uint32_t flags() const#