Loading...
Searching...
No Matches
o2_arg Union Reference
Basics

union of all O2 parameter types More...

`#include <o2.h>`

## Data Fields

int32_t | i32
| 32 bit signed integer.
int32_t | i
| an alias for i32
int64_t | i64
| 64 bit signed integer.
int64_t | h
| an alias for i64
float | f
| 32 bit IEEE-754 float.
float | f32
| an alias for f
double | d
| 64 bit IEEE-754 double.
double | f64
| an alias for d
char | s [4]
| Standard C, NULL terminated string.
char | S [4]
| Standard C, NULL terminated, string. Used in systems which distinguish strings and symbols.
int | c
| Standard C, 8 bit, char, stored as int.
uint32_t | m
o2_time | t
| TimeTag value.
o2_blob | b
| a blob (unstructured bytes)
int32_t | B
| a boolean value, either 0 or 1
struct { |
int32_t len |
| IMPORTANT: divide by 4 or 8 to get length in elements. More...
int32_t typ |
| type of vector elements
union { |
int32_t * vi |
| vector of 32-bit signed integers
int64_t * vh |
| vector of 64-bit signed integers
double * vd |
| vector of IEEE-754 doubles
float * vf |
| vector of IEEE-754 floats
} |  |
} | v |

## Detailed Description

union of all O2 parameter types

An o2_arg_ptr is a pointer to an O2 message argument. If argument parsing is requested (by setting the parse parameter in o2_method_new), then the handler receives an array of o2_arg_ptrs. If argument parsing is not requested, you have the option of parsing the message one parameter at a time by calling o2_get_next(), which returns an o2_arg_ptr.

The o2_arg_ptr can then be dereferenced to obtain a value of the expected type. For example, you could write

double d = o2_get_next()->d;
o2_get_next
o2_arg_ptr o2_get_next(o2_type type_code)
get the next message parameter
o2_arg::d
double d
64 bit IEEE-754 double.
Definition o2.h:540

to extract a parameter of type double. (This assumes that the message is properly formed and the type string indicates that this parameter is a double, or that type coercion was enabled by the coerce flag in o2_method_new().)

## Field Documentation

## len

int32_t len

IMPORTANT: divide by 4 or 8 to get length in elements.

length of vector in bytes

## m

uint32_t m

A 4 byte MIDI packet. MSB to LSB are port id, status, data1, data2

The documentation for this union was generated from the following file:

- src/o2.h