LMMS
Loading...
Searching...
No Matches
ports.cpp File Reference
#include "../ports.h"
#include "../rtosc.h"
#include "../pretty-format.h"
#include <cinttypes>
#include <ostream>
#include <cassert>
#include <limits>
#include <cstring>
#include <string>

Go to the source code of this file.

Classes

class  rtosc::Port_Matcher
class  CapturePretty
class  Capture
 RtData subclass to capture argument values from a runtime object. More...

Namespaces

namespace  rtosc

Macros

#define __has_feature(x)
#define __has_extension   __has_feature
#define __builtin_expect(a, b)

Typedefs

typedef std::vector< std::string > words_t
typedef std::vector< std::string > svec_t
typedef std::vector< const char * > cvec_t
typedef std::vector< intivec_t
typedef std::vector< inttuple_t
typedef std::vector< tuple_ttvec_t

Functions

static void scat (char *dest, const char *src)
void metaiterator_advance (const char *&title, const char *&value)
bool arg_matcher (const char *pattern, const char *args)
bool scmp (const char *a, const char *b)
tvec_t do_hash (const words_t &strs, const ivec_t &pos)
template<class T>
int count_dups (std::vector< T > &t)
template<class T, class Z>
bool has (T &t, Z &z)
static int int_max (int a, int b)
static ivec_t find_pos (words_t &strs)
static ivec_t do_hash (const words_t &strs, const ivec_t &pos, const ivec_t &assoc)
static ivec_t find_assoc (const words_t &strs, const ivec_t &pos)
static ivec_t find_remap (words_t &strs, ivec_t &pos, ivec_t &assoc)
static void generate_minimal_hash (std::vector< std::string > str, Port_Matcher &pm)
static void generate_minimal_hash (Ports &p, Port_Matcher &pm)
static const char * get_value_from_runtime (void *runtime, const Ports &ports, size_t loc_size, char *loc, char *buffer_with_port, std::size_t buffersize, int cols_used)
 Returns a port's value pretty-printed from a runtime object. The port object must not be known.
static size_t get_value_from_runtime (void *runtime, const Port &port, size_t loc_size, char *loc, const char *portname_from_base, char *buffer_with_port, std::size_t buffersize, std::size_t max_args, rtosc_arg_val_t *arg_vals)
 Returns a port's current value(s).
static msg_t snip (msg_t m)
static bool parent_path_p (char *read, char *start)
static void read_path (char *&r, char *start)
static void move_path (char *&r, char *&w, char *start)
bool port_is_enabled (const Port *port, char *loc, size_t loc_size, const Ports &base, void *runtime)
 Check if the port port is enabled.
void walk_ports2 (const rtosc::Ports *base, char *name_buffer, size_t buffer_size, void *data, rtosc::port_walker_t walker)
static void units (std::ostream &o, const char *u)
static int enum_min (Port::MetaContainer meta)
static int enum_max (Port::MetaContainer meta)
static ostream & add_options (ostream &o, Port::MetaContainer meta)
static ostream & dump_t_f_port (ostream &o, string name, string doc)
static ostream & dump_any_port (ostream &o, string name, string doc)
static ostream & dump_generic_port (ostream &o, string name, string doc, string type)
void dump_ports_cb (const rtosc::Port *p, const char *name, const char *, const Ports &, void *v, void *)

Macro Definition Documentation

◆ __builtin_expect

#define __builtin_expect ( a,
b )
Value:
uint8_t a
Definition Spc_Cpu.h:141

◆ __has_extension

#define __has_extension   __has_feature

◆ __has_feature

#define __has_feature ( x)
Value:
0

Typedef Documentation

◆ cvec_t

typedef std::vector<const char *> cvec_t

◆ ivec_t

typedef std::vector<int> ivec_t

◆ svec_t

typedef std::vector<std::string> svec_t

◆ tuple_t

typedef std::vector<int> tuple_t

◆ tvec_t

typedef std::vector<tuple_t> tvec_t

◆ words_t

typedef std::vector<std::string> words_t

Function Documentation

◆ add_options()

ostream & add_options ( ostream & o,
Port::MetaContainer meta )
static

◆ arg_matcher()

bool arg_matcher ( const char * pattern,
const char * args )
inline

◆ count_dups()

template<class T>
int count_dups ( std::vector< T > & t)

◆ do_hash() [1/2]

tvec_t do_hash ( const words_t & strs,
const ivec_t & pos )

◆ do_hash() [2/2]

ivec_t do_hash ( const words_t & strs,
const ivec_t & pos,
const ivec_t & assoc )
static

◆ dump_any_port()

ostream & dump_any_port ( ostream & o,
string name,
string doc )
static

◆ dump_generic_port()

ostream & dump_generic_port ( ostream & o,
string name,
string doc,
string type )
static

◆ dump_ports_cb()

void dump_ports_cb ( const rtosc::Port * p,
const char * name,
const char * ,
const Ports & ,
void * v,
void *  )

◆ dump_t_f_port()

ostream & dump_t_f_port ( ostream & o,
string name,
string doc )
static

◆ enum_max()

int enum_max ( Port::MetaContainer meta)
static

◆ enum_min()

int enum_min ( Port::MetaContainer meta)
static

◆ find_assoc()

ivec_t find_assoc ( const words_t & strs,
const ivec_t & pos )
static

◆ find_pos()

ivec_t find_pos ( words_t & strs)
static

◆ find_remap()

ivec_t find_remap ( words_t & strs,
ivec_t & pos,
ivec_t & assoc )
static

◆ generate_minimal_hash() [1/2]

void generate_minimal_hash ( Ports & p,
Port_Matcher & pm )
static

◆ generate_minimal_hash() [2/2]

void generate_minimal_hash ( std::vector< std::string > str,
Port_Matcher & pm )
static

◆ get_value_from_runtime() [1/2]

size_t get_value_from_runtime ( void * runtime,
const Port & port,
size_t loc_size,
char * loc,
const char * portname_from_base,
char * buffer_with_port,
std::size_t buffersize,
std::size_t max_args,
rtosc_arg_val_t * arg_vals )
static

Returns a port's current value(s).

This function returns the value(s) of a known port object and stores them as rtosc_arg_val_t.

Parameters
runtimeThe runtime object
portthe port where the value shall be retrieved
locA buffer where dispatch can write down the currently dispatched path
loc_sizeSize of loc
portname_from_baseThe name of the port, relative to its base
buffer_with_portA buffer which already contains the port. This buffer will be modified and must at least have space for 8 more bytes.
buffersizeSize of buffer_with_port
max_argsMaximum capacity of arg_vals
arg_valsArgument buffer for returned argument values
Returns
The number of argument values stored in arg_vals

◆ get_value_from_runtime() [2/2]

const char * get_value_from_runtime ( void * runtime,
const Ports & ports,
size_t loc_size,
char * loc,
char * buffer_with_port,
std::size_t buffersize,
int cols_used )
static

Returns a port's value pretty-printed from a runtime object. The port object must not be known.

For the parameters, see the overloaded function

Returns
The argument values, pretty-printed

◆ has()

template<class T, class Z>
bool has ( T & t,
Z & z )

◆ int_max()

int int_max ( int a,
int b )
static

◆ metaiterator_advance()

void metaiterator_advance ( const char *& title,
const char *& value )

◆ move_path()

void move_path ( char *& r,
char *& w,
char * start )
static

◆ parent_path_p()

bool parent_path_p ( char * read,
char * start )
static

◆ port_is_enabled()

bool port_is_enabled ( const Port * port,
char * loc,
size_t loc_size,
const Ports & base,
void * runtime )

Check if the port port is enabled.

Parameters
portThe port to be checked. Usually of type rRecur* or rSelf.
locThe absolute path of port
loc_sizeThe maximum usable size of loc
portsThe Ports object containing port
runtimeTODO
Returns
TODO

◆ read_path()

void read_path ( char *& r,
char * start )
static

◆ scat()

void scat ( char * dest,
const char * src )
inlinestatic

◆ scmp()

bool scmp ( const char * a,
const char * b )
inline

◆ snip()

msg_t snip ( msg_t m)
static

◆ units()

void units ( std::ostream & o,
const char * u )
static

◆ walk_ports2()

void walk_ports2 ( const rtosc::Ports * base,
char * name_buffer,
size_t buffer_size,
void * data,
rtosc::port_walker_t walker )