]> gerrit.simantics Code Review - simantics/fmil.git/blob - org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI2/fmi2_import_type.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_type.h
1 /*
2     Copyright (C) 2012 Modelon AB
3
4     This program is free software: you can redistribute it and/or modify
5     it under the terms of the BSD style license.
6
7      This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10     FMILIB_License.txt file for more details.
11
12     You should have received a copy of the FMILIB_License.txt file
13     along with this program. If not, contact Modelon AB <http://www.modelon.com>.
14 */
15
16
17
18 /** \file fmi2_import_type.h
19 *  \brief Public interface to the FMI XML C-library: variable types handling.
20 */
21
22 #ifndef FMI2_IMPORT_TYPE_H_
23 #define FMI2_IMPORT_TYPE_H_
24
25 #include "fmi2_import_unit.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /**
32         \addtogroup fmi2_import
33         @{
34         \addtogroup fmi2_import_typedef Support for processing variable types
35         @}
36         \addtogroup fmi2_import_typedef Support for processing variable types
37   @{
38 */
39 /**@name   Type definitions supporting structures*/\r
40 /**@{ */\r
41 /** \brief Opaque type definition object. */\r
42 typedef struct fmi2_xml_real_typedef_t fmi2_import_real_typedef_t;\r
43 /** \brief Opaque integer type definition object. */\r
44 typedef struct fmi2_xml_integer_typedef_t fmi2_import_integer_typedef_t;\r
45 /** \brief Opaque enumeration type definition object. */\r
46 typedef struct fmi2_xml_enumeration_typedef_t fmi2_import_enumeration_typedef_t;\r
47 /** \brief Opaque general variable type definition object. */\r
48 typedef struct fmi2_xml_variable_typedef_t fmi2_import_variable_typedef_t;\r
49 /** \brief Opaque list of the type definitions in the model */\r
50 typedef struct fmi2_xml_type_definitions_t fmi2_import_type_definitions_t;\r
51 /**@} */\r
52
53 /** \brief Get the number of available type definitions */
54 FMILIB_EXPORT unsigned int fmi2_import_get_type_definition_number(fmi2_import_type_definitions_t* td);
55
56 /** \brief Get a type definition specified by the index 
57         @param td the type definition list object
58         @param index the index of type definition. Must be less than the numbere returned by fmi2_import_get_type_definition_number()
59         @return A type definition object or NULL if index is out of range.
60 */
61 FMILIB_EXPORT fmi2_import_variable_typedef_t* fmi2_import_get_typedef(fmi2_import_type_definitions_t* td, unsigned int  index);
62
63 /** \brief Get associated display unit for a type defition if any. */
64 FMILIB_EXPORT fmi2_import_display_unit_t* fmi2_import_get_type_display_unit(fmi2_import_real_typedef_t*);
65
66 /** \brief Get the type name*/
67 FMILIB_EXPORT const char* fmi2_import_get_type_name(fmi2_import_variable_typedef_t*);
68
69 /**\brief Get type description.
70
71    Note that an empty string is returned if the attribute is not present in the XML.*/
72 FMILIB_EXPORT const char* fmi2_import_get_type_description(fmi2_import_variable_typedef_t*);
73
74 /** \brief Get base type used for the type definition */
75 FMILIB_EXPORT fmi2_base_type_enu_t fmi2_import_get_base_type(fmi2_import_variable_typedef_t*);
76
77 /* Boolean and String has no extra attributes -> not needed*/
78
79 /** \brief Cast the general type definition object to an object with a specific base type 
80         @return Pointer to the specific type object or NULL if base type does not match.
81 */
82 FMILIB_EXPORT fmi2_import_real_typedef_t* fmi2_import_get_type_as_real(fmi2_import_variable_typedef_t*);
83 /** \brief Cast the general type definition object to an object with a specific base type 
84         @return Pointer to the specific type object or NULL if base type does not match.
85 */
86 FMILIB_EXPORT fmi2_import_integer_typedef_t* fmi2_import_get_type_as_int(fmi2_import_variable_typedef_t*);
87 /** \brief Cast the general type definition object to an object with a specific base type 
88         @return Pointer to the specific type object or NULL if base type does not match.
89 */
90 FMILIB_EXPORT fmi2_import_enumeration_typedef_t* fmi2_import_get_type_as_enum(fmi2_import_variable_typedef_t*);
91
92 /** \brief Get the quantity associated with the type definition.
93
94         @return NULL-pointer is always returned for strings and booleans.
95         Empty string is returned if attribute is not present for other types.
96 */
97 FMILIB_EXPORT const char* fmi2_import_get_type_quantity(fmi2_import_variable_typedef_t*);
98
99 /** \brief Get minimal value for the type.
100
101         @return Either the value specified in the XML file or negated DBL_MAX as defined in <float.h>
102 */
103 FMILIB_EXPORT double fmi2_import_get_real_type_min(fmi2_import_real_typedef_t*);
104 /** \brief Get maximum value for the type
105
106         @return Either the value specified in the XML file or DBL_MAX as defined in <float.h>
107 */
108 FMILIB_EXPORT double fmi2_import_get_real_type_max(fmi2_import_real_typedef_t*);
109
110 /** \brief Get the nominal value associated with the type definition */
111 FMILIB_EXPORT double fmi2_import_get_real_type_nominal(fmi2_import_real_typedef_t*);
112
113 /** \brief Get the unit object associated with the type definition if any*/
114 FMILIB_EXPORT fmi2_import_unit_t* fmi2_import_get_real_type_unit(fmi2_import_real_typedef_t*);
115
116 /** \brief Get the 'relativeQuantity' flag */
117 FMILIB_EXPORT int fmi2_import_get_real_type_is_relative_quantity(fmi2_import_real_typedef_t*);
118
119 /** \brief Get the 'unbounded' flag */
120 FMILIB_EXPORT int fmi2_import_get_real_type_is_unbounded(fmi2_import_real_typedef_t*);
121
122 /** \brief Get minimal value for the type.
123         
124         @return Either the value specified in the XML file or INT_MIN as defined in <limits.h>
125 */
126 FMILIB_EXPORT int fmi2_import_get_integer_type_min(fmi2_import_integer_typedef_t*);
127 /** \brief Get maximum value for the type
128         
129         @return Either the value specified in the XML file or INT_MAX as defined in <limits.h>
130 */
131 FMILIB_EXPORT int fmi2_import_get_integer_type_max(fmi2_import_integer_typedef_t*);
132
133 /** \brief Get minimal value for the type.
134         
135         @return Either the value specified in the XML file or 0
136 */
137 FMILIB_EXPORT unsigned int fmi2_import_get_enum_type_min(fmi2_import_enumeration_typedef_t*);
138
139 /** \brief Get maximum value for the type.
140         
141         @return Either the value specified in the XML file or INT_MAX as defined in <limits.h>
142 */
143 FMILIB_EXPORT unsigned int fmi2_import_get_enum_type_max(fmi2_import_enumeration_typedef_t*);
144
145 /** \brief Get the number of elements in the enum */
146 FMILIB_EXPORT unsigned int  fmi2_import_get_enum_type_size(fmi2_import_enumeration_typedef_t*);
147
148 /** \brief Get an enumeration item name by index */
149 FMILIB_EXPORT const char* fmi2_import_get_enum_type_item_name(fmi2_import_enumeration_typedef_t*, unsigned int  item);
150
151 /** \brief Get an enumeration item value by index */
152 FMILIB_EXPORT int fmi2_import_get_enum_type_item_value(fmi2_import_enumeration_typedef_t*, unsigned int  item);
153
154 /** \brief Get an enumeration item description by index */
155 FMILIB_EXPORT const char* fmi2_import_get_enum_type_item_description(fmi2_import_enumeration_typedef_t*, unsigned int  item);
156
157 /** \brief Get an enumeration item name for the given value */
158 FMILIB_EXPORT const char* fmi2_import_get_enum_type_value_name(fmi2_import_enumeration_typedef_t* t, int value);
159
160 /**
161         \brief Get display unit associated with a real type definition.
162         @return Display unit object of NULL if none was given.
163 */
164 FMILIB_EXPORT fmi2_import_display_unit_t* fmi2_import_get_type_display_unit(fmi2_import_real_typedef_t*);
165
166 /**
167 *  @}
168 */
169 #ifdef __cplusplus
170 }
171 #endif
172 #endif
173