|
OSSIA
Open Scenario System for Interactive Application
|
A thread-safe index of a device's parameters, by OSC address. More...
Inherits Nano::Observer.
A thread-safe index of a device's parameters, by OSC address.
For protocols that receive on their own thread. find_node() cannot be used there: it locks each node only while reading its children, so nothing keeps the node it returns alive afterwards.
apply() holds a lock on the entry while the callback runs, and removals take the same lock - the device signals a removal before destroying the node, so a parameter cannot die under a running callback. The lock is per bucket group, not per map.
The callback must not add or remove nodes: re-entering the index deadlocks.
Public Member Functions | |
| device_parameter_index (ossia::net::device_base &dev) | |
| device_parameter_index (const device_parameter_index &)=delete | |
| device_parameter_index (device_parameter_index &&)=delete | |
| device_parameter_index & | operator= (const device_parameter_index &)=delete |
| device_parameter_index & | operator= (device_parameter_index &&)=delete |
| template<typename F > | |
| bool | apply (std::string_view address, F &&f) |
| void | clear () |
| std::size_t | size () const |
|
inline |
Run f on the parameter at address, if there is one. Returns whether there was.
|
inline |
Drop every entry. The owning protocol must call this before the device tears its tree down: it frees its children without signalling them.