|
Real Time Open Sound Control librtosc
|
Collection of functions for ports. More...
#include <vector>#include <functional>#include <initializer_list>#include <rtosc/rtosc.h>#include <string>#include <cstdio>#include <iosfwd>Go to the source code of this file.
Classes | |
| struct | rtosc::RtData |
| data object for the dispatch routine More... | |
| struct | rtosc::Port |
| Port in rtosc dispatching hierarchy. More... | |
| class | rtosc::Port::MetaIterator |
| class | rtosc::Port::MetaContainer |
| struct | rtosc::Ports |
| Ports - a dispatchable collection of Port entries. More... | |
| struct | rtosc::ClonePort |
| struct | rtosc::ClonePorts |
| struct | rtosc::MergePorts |
| struct | rtosc::OscDocFormatter |
Typedefs | |
| typedef const char * | rtosc::msg_t |
| typedef void(* | rtosc::port_walker_t) (const Port *, const char *, const char *, const Ports &, void *, void *) |
| Function pointer type for port walking. | |
Enumerations | |
| enum class | rtosc::path_search_opts { unmodified , sorted , sorted_and_unique_prefix } |
| Options for path_search. More... | |
Functions | |
| int | rtosc::canonicalize_arg_vals (rtosc_arg_val_t *av, size_t n, const char *port_args, Port::MetaContainer meta) |
| Convert given argument values to their canonical representation. | |
| void | rtosc::map_arg_vals (rtosc_arg_val_t *av, size_t n, Port::MetaContainer meta) |
| Convert each of the given arguments to their mapped symbol, if possible. | |
| void | rtosc::walk_ports (const Ports *base, char *name_buffer, size_t buffer_size, void *data, port_walker_t walker, bool expand_bundles=true, void *runtime=NULL, bool ranges=false) |
| Call a function on all ports and subports. | |
| void | rtosc::path_search (const rtosc::Ports &root, const char *str, const char *needle, char *types, std::size_t max_types, rtosc_arg_t *args, std::size_t max_args, path_search_opts opts=path_search_opts::sorted_and_unique_prefix, bool reply_with_query=false) |
| Returns paths and metadata of all direct children of a port, or of the port itself if that port has no children. | |
| std::size_t | rtosc::path_search (const rtosc::Ports &root, const char *m, std::size_t max_ports, char *msgbuf, std::size_t bufsize, path_search_opts opts=path_search_opts::sorted_and_unique_prefix, bool reply_with_query=false) |
| Returns a messages of all paths and metadata of all direct children of a port, or of the port itself if that port has no children. | |
| int | rtosc::enum_key (Port::MetaContainer meta, const char *value) |
Return the index with value value from the metadata's enumeration. | |
| std::ostream & | rtosc::operator<< (std::ostream &o, OscDocFormatter &formatter) |
Collection of functions for ports.
This includes dispatchin, reading metadata etc.
| typedef void(* rtosc::port_walker_t) (const Port *, const char *, const char *, const Ports &, void *, void *) |
Function pointer type for port walking.
accepts:
|
strong |
Options for path_search.
Examples see path-search tests.
| int rtosc::canonicalize_arg_vals | ( | rtosc_arg_val_t * | av, |
| size_t | n, | ||
| const char * | port_args, | ||
| Port::MetaContainer | meta ) |
Convert given argument values to their canonical representation.
The ports first (or-wise) argument types are defined as canonical. E.g. if passing two 'S' argument values, the port could be portname::ii:cc:SS or portname::ii:t.
| av | The input and output argument values |
| n | The size of av |
| port_args | The port arguments string, e.g. i:c:s. The first non-colon letter sequence marks the canonical types |
| meta | The port's metadata container |
| int rtosc::enum_key | ( | Port::MetaContainer | meta, |
| const char * | value ) |
Return the index with value value from the metadata's enumeration.
| meta | The metadata |
| value | The value to search the key for |
std::numeric_limits<int>::min() if none was found | void rtosc::map_arg_vals | ( | rtosc_arg_val_t * | av, |
| size_t | n, | ||
| Port::MetaContainer | meta ) |
Convert each of the given arguments to their mapped symbol, if possible.
| av | The input and output argument values |
| n | The size of av |
| meta | The port's metadata container |
| std::size_t rtosc::path_search | ( | const rtosc::Ports & | root, |
| const char * | m, | ||
| std::size_t | max_ports, | ||
| char * | msgbuf, | ||
| std::size_t | bufsize, | ||
| path_search_opts | opts = path_search_opts::sorted_and_unique_prefix, | ||
| bool | reply_with_query = false ) |
Returns a messages of all paths and metadata of all direct children of a port, or of the port itself if that port has no children.
Your app should always have a port "path-search", calling this function directly, and replying the resulting buffer msgbuf directly. That way, it will be ready for oscprompt, port-checker etc.
| root | See m |
| m | a valid OSC message requesting the path search. The corresponding port args must be of types
|
| max_ports | Maximum number (or higher) of child ports in any of your app's ports. |
| msgbuf | Buffer for the reply message |
| bufsize | Size of the message buffer msgbuf |
| reply_with_query | Whether the reply message shall contain the two query strings in the beginning |
| void rtosc::path_search | ( | const rtosc::Ports & | root, |
| const char * | str, | ||
| const char * | needle, | ||
| char * | types, | ||
| std::size_t | max_types, | ||
| rtosc_arg_t * | args, | ||
| std::size_t | max_args, | ||
| path_search_opts | opts = path_search_opts::sorted_and_unique_prefix, | ||
| bool | reply_with_query = false ) |
Returns paths and metadata of all direct children of a port, or of the port itself if that port has no children.
If you just want to generate a reply message, use the overloaded function.
| root | see m |
| str | location under root to look up port, or empty-string to search directly at root |
| needle | Only port names starting with this string are returned (use empty-string or nullptr to match everything) |
| types | A buffer where the OSC type string is being written |
| max_types | should be max_args +1 for best performance, see max_args |
| args | An array where the argument values are being written |
| max_args | maximum number of arguments in array at args. Should be greater or equal than 2 * (maximum no. of child ports of your app's ports). |
| reply_with_query | Whether the reply message shall contain the two query strings in the beginning |
| void rtosc::walk_ports | ( | const Ports * | base, |
| char * | name_buffer, | ||
| size_t | buffer_size, | ||
| void * | data, | ||
| port_walker_t | walker, | ||
| bool | expand_bundles = true, | ||
| void * | runtime = NULL, | ||
| bool | ranges = false ) |
Call a function on all ports and subports.
| base | The base port of traversing |
| name_buffer | Buffer which will be filled with the port name; must be reset to zero over the full length! |
| buffer_size | Size of name_buffer |
| data | Data that should be available in the callback |
| walker | Callback function |
| expand_bundles | Whether walking over bundles without subports invokes walking over each of the bundle's port |
| runtime | Runtime object corresponding to base . If given, checks the runtime object will be used stop recursion if the Ports are disabled (using the "enabled by" property) and it will be passed to the walker |