]> gerrit.simantics Code Review - simantics/fmil.git/blob - org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI1/fmi1_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 / FMI1 / fmi1_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 fmi1_import_type.h
19 *  \brief Public interface to the FMI XML C-library: variable types handling.
20 */
21
22 #ifndef FMI1_IMPORT_TYPE_H_
23 #define FMI1_IMPORT_TYPE_H_
24
25 #include "fmi1_import_unit.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /**
32         \addtogroup fmi1_import
33         @{
34         \addtogroup fmi1_import_typedef Support for processing variable types
35         @}
36         \addtogroup fmi1_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 fmi1_xml_real_typedef_t fmi1_import_real_typedef_t;\r
43 /** \brief Opaque integer type definition object. */\r
44 typedef struct fmi1_xml_integer_typedef_t fmi1_import_integer_typedef_t;\r
45 /** \brief Opaque enumeration type definition object. */\r
46 typedef struct fmi1_xml_enumeration_typedef_t fmi1_import_enumeration_typedef_t;\r
47 /** \brief Opaque general variable type definition object. */\r
48 typedef struct fmi1_xml_variable_typedef_t fmi1_import_variable_typedef_t;\r
49 /** \brief Opaque list of the type definitions in the model */\r
50 typedef struct fmi1_xml_type_definitions_t fmi1_import_type_definitions_t;\r
51 /**@} */\r
52
53 /** \brief Get the number of available type definitions */
54 FMILIB_EXPORT size_t fmi1_import_get_type_definition_number(fmi1_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 fmi1_import_get_type_definition_number()
59         @return A type definition object or NULL if index is out of range.
60 */
61 FMILIB_EXPORT fmi1_import_variable_typedef_t* fmi1_import_get_typedef(fmi1_import_type_definitions_t* td, unsigned int  index);
62
63 /** \brief Get associated display unit for a type defition if any. */
64 FMILIB_EXPORT fmi1_import_display_unit_t* fmi1_import_get_type_display_unit(fmi1_import_real_typedef_t*);
65
66 /** \brief Get the type name*/
67 FMILIB_EXPORT const char* fmi1_import_get_type_name(fmi1_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* fmi1_import_get_type_description(fmi1_import_variable_typedef_t*);
73
74 /** \brief Get base type used for the type definition */
75 FMILIB_EXPORT fmi1_base_type_enu_t fmi1_import_get_base_type(fmi1_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 fmi1_import_real_typedef_t* fmi1_import_get_type_as_real(fmi1_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 fmi1_import_integer_typedef_t* fmi1_import_get_type_as_int(fmi1_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 fmi1_import_enumeration_typedef_t* fmi1_import_get_type_as_enum(fmi1_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* fmi1_import_get_type_quantity(fmi1_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 fmi1_import_get_real_type_min(fmi1_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 fmi1_import_get_real_type_max(fmi1_import_real_typedef_t*);
109
110 /** \brief Get the nominal value associated with the type definition */
111 FMILIB_EXPORT double fmi1_import_get_real_type_nominal(fmi1_import_real_typedef_t*);
112
113 /** \brief Get the unit object associated with the type definition if any*/
114 FMILIB_EXPORT fmi1_import_unit_t* fmi1_import_get_real_type_unit(fmi1_import_real_typedef_t*);
115
116 /** \brief Get the relativeQuantity flag */
117 FMILIB_EXPORT int fmi1_import_get_real_type_is_relative_quantity(fmi1_import_real_typedef_t*);
118
119 /** \brief Get minimal value for the type.
120         
121         @return Either the value specified in the XML file or INT_MIN as defined in <limits.h>
122 */
123 FMILIB_EXPORT int fmi1_import_get_integer_type_min(fmi1_import_integer_typedef_t*);
124 /** \brief Get maximum value for the type
125         
126         @return Either the value specified in the XML file or INT_MAX as defined in <limits.h>
127 */
128 FMILIB_EXPORT int fmi1_import_get_integer_type_max(fmi1_import_integer_typedef_t*);
129
130 /** \brief Get minimal value for the type.
131         
132         @return Either the value specified in the XML file or 0
133 */
134 FMILIB_EXPORT unsigned int fmi1_import_get_enum_type_min(fmi1_import_enumeration_typedef_t*);
135
136 /** \brief Get maximum value for the type.
137         
138         @return Either the value specified in the XML file or INT_MAX as defined in <limits.h>
139 */
140 FMILIB_EXPORT unsigned int fmi1_import_get_enum_type_max(fmi1_import_enumeration_typedef_t*);
141
142 /** \brief Get the number of elements in the enum */
143 FMILIB_EXPORT unsigned int  fmi1_import_get_enum_type_size(fmi1_import_enumeration_typedef_t*);
144
145 /** \brief Get an enumeration item name by index */
146 FMILIB_EXPORT const char* fmi1_import_get_enum_type_item_name(fmi1_import_enumeration_typedef_t*, unsigned int  item);
147 /** \brief Get an enumeration item description by index */
148 FMILIB_EXPORT const char* fmi1_import_get_enum_type_item_description(fmi1_import_enumeration_typedef_t*, unsigned int  item);
149
150 /**
151         \brief Get display unit associated with a real type definition.
152         @return Display unit object of NULL if none was given.
153 */
154 FMILIB_EXPORT fmi1_import_display_unit_t* fmi1_import_get_type_display_unit(fmi1_import_real_typedef_t*);
155
156 /**
157 *  @}
158 */
159 #ifdef __cplusplus
160 }
161 #endif
162 #endif
163