SML Variable operations. More...
Data Structures | |
struct | sml_variable |
struct | sml_variables_list |
Macros | |
#define | SML_VARIABLES_LIST_FOREACH(sml, list, len, var, i) |
Functions | |
struct sml_variable * | sml_get_input (struct sml_object *sml, const char *name) |
Get input variable by name. More... | |
struct sml_variables_list * | sml_get_input_list (struct sml_object *sml) |
Return the input variables list. More... | |
struct sml_variable * | sml_get_output (struct sml_object *sml, const char *name) |
Get input variable by name. More... | |
struct sml_variables_list * | sml_get_output_list (struct sml_object *sml) |
Return the output variables list. More... | |
struct sml_variable * | sml_new_input (struct sml_object *sml, const char *name) |
Create a new input variable. More... | |
struct sml_variable * | sml_new_output (struct sml_object *sml, const char *name) |
Create a new output variable. More... | |
bool | sml_remove_variable (struct sml_object *sml, struct sml_variable *variable) |
Remove a variable from the engine. More... | |
int | sml_variable_get_name (struct sml_object *sml, struct sml_variable *sml_variable, char *var_name, size_t var_name_size) |
Get sml_variable name. More... | |
bool | sml_variable_get_range (struct sml_object *sml, struct sml_variable *sml_variable, float *min, float *max) |
Get variable range. More... | |
float | sml_variable_get_value (struct sml_object *sml, struct sml_variable *sml_variable) |
Get the variable current value. More... | |
bool | sml_variable_is_enabled (struct sml_object *sml, struct sml_variable *variable) |
Check if a sml_variable is enabled. More... | |
int | sml_variable_set_enabled (struct sml_object *sml, struct sml_variable *variable, bool enabled) |
Enable or disable a variable. More... | |
bool | sml_variable_set_range (struct sml_object *sml, struct sml_variable *sml_variable, float min, float max) |
Set variable range. More... | |
bool | sml_variable_set_value (struct sml_object *sml, struct sml_variable *sml_variable, float value) |
Set the variable value. More... | |
bool | sml_variables_list_contains (struct sml_object *sml, struct sml_variables_list *list, struct sml_variable *var) |
Check if sml_variable is present in a sml_variables_list. More... | |
uint16_t | sml_variables_list_get_length (struct sml_object *sml, struct sml_variables_list *list) |
Get the sml_variables_list size. More... | |
struct sml_variable * | sml_variables_list_index (struct sml_object *sml, struct sml_variables_list *list, uint16_t index) |
Get sml_variable by index. More... | |
SML Variable operations.
#define SML_VARIABLES_LIST_FOREACH | ( | sml, | |
list, | |||
len, | |||
var, | |||
i | |||
) |
struct sml_variable* sml_get_input | ( | struct sml_object * | sml, |
const char * | name | ||
) |
Get input variable by name.
sml | The sml_object object. |
name | The variable name. |
NULL
on failure. struct sml_variables_list* sml_get_input_list | ( | struct sml_object * | sml | ) |
Return the input variables list.
sml | The sml_object object. |
NULL
on failure. struct sml_variable* sml_get_output | ( | struct sml_object * | sml, |
const char * | name | ||
) |
Get input variable by name.
sml | The sml_object object. |
name | The variable name. |
NULL
on failure. struct sml_variables_list* sml_get_output_list | ( | struct sml_object * | sml | ) |
Return the output variables list.
sml | The sml_object object. |
NULL
on failure. struct sml_variable* sml_new_input | ( | struct sml_object * | sml, |
const char * | name | ||
) |
Create a new input variable.
New input variables start with NAN set as value.
sml | The sml_object object. |
name | The variable name. If length is greater than SML_VARIABLE_NAME_MAX_LEN variable creation will fail. |
NULL
on failure. struct sml_variable* sml_new_output | ( | struct sml_object * | sml, |
const char * | name | ||
) |
Create a new output variable.
If its value can't be calculated in a sml_process execution, the value set on NAN will be used.
sml | The sml_object object. |
name | The variable name. If length is greater than SML_VARIABLE_NAME_MAX_LEN variable creation will fail. |
NULL
on failure. bool sml_remove_variable | ( | struct sml_object * | sml, |
struct sml_variable * | variable | ||
) |
Remove a variable from the engine.
sml | The sml_object object. |
variable | The sml_variable to be removed |
true
on success. false
on failure. int sml_variable_get_name | ( | struct sml_object * | sml, |
struct sml_variable * | sml_variable, | ||
char * | var_name, | ||
size_t | var_name_size | ||
) |
Get sml_variable name.
sml | The sml_object object. |
sml_variable | The sml_variable. |
var_name | Pointer to memory where name should be copied. |
var_name_size | Size of memory pointed by var_name. |
0
on success or error value. bool sml_variable_get_range | ( | struct sml_object * | sml, |
struct sml_variable * | sml_variable, | ||
float * | min, | ||
float * | max | ||
) |
Get variable range.
sml | The sml_object object. |
sml_variable | The sml_variable. |
min | Variable where min value will be set. If NULL it is ignored. |
max | Variable where max value will be set. If NULL it is ignored. |
true
on success. false
on failure. float sml_variable_get_value | ( | struct sml_object * | sml, |
struct sml_variable * | sml_variable | ||
) |
Get the variable current value.
sml | The sml_object object. |
sml_variable | The sml_variable |
true
on success. false
on failure. bool sml_variable_is_enabled | ( | struct sml_object * | sml, |
struct sml_variable * | variable | ||
) |
Check if a sml_variable is enabled.
sml | The sml_object object. |
variable | The sml_variable |
true
on success. false
on failure. int sml_variable_set_enabled | ( | struct sml_object * | sml, |
struct sml_variable * | variable, | ||
bool | enabled | ||
) |
Enable or disable a variable.
If a variable is disabled and is an input variable, its value will be ignored when trying to predict the values or training the engine. If it is an output variable, no prediction for this variable will be processed
sml | The sml_object object. |
variable | The sml_variable. |
enabled | true to enable, false to disable. |
true
on success. false
on failure. bool sml_variable_set_range | ( | struct sml_object * | sml, |
struct sml_variable * | sml_variable, | ||
float | min, | ||
float | max | ||
) |
Set variable range.
If max is NAN
, max value is not changed. If min is NAN
, min value is not changed.
sml | The sml_object object. |
sml_variable | The sml_variable. |
min | Variable's min value. |
max | Variable's max value |
true
on success. false
on failure. bool sml_variable_set_value | ( | struct sml_object * | sml, |
struct sml_variable * | sml_variable, | ||
float | value | ||
) |
Set the variable value.
sml | The sml_object object. |
sml_variable | The sml_variable |
value | The desired value. |
true
on success. false
on failure. bool sml_variables_list_contains | ( | struct sml_object * | sml, |
struct sml_variables_list * | list, | ||
struct sml_variable * | var | ||
) |
Check if sml_variable is present in a sml_variables_list.
sml | The sml_object object. |
list | The sml_variables_list. |
var | The sml_variable. |
true
it is present. false
is is not present. uint16_t sml_variables_list_get_length | ( | struct sml_object * | sml, |
struct sml_variables_list * | list | ||
) |
Get the sml_variables_list size.
sml | The sml_object Object. |
list | The sml_variables_list. |
struct sml_variable* sml_variables_list_index | ( | struct sml_object * | sml, |
struct sml_variables_list * | list, | ||
uint16_t | index | ||
) |
Get sml_variable by index.
sml | The sml_object object. |
list | The sml_variables_list. |
index | The list index. |
NULL
on failure..