LMMS
Loading...
Searching...
No Matches
rtosc::Ports Struct Reference

#include <ports.h>

Inheritance diagram for rtosc::Ports:
rtosc::ClonePorts rtosc::MergePorts

Public Types

typedef std::vector< Port >::const_iterator itr_t

Public Member Functions

itr_t begin () const
itr_t end () const
size_t size () const
const Portoperator[] (unsigned i) const
 Ports (std::initializer_list< Port > l)
 ~Ports (void)
 Ports (const Ports &)=delete
void dispatch (const char *m, RtData &d, bool base_dispatch=false) const
const Portoperator[] (const char *name) const
const Portapropos (const char *path) const

Static Public Member Functions

static char * collapsePath (char *p)

Public Attributes

std::vector< Portports
std::function< void(msg_t, RtData &)> default_handler

Protected Member Functions

void refreshMagic (void)

Private Attributes

class Port_Matcherimpl
unsigned elms

Detailed Description

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)

Member Typedef Documentation

◆ itr_t

typedef std::vector<Port>::const_iterator rtosc::Ports::itr_t

Constructor & Destructor Documentation

◆ Ports() [1/2]

Ports::Ports ( std::initializer_list< Port > l)

◆ ~Ports()

Ports::~Ports ( void )

◆ Ports() [2/2]

rtosc::Ports::Ports ( const Ports & )
delete

Member Function Documentation

◆ apropos()

const Port * Ports::apropos ( const char * path) const

Find the best match for a given path

@parameter path partial OSC path

Returns
first path prefixed by the argument

Example usage:

Ports p = {{"foo",0,0,dummy_method},
{"flam",0,0,dummy_method},
{"bar",0,0,dummy_method}};
p.apropos("/b")->name;//bar
p.apropos("/f")->name;//foo
p.apropos("/fl")->name;//flam
p.apropos("/gg");//NULL
Ports(std::initializer_list< Port > l)
Definition ports.cpp:501
uch * p
Definition crypt.c:594

◆ begin()

itr_t rtosc::Ports::begin ( ) const
inline

Forwards to builtin container

◆ collapsePath()

char * Ports::collapsePath ( char * p)
static

Collapse path with parent path identifiers "/.."

e.g. /foo/bar/../baz => /foo/baz

◆ dispatch()

void Ports::dispatch ( const char * m,
rtosc::RtData & d,
bool base_dispatch = false ) const

Dispatches message to all matching ports. This uses simple pattern matching available in rtosc::match.

Parameters
mA valid OSC message. Note that the address part shall not contain any type specifier.
dThe 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_dispatchWhether the OSC path is to be interpreted as a full OSC path beginning at the root

◆ end()

itr_t rtosc::Ports::end ( ) const
inline

Forwards to builtin container

◆ operator[]() [1/2]

const Port * Ports::operator[] ( const char * name) const

Retrieve local port by name TODO implement full matching

◆ operator[]() [2/2]

const Port & rtosc::Ports::operator[] ( unsigned i) const
inline

Forwards to builtin container

◆ refreshMagic()

void Ports::refreshMagic ( void )
protected

◆ size()

size_t rtosc::Ports::size ( ) const
inline

Forwards to builtin container

Member Data Documentation

◆ default_handler

std::function<void(msg_t, RtData&)> rtosc::Ports::default_handler

◆ elms

unsigned rtosc::Ports::elms
private

◆ impl

class Port_Matcher* rtosc::Ports::impl
private

◆ ports

std::vector<Port> rtosc::Ports::ports

The documentation for this struct was generated from the following files: