OSSIA
Open Scenario System for Interactive Application
|
Various utilities to work with a node hierarchy.
Go to the source code of this file.
Namespaces | |
ossia | |
Functions | |
OSSIA_EXPORT ossia::net::node_base * | ossia::net::find_node (node_base &dev, std::string_view parameter_base) |
Find a node in a device. More... | |
OSSIA_EXPORT std::vector< ossia::net::node_base * > | ossia::net::find_nodes (node_base &dev, std::string_view pattern) |
Find all nodes matching a pattern in a device. More... | |
OSSIA_EXPORT node_base & | ossia::net::create_node (node_base &dev, std::string_view parameter_base) |
Create a node in a device. More... | |
OSSIA_EXPORT std::vector< ossia::net::node_base * > | ossia::net::create_nodes (node_base &dev, std::string_view pattern) |
Create nodes according to a brace-expansion-like mechanism. More... | |
OSSIA_EXPORT node_base & | ossia::net::find_or_create_node (node_base &dev, std::string_view parameter_base) |
Find a node and create it if it does not exist. More... | |
parameter_base * | ossia::net::find_or_create_parameter (node_base &node, std::string_view address, std::string_view type) |
OSSIA_EXPORT std::vector< parameter_base * > | ossia::net::find_parameter_or_create_node (node_base &node, std::string_view address, std::string_view type) |
Find a parameter and create it if it does not exist. More... | |
OSSIA_EXPORT node_base * | ossia::net::find_or_create_node (node_base &dev, std::string_view parameter_base, bool create) |
Calls find_node or create_node according to the value create | |
void | ossia::net::sanitize_name (std::string &name, const node_base::children_t &brethren) |
Get a valid name for a given node. | |
OSSIA_EXPORT ossia::value_with_unit | ossia::net::get_value (const ossia::destination &addr) |
Get the value associated with a destination. | |
OSSIA_EXPORT void | ossia::net::push_value (const ossia::destination &addr, const ossia::value_with_unit &) |
Send a value to a given destination. | |
template<typename Address > | |
auto | ossia::net::create_parameter (ossia::net::node_base &root, std::string name) |
template<typename Address > | |
auto | ossia::net::find_parameter_or_create_node (ossia::net::node_base &root, std::string_view name) |
OSSIA_EXPORT std::ostream & | ossia::net::operator<< (std::ostream &, const ossia::net::parameter_base &) |
OSSIA_EXPORT void | ossia::net::expand_ranges (std::string &str) |
OSSIA_EXPORT std::pair< std::vector< std::string >, bool > | ossia::net::expand_address (std::string address) |
OSSIA_EXPORT std::vector< ossia::net::node_base * > | ossia::net::list_all_children (ossia::net::node_base *node, unsigned int depth=0, bool sort=true) |
list_all_children : list all child nodes recursively More... | |
OSSIA_EXPORT void | ossia::net::list_all_children (ossia::net::node_base *node, std::vector< ossia::net::node_base * > &out, unsigned int depth, bool sort) |
OSSIA_EXPORT void | ossia::net::iterate_all_children (ossia::net::node_base *node, const std::function< void(ossia::net::parameter_base &)> &) |
Iterates all the child parameters given a base node. | |
OSSIA_EXPORT void | ossia::net::fuzzysearch (const std::vector< ossia::net::node_base * > &node, const std::vector< std::string > &patterns, std::vector< fuzzysearch_result > &results, fuzzysearch_options={}) |
OSSIA_EXPORT ossia::value_map_type | ossia::net::to_map (const ossia::net::node_base &n) noexcept |
Converts a node in a map of values. More... | |
OSSIA_EXPORT ossia::net::node_base* ossia::net::find_node | ( | node_base & | dev, |
std::string_view | parameter_base | ||
) |
Find a node in a device.
The address is in OSC format, e.g. /foo/bar.
OSSIA_EXPORT std::vector<ossia::net::node_base*> ossia::net::find_nodes | ( | node_base & | dev, |
std::string_view | pattern | ||
) |
Find all nodes matching a pattern in a device.
The address is in OSC pattern match format, e.g. /foo.[0-5]/bar*
OSSIA_EXPORT node_base& ossia::net::create_node | ( | node_base & | dev, |
std::string_view | parameter_base | ||
) |
Create a node in a device.
If the node already exists, a new instance will be created. Hence there is no guarantee that the created node name is the same than the one requested; the output should be checked.
OSSIA_EXPORT std::vector<ossia::net::node_base*> ossia::net::create_nodes | ( | node_base & | dev, |
std::string_view | pattern | ||
) |
Create nodes according to a brace-expansion-like mechanism.
Only [] and { } are possible. e.g. /foo/{bar,baz}.[0-9][0-9].
OSSIA_EXPORT node_base& ossia::net::find_or_create_node | ( | node_base & | dev, |
std::string_view | parameter_base | ||
) |
Find a node and create it if it does not exist.
If the node exists, it will be returned, else a new node will be created.
OSSIA_EXPORT std::vector<parameter_base*> ossia::net::find_parameter_or_create_node | ( | node_base & | node, |
std::string_view | address, | ||
std::string_view | type | ||
) |
Find a parameter and create it if it does not exist.
Find a node matching the address, if it already has a parameter create a new one (with name incremented by 1), if not create parameter It some matching nodes does not exist, they will be created with a parameter
node | |
address | |
type | of the parameter |
OSSIA_EXPORT std::vector<ossia::net::node_base*> ossia::net::list_all_children | ( | ossia::net::node_base * | node, |
unsigned int | depth = 0 , |
||
bool | sort = true |
||
) |
list_all_children : list all child nodes recursively
node | : starting point |
|
noexcept |
Converts a node in a map of values.
e.g. given the tree
then to_map(foo)
gives something more or less like:
map{ { "bar", 10 }, { "baz", map{ { "bux", vector{1.3, 5} } } } }