OSSIA
Open Scenario System for Interactive Application
|
Tools to create various kinds of values. More...
Tools to create various kinds of values.
The ossia_value_to_... family of functions expect that the actual value type is the one requested; anything else is undefined behaviour. Hence, use this only when you are sure because this is unsafe.
In contrast, the ossia_value_convert_... functions will try to do a meaningful conversion to get the type requested, which is safe, but much slower.
In short:
Functions | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_impulse () |
Create a value of type Impulse. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_int (int value) |
Create a value of type int. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_float (float value) |
Create a value of type float. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_2f (float v1, float v2) |
Create a value of type vec2f. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_3f (float v1, float v2, float v3) |
Create a value of type vec3f. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_4f (float v1, float v2, float v3, float v4) |
Create a value of type vec4f. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_bool (int value) |
Create a value of type bool. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_char (char value) |
Create a value of type char. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_string (const char *value) |
Create a value of type string. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_byte_array (const char *value, size_t size) |
Create a value of type string. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_list (const ossia_value_t *values, size_t size) |
Create a value of type list. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_in (const int *values, size_t size) |
Create a value of type list with only ints. More... | |
OSSIA_EXPORT ossia_value_t | ossia_value_create_fn (const float *values, size_t size) |
Create a value of type list with only floats. More... | |
OSSIA_EXPORT void | ossia_value_free (ossia_value_t value) |
Free the value. More... | |
OSSIA_EXPORT ossia_type | ossia_value_get_type (ossia_value_t type) |
Get the type of a value. More... | |
OSSIA_EXPORT int | ossia_value_to_int (ossia_value_t val) |
Get the value if it is an int. More... | |
OSSIA_EXPORT float | ossia_value_to_float (ossia_value_t val) |
Get the value if it is an float. More... | |
OSSIA_EXPORT struct ossia_vec2f | ossia_value_to_2f (ossia_value_t val) |
Get the value if it is a vec2f. More... | |
OSSIA_EXPORT struct ossia_vec3f | ossia_value_to_3f (ossia_value_t val) |
Get the value if it is a vec3f. More... | |
OSSIA_EXPORT struct ossia_vec4f | ossia_value_to_4f (ossia_value_t val) |
Get the value if it is a vec4f. More... | |
OSSIA_EXPORT int | ossia_value_to_bool (ossia_value_t val) |
Get the value if it is an bool. More... | |
OSSIA_EXPORT void | ossia_value_to_byte_array (ossia_value_t val, char **str, size_t *sz) |
Get the value if it is a byte array. More... | |
OSSIA_EXPORT const char * | ossia_value_to_string (ossia_value_t val) |
Get the value if it is a null-terminated string. More... | |
OSSIA_EXPORT void | ossia_value_to_list (ossia_value_t val_in, ossia_value_t **out, size_t *size) |
Get the value if it is a list. More... | |
OSSIA_EXPORT void | ossia_value_free_list (ossia_value_t *out) |
Free an array of values. | |
OSSIA_EXPORT void | ossia_value_to_fn (ossia_value_t val_in, float **out, size_t *size) |
Get the value if it is a list of floats. More... | |
OSSIA_EXPORT void | ossia_value_free_fn (float *out) |
Free an array of float. | |
OSSIA_EXPORT void | ossia_value_to_in (ossia_value_t val_in, int **out, size_t *size) |
Get the value if it is a list of ints. More... | |
OSSIA_EXPORT void | ossia_value_free_in (int *out) |
Free an array of int. | |
OSSIA_EXPORT int | ossia_value_convert_int (ossia_value_t val) |
Get the value as an int. More... | |
OSSIA_EXPORT float | ossia_value_convert_float (ossia_value_t val) |
Get the value as a float. More... | |
OSSIA_EXPORT int | ossia_value_convert_bool (ossia_value_t val) |
Get the value as a bool. More... | |
OSSIA_EXPORT char | ossia_value_convert_char (ossia_value_t val) |
Get the value as a char. More... | |
OSSIA_EXPORT void | ossia_value_convert_byte_array (ossia_value_t val, char **str, size_t *sz) |
Get the value as a byte array. More... | |
OSSIA_EXPORT void | ossia_value_convert_list (ossia_value_t val_in, ossia_value_t **out, size_t *size) |
Get the value as a list. More... | |
OSSIA_EXPORT struct ossia_vec2f | ossia_value_convert_2f (ossia_value_t val) |
Get the value as a vec2f. More... | |
OSSIA_EXPORT struct ossia_vec3f | ossia_value_convert_3f (ossia_value_t val) |
Get the value as a vec3f. More... | |
OSSIA_EXPORT struct ossia_vec4f | ossia_value_convert_4f (ossia_value_t val) |
Get the value as a vec4f. More... | |
OSSIA_EXPORT void | ossia_string_free (char *) |
OSSIA_EXPORT ossia_value_t ossia_value_create_impulse | ( | ) |
OSSIA_EXPORT ossia_value_t ossia_value_create_int | ( | int | value | ) |
OSSIA_EXPORT ossia_value_t ossia_value_create_float | ( | float | value | ) |
OSSIA_EXPORT ossia_value_t ossia_value_create_2f | ( | float | v1, |
float | v2 | ||
) |
OSSIA_EXPORT ossia_value_t ossia_value_create_3f | ( | float | v1, |
float | v2, | ||
float | v3 | ||
) |
OSSIA_EXPORT ossia_value_t ossia_value_create_4f | ( | float | v1, |
float | v2, | ||
float | v3, | ||
float | v4 | ||
) |
OSSIA_EXPORT ossia_value_t ossia_value_create_bool | ( | int | value | ) |
OSSIA_EXPORT ossia_value_t ossia_value_create_char | ( | char | value | ) |
OSSIA_EXPORT ossia_value_t ossia_value_create_string | ( | const char * | value | ) |
OSSIA_EXPORT ossia_value_t ossia_value_create_byte_array | ( | const char * | value, |
size_t | size | ||
) |
OSSIA_EXPORT ossia_value_t ossia_value_create_list | ( | const ossia_value_t * | values, |
size_t | size | ||
) |
Create a value of type list.
OSSIA_EXPORT ossia_value_t ossia_value_create_in | ( | const int * | values, |
size_t | size | ||
) |
Create a value of type list with only ints.
OSSIA_EXPORT ossia_value_t ossia_value_create_fn | ( | const float * | values, |
size_t | size | ||
) |
Create a value of type list with only floats.
OSSIA_EXPORT void ossia_value_free | ( | ossia_value_t | value | ) |
OSSIA_EXPORT ossia_type ossia_value_get_type | ( | ossia_value_t | type | ) |
OSSIA_EXPORT int ossia_value_to_int | ( | ossia_value_t | val | ) |
Get the value if it is an int.
OSSIA_EXPORT float ossia_value_to_float | ( | ossia_value_t | val | ) |
Get the value if it is an float.
OSSIA_EXPORT struct ossia_vec2f ossia_value_to_2f | ( | ossia_value_t | val | ) |
Get the value if it is a vec2f.
OSSIA_EXPORT struct ossia_vec3f ossia_value_to_3f | ( | ossia_value_t | val | ) |
Get the value if it is a vec3f.
OSSIA_EXPORT struct ossia_vec4f ossia_value_to_4f | ( | ossia_value_t | val | ) |
Get the value if it is a vec4f.
OSSIA_EXPORT int ossia_value_to_bool | ( | ossia_value_t | val | ) |
Get the value if it is an bool.
OSSIA_EXPORT void ossia_value_to_byte_array | ( | ossia_value_t | val, |
char ** | str, | ||
size_t * | sz | ||
) |
Get the value if it is a byte array.
Usage:
OSSIA_EXPORT const char* ossia_value_to_string | ( | ossia_value_t | val | ) |
Get the value if it is a null-terminated string.
OSSIA_EXPORT void ossia_value_to_list | ( | ossia_value_t | val_in, |
ossia_value_t ** | out, | ||
size_t * | size | ||
) |
Get the value if it is a list.
OSSIA_EXPORT void ossia_value_to_fn | ( | ossia_value_t | val_in, |
float ** | out, | ||
size_t * | size | ||
) |
Get the value if it is a list of floats.
OSSIA_EXPORT void ossia_value_to_in | ( | ossia_value_t | val_in, |
int ** | out, | ||
size_t * | size | ||
) |
Get the value if it is a list of ints.
OSSIA_EXPORT int ossia_value_convert_int | ( | ossia_value_t | val | ) |
Get the value as an int.
This function will do a best-effort conversion.
OSSIA_EXPORT float ossia_value_convert_float | ( | ossia_value_t | val | ) |
Get the value as a float.
This function will do a best-effort conversion.
OSSIA_EXPORT int ossia_value_convert_bool | ( | ossia_value_t | val | ) |
Get the value as a bool.
This function will do a best-effort conversion.
OSSIA_EXPORT char ossia_value_convert_char | ( | ossia_value_t | val | ) |
Get the value as a char.
This function will do a best-effort conversion.
OSSIA_EXPORT void ossia_value_convert_byte_array | ( | ossia_value_t | val, |
char ** | str, | ||
size_t * | sz | ||
) |
Get the value as a byte array.
This function will do a best-effort conversion.
OSSIA_EXPORT void ossia_value_convert_list | ( | ossia_value_t | val_in, |
ossia_value_t ** | out, | ||
size_t * | size | ||
) |
Get the value as a list.
This function will do a best-effort conversion.
OSSIA_EXPORT struct ossia_vec2f ossia_value_convert_2f | ( | ossia_value_t | val | ) |
Get the value as a vec2f.
This function will do a best-effort conversion.
OSSIA_EXPORT struct ossia_vec3f ossia_value_convert_3f | ( | ossia_value_t | val | ) |
Get the value as a vec3f.
This function will do a best-effort conversion.
OSSIA_EXPORT struct ossia_vec4f ossia_value_convert_4f | ( | ossia_value_t | val | ) |
Get the value as a vec4f.
This function will do a best-effort conversion.