Real Time Open Sound Control librtosc
|
Ports - a dispatchable collection of Port entries. More...
#include <ports.h>
Public Types | |
typedef std::vector< Port >::const_iterator | itr_t |
Public Member Functions | |
itr_t | begin () const |
Forwards to builtin container. | |
itr_t | end () const |
Forwards to builtin container. | |
size_t | size () const |
Forwards to builtin container. | |
const Port & | operator[] (unsigned i) const |
Forwards to builtin container. | |
Ports (std::initializer_list< Port > l) | |
Ports (const Ports &)=delete | |
void | dispatch (const char *m, RtData &d, bool base_dispatch=false) const |
Dispatches message to all matching ports. More... | |
const Port * | operator[] (const char *name) const |
Retrieve local port by name TODO implement full matching. | |
const Port * | apropos (const char *path) const |
Find the best match for a given path. More... | |
Static Public Member Functions | |
static char * | collapsePath (char *p) |
Collapse path with parent path identifiers "/..". More... | |
Public Attributes | |
std::vector< Port > | ports |
std::function< void(msg_t, RtData &)> | default_handler |
Protected Member Functions | |
void | refreshMagic (void) |
Ports - a dispatchable collection of Port entries.
This structure makes it somewhat easier to perform actions on collections of port entries and it is responsible for the dispatching of OSC messages to their respective ports. That said, it is a very simple structure, which uses a stl container to store all data in a simple dispatch table. All methods post-initialization are RT safe (assuming callbacks are RT safe)
const Port* rtosc::Ports::apropos | ( | const char * | path | ) | const |
Find the best match for a given path.
path | partial OSC path |
Example usage:
|
static |
Collapse path with parent path identifiers "/..".
e.g. /foo/bar/../baz => /foo/baz
void rtosc::Ports::dispatch | ( | const char * | m, |
RtData & | d, | ||
bool | base_dispatch = false |
||
) | const |
Dispatches message to all matching ports.
This uses simple pattern matching available in rtosc::match().
m | A valid OSC message. Note that the address part shall not contain any type specifier. |
d | The RtData object shall contain a path buffer (or null), the length of the buffer, a pointer to data. It must also contain the location if an answer is being expected. |
base_dispatch | Whether the OSC path is to be interpreted as a full OSC path beginning at the root |