Struct thl::ParameterRecord#
-
struct ParameterRecord#
Collaboration diagram for thl::ParameterRecord:
Consolidated per-parameter storage.
Each parameter gets one heap-allocated ParameterRecord, owned by State::m_storage via unique_ptr. The record holds everything about the parameter: immutable definition (type, range, flags, name, etc.), atomic cache for real-time value access, gesture state, and string value.
Fields are ordered for cache efficiency.
m_cacheis at offset 0 so that ParameterHandle::load() touches the first cache line of the allocation.alignas(64)onm_defguarantees the hot cache line contains onlym_cache(24 B), isolating it from non-RT writes tom_in_gesture/m_string_value(false-sharing prevention).- Cache-Line Layout
m_keyis a string_view pointing into the owning std::map node’s key. Set once after map insertion, never modified. Zero-cost, no duplication.m_defis const — the definition is immutable after construction. RCU publish in create() provides the happens-before guarantee — readers only see the record afterm_keyandm_defare fully initialized.Because AtomicCacheEntry is non-copyable/non-movable the record itself is non-copyable/non-movable — always accessed via pointer.
Public Functions
-
inline explicit ParameterRecord(ParameterDefinition def)#
-
ParameterRecord(const ParameterRecord&) = delete#
-
ParameterRecord &operator=(const ParameterRecord&) = delete#
Public Members
-
AtomicCacheEntry m_cache#
RT-hot: per-sample lock-free access (offset 0 for single cache line fetch)
-
const ParameterDefinition m_def#
Immutable definition (type, range, flags, name, etc.) alignas(64) ensures m_cache occupies its own cache line.
-
std::string_view m_key#
Identity (set once after map insertion, never modified)
-
std::atomic<bool> m_in_gesture = {false}#
Mutable runtime state (non-RT only, separate cache line from m_cache)
-
std::string m_string_value#