FMI Library: part of JModelica.org
Functions
Handling of variable lists

Variable lists are provided to handle sets of variables. More...

Functions

fmi2_import_variable_list_tfmi2_import_alloc_variable_list (fmi2_import_t *fmu, size_t size)
 Allocate an empty list. More...
 
FMILIB_EXPORT void fmi2_import_free_variable_list (fmi2_import_variable_list_t *vl)
 Free a variable list. Note that variable lists are allocated dynamically and must be freed when not needed any longer. More...
 
FMILIB_EXPORT fmi2_import_variable_list_tfmi2_import_clone_variable_list (fmi2_import_variable_list_t *vl)
 Make a copy of the list. More...
 
FMILIB_EXPORT size_t fmi2_import_get_variable_list_size (fmi2_import_variable_list_t *vl)
 Get number of variables in a list. More...
 
FMILIB_EXPORT const fmi2_value_reference_t * fmi2_import_get_value_referece_list (fmi2_import_variable_list_t *vl)
 Get a pointer to the list of the value references for all the variables. More...
 
FMILIB_EXPORT fmi2_import_variable_tfmi2_import_get_variable (fmi2_import_variable_list_t *vl, size_t index)
 Get a single variable from the list. More...
 

Operations on variable lists. Every operation creates a new list.

typedef int(* fmi2_import_variable_filter_function_ft) (fmi2_import_variable_t *vl, void *data)
 Callback function typedef for the fmiFilterVariables. More...
 
FMILIB_EXPORT fmi2_import_variable_list_tfmi2_import_get_sublist (fmi2_import_variable_list_t *vl, size_t fromIndex, size_t toIndex)
 Select sub-lists. More...
 
FMILIB_EXPORT fmi2_import_variable_list_tfmi2_import_filter_variables (fmi2_import_variable_list_t *vl, fmi2_import_variable_filter_function_ft filter, void *context)
 Call the provided 'filter' function on every variable in the list and create a new list. More...
 
FMILIB_EXPORT fmi2_import_variable_list_tfmi2_import_join_var_list (fmi2_import_variable_list_t *a, fmi2_import_variable_list_t *b)
 Create a new variable list by concatenating two lists. More...
 
FMILIB_EXPORT fmi2_import_variable_list_tfmi2_import_append_to_var_list (fmi2_import_variable_list_t *vl, fmi2_import_variable_t *v)
 Append a variable to the variable list. More...
 
FMILIB_EXPORT fmi2_import_variable_list_tfmi2_import_prepend_to_var_list (fmi2_import_variable_list_t *vl, fmi2_import_variable_t *v)
 Prepend a variable to the variable list. More...
 
FMILIB_EXPORT jm_status_enu_t fmi2_import_var_list_push_back (fmi2_import_variable_list_t *vl, fmi2_import_variable_t *v)
 Add a variable to a variable list. More...
 

Detailed Description

Variable lists are provided to handle sets of variables.

Note that variable lists are allocated dynamically and must be freed when not needed any longer.

Typedef Documentation

typedef int(* fmi2_import_variable_filter_function_ft) (fmi2_import_variable_t *vl, void *data)

Callback function typedef for the fmiFilterVariables.

The function should return 0 to prevent a variable from coming to the output list.

Definition at line 81 of file fmi2_import_variable_list.h.

Function Documentation

fmi2_import_variable_list_t* fmi2_import_alloc_variable_list ( fmi2_import_t fmu,
size_t  size 
)

Allocate an empty list.

FMILIB_EXPORT void fmi2_import_free_variable_list ( fmi2_import_variable_list_t vl)

Free a variable list. Note that variable lists are allocated dynamically and must be freed when not needed any longer.

Parameters
vlA variable list.
FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_clone_variable_list ( fmi2_import_variable_list_t vl)

Make a copy of the list.

Parameters
vlA variable list.
FMILIB_EXPORT size_t fmi2_import_get_variable_list_size ( fmi2_import_variable_list_t vl)

Get number of variables in a list.

FMILIB_EXPORT const fmi2_value_reference_t* fmi2_import_get_value_referece_list ( fmi2_import_variable_list_t vl)

Get a pointer to the list of the value references for all the variables.

FMILIB_EXPORT fmi2_import_variable_t* fmi2_import_get_variable ( fmi2_import_variable_list_t vl,
size_t  index 
)

Get a single variable from the list.

FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_get_sublist ( fmi2_import_variable_list_t vl,
size_t  fromIndex,
size_t  toIndex 
)

Select sub-lists.

Parameters
vlA variable list.
fromIndexZero based start index, inclusive.
toIndexZero based end index, inclusive.
Returns
A sublist. NULL is returned if toIndex is less than fromIndex or is larger than the list size or if memory allocation failed.
FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_filter_variables ( fmi2_import_variable_list_t vl,
fmi2_import_variable_filter_function_ft  filter,
void *  context 
)

Call the provided 'filter' function on every variable in the list and create a new list.

Parameters
vlA variable list.
filterA filter function according to fmi2_import_variable_filter_function_ft.
contextA parameter to be forwarded to the filter function.
Returns
A sub-list with the variables for which filter returned non-zero value.

Create a new variable list by concatenating two lists.

Parameters
aA variable list.
bA variable list.

Append a variable to the variable list.

Parameters
vlA variable list.
vA variable.

Prepend a variable to the variable list.

Parameters
vlA variable list.
vA variable.
FMILIB_EXPORT jm_status_enu_t fmi2_import_var_list_push_back ( fmi2_import_variable_list_t vl,
fmi2_import_variable_t v 
)

Add a variable to a variable list.

Parameters
vlA variable list.
vA variable.