]> gerrit.simantics Code Review - simantics/fmil.git/blob - org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI2/fmi2_import_variable_list.h
Add FMILibrary-2.0.3 to org.simantics.fmil.core\native.
[simantics/fmil.git] / org.simantics.fmil.core / native / FMILibrary / src / Import / include / FMI2 / fmi2_import_variable_list.h
1 /*\r
2     Copyright (C) 2012 Modelon AB\r
3 \r
4     This program is free software: you can redistribute it and/or modify\r
5     it under the terms of the BSD style license.
6 \r
7     This program is distributed in the hope that it will be useful,\r
8     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
10     FMILIB_License.txt file for more details.\r
11 \r
12     You should have received a copy of the FMILIB_License.txt file\r
13     along with this program. If not, contact Modelon AB <http://www.modelon.com>.\r
14 */\r
15 \r
16 \r
17 \r
18 /** \file fmi2_import_variable_list.h\r
19 *  \brief Public interface to the FMI XML C-library. Handling of variable lists.\r
20 */\r
21 \r
22 #ifndef FMI2_IMPORT_VARIABLELIST_H_\r
23 #define FMI2_IMPORT_VARIABLELIST_H_\r
24 \r
25  #include "fmi2_import_variable.h"\r
26 \r
27 #ifdef __cplusplus\r
28 extern "C" {\r
29 #endif\r
30 \r
31 /**\r
32  \addtogroup  fmi2_import\r
33  @{\r
34         \defgroup  fmi2_import_varlist Handling of variable lists\r
35  @}\r
36 */\r
37 \r
38 /** \addtogroup  fmi2_import_varlist\r
39 *  \brief Variable lists are provided to handle sets of variables.\r
40 *\r
41 * Note that variable lists are allocated dynamically and must be freed when not needed any longer.\r
42  @{ \r
43 */\r
44
45 /** \brief Allocate an empty list */
46 fmi2_import_variable_list_t* fmi2_import_alloc_variable_list(fmi2_import_t* fmu, size_t size);
47 \r
48 /**  \brief Free a variable list. Note that variable lists are allocated dynamically and must be freed when not needed any longer \r
49         \param vl A variable list.\r
50 */\r
51 FMILIB_EXPORT void fmi2_import_free_variable_list(fmi2_import_variable_list_t* vl);\r
52 \r
53 /** \brief Make a copy of the list.\r
54         \param vl A variable list.\r
55 */\r
56 FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_clone_variable_list(fmi2_import_variable_list_t* vl);\r
57 \r
58 /** \brief  Get number of variables in a list */\r
59 FMILIB_EXPORT size_t  fmi2_import_get_variable_list_size(fmi2_import_variable_list_t* vl);\r
60 \r
61 /** \brief  Get a pointer to the list of the value references for all the variables */\r
62 FMILIB_EXPORT const fmi2_value_reference_t* fmi2_import_get_value_referece_list(fmi2_import_variable_list_t* vl);\r
63 \r
64 /** \brief Get a single variable from the list*/\r
65 FMILIB_EXPORT fmi2_import_variable_t* fmi2_import_get_variable(fmi2_import_variable_list_t* vl, size_t  index);\r
66 \r
67 /** \name Operations on variable lists. Every operation creates a new list. \r
68 @{\r
69 */\r
70 /** \brief Select sub-lists.\r
71 \param vl A variable list.\r
72 \param fromIndex Zero based start index, inclusive.\r
73 \param toIndex Zero based end index, inclusive.\r
74 \return A sublist. NULL is returned if toIndex is less than fromIndex or is larger than the list size or if memory allocation failed.\r
75 */\r
76 FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_get_sublist(fmi2_import_variable_list_t* vl, size_t  fromIndex, size_t  toIndex);\r
77 \r
78 /** \brief Callback function typedef for the fmiFilterVariables. \r
79 \r
80 The function should return 0 to prevent a variable from coming to the output list. */\r
81 typedef int (*fmi2_import_variable_filter_function_ft)(fmi2_import_variable_t*vl, void * data);\r
82 \r
83 /** \brief Call the provided 'filter' function on every variable in the list and create a new list.\r
84   \r
85 \param vl A variable list.\r
86 \param filter A filter function according to ::fmi2_import_variable_filter_function_ft.\r
87 \param context A parameter to be forwarded to the filter function.\r
88  @return A sub-list with the variables for which filter returned non-zero value. */\r
89 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);\r
90 \r
91 /** \brief Create a new variable list by concatenating two lists.\r
92   \r
93 \param a A variable list.\r
94 \param b A variable list.\r
95 */\r
96 FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_join_var_list(fmi2_import_variable_list_t* a, fmi2_import_variable_list_t* b);\r
97 \r
98 \r
99 /** \brief Append a variable to the variable list.\r
100   \r
101 \param vl A variable list.\r
102 \param v A variable.\r
103 */\r
104 FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_append_to_var_list(fmi2_import_variable_list_t* vl, fmi2_import_variable_t* v);\r
105 \r
106 /** \brief Prepend a variable to the variable list.\r
107   \r
108 \param vl A variable list.\r
109 \param v A variable.\r
110 */\r
111 FMILIB_EXPORT fmi2_import_variable_list_t* fmi2_import_prepend_to_var_list(fmi2_import_variable_list_t* vl, fmi2_import_variable_t* v);\r
112 \r
113 /** \brief Add a variable to a variable list.\r
114   \r
115 \param vl A variable list.\r
116 \param v A variable.\r
117 */\r
118 FMILIB_EXPORT jm_status_enu_t fmi2_import_var_list_push_back(fmi2_import_variable_list_t* vl, fmi2_import_variable_t* v);\r
119 /**\r
120   @}\r
121  */\r
122 \r
123 /**\r
124   @}\r
125  */\r
126 \r
127 #ifdef __cplusplus\r
128 }\r
129 #endif\r
130 #endif\r