--- /dev/null
+/*\r
+ Copyright (C) 2012 Modelon AB\r
+\r
+ This program is free software: you can redistribute it and/or modify\r
+ it under the terms of the BSD style license.
+\r
+ This program is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ FMILIB_License.txt file for more details.\r
+\r
+ You should have received a copy of the FMILIB_License.txt file\r
+ along with this program. If not, contact Modelon AB <http://www.modelon.com>.\r
+*/\r
+\r
+\r
+\r
+/** \file fmi1_xml_model_description.h\r
+* \brief Public interface to the FMI XML C-library.\r
+*/\r
+\r
+#ifndef FMI1_XML_MODELDESCRIPTION_H_\r
+#define FMI1_XML_MODELDESCRIPTION_H_\r
+\r
+#include <stddef.h>\r
+#include <JM/jm_callbacks.h>\r
+#include <JM/jm_named_ptr.h>\r
+#include <FMI/fmi_xml_context.h>\r
+#include <FMI1/fmi1_types.h>\r
+#include <FMI1/fmi1_enums.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/**\r
+\addtogroup fmi_xml\r
+ @{\r
+ \addtogroup fmi1_xml\r
+ @}\r
+*/\r
+/**\r
+ \addtogroup fmi1_xml FMI 1.0 XML parsing library.\r
+ \brief The FMI 1.0 XML parsing library supports processing of model description XML files.\r
+ @{\r
+ \name Declarations of structs used in the interface.\r
+ \brief All the structures used in the interfaces are intended to\r
+ be treated as opaque objects by the client code.\r
+ @{ */\r
+\r
+/**\name Vendor annotation supporting structures\r
+ * @{ \r
+ */\r
+typedef struct fmi1_xml_vendor_list_t fmi1_xml_vendor_list_t;\r
+typedef struct fmi1_xml_vendor_t fmi1_xml_vendor_t;\r
+typedef struct fmi1_xml_annotation_t fmi1_xml_annotation_t;\r
+/** @} */\r
+\r
+/**\name Type definitions supporting structures\r
+@{ */\r
+typedef struct fmi1_xml_real_typedef_t fmi1_xml_real_typedef_t;\r
+typedef struct fmi1_xml_integer_typedef_t fmi1_xml_integer_typedef_t;\r
+typedef struct fmi1_xml_enumeration_typedef_t fmi1_xml_enumeration_typedef_t;\r
+typedef struct fmi1_xml_variable_typedef_t fmi1_xml_variable_typedef_t;\r
+\r
+typedef struct fmi1_xml_type_definitions_t fmi1_xml_type_definitions_t;\r
+/** @} */\r
+\r
+/**\name Scalar Variable types */\r
+/** @{ */\r
+/**General variable type is convenien to unify all the variable list operations */\r
+typedef struct fmi1_xml_variable_t fmi1_xml_variable_t;\r
+\r
+/**Typed variables are needed to support specific attributes */\r
+typedef struct fmi1_xml_real_variable_t fmi1_xml_real_variable_t;\r
+typedef struct fmi1_xml_integer_variable_t fmi1_xml_integer_variable_t;\r
+typedef struct fmi1_xml_string_variable_t fmi1_xml_string_variable_t;\r
+typedef struct fmi1_xml_enum_variable_t fmi1_xml_enum_variable_t;\r
+typedef struct fmi1_xml_bool_variable_t fmi1_xml_bool_variable_t;\r
+/** @} */\r
+\r
+/**\name Structures encapsulating unit information */\r
+/**@{ */\r
+typedef struct fmi1_xml_unit_t fmi1_xml_unit_t;\r
+typedef struct fmi1_xml_display_unit_t fmi1_xml_display_unit_t;\r
+typedef struct fmi1_xml_unit_definitions_t fmi1_xml_unit_definitions_t;\r
+/**@} */\r
+\r
+/**\name FMU capabilities flags */\r
+/**@{ */\r
+typedef struct fmi1_xml_capabilities_t fmi1_xml_capabilities_t;\r
+/**@} */\r
+/** \addtogroup fmi1_xml_gen General information retrieval*/\r
+/** \addtogroup fmi1_xml_init Constuction, destruction and error checking */\r
+\r
+/** @} */\r
+\r
+/** \addtogroup fmi1_xml_init\r
+@{ */\r
+/**\r
+ \brief Allocate the ModelDescription structure and initialize as empty model.\r
+ @return NULL pointer is returned if memory allocation fails.\r
+ @param callbacks - Standard FMI callbacks may be sent into the module. The argument is optional (pointer can be zero).\r
+*/\r
+fmi1_xml_model_description_t* fmi1_xml_allocate_model_description( jm_callbacks* callbacks);\r
+\r
+/**\r
+ \brief If this configuration option is set, the model description will be\r
+ checked to follow the variable naming conventions. Variables not following\r
+ the convention will be logged.\r
+*/\r
+#define FMI1_XML_NAME_CHECK 1\r
+\r
+/**\r
+ \brief Parse XML file\r
+ Repeaded calls invalidate the data structures created with the previous call to fmiParseXML,\r
+ i.e., fmiClearModelDescrition is automatically called before reading in the new file.\r
+\r
+ @param md A model description object as returned by fmi1_xml_allocate_model_description.\r
+ @param fileName A name (full path) of the XML file name with model definition.\r
+ @param configuration Specifies how to parse the model description, 0 is\r
+ default. Other possible configuration is FMI_XML_NAME_CHECK.\r
+ @return 0 if parsing was successfull. Non-zero value indicates an error.\r
+*/\r
+int fmi1_xml_parse_model_description( fmi1_xml_model_description_t* md,\r
+ const char* fileName,\r
+ int configuration);\r
+\r
+/**\r
+ Clears the data associated with the model description. This is useful if the same object\r
+ instance is used repeatedly to work with different XML files.\r
+ @param md A model description object as returned by fmi1_xml_allocate_model_description.\r
+*/\r
+void fmi1_xml_clear_model_description( fmi1_xml_model_description_t* md);\r
+\r
+/*\r
+* @param md A model description object as returned by fmi1_xml_allocate_model_description.\r
+* @return 1 if model description is empty and 0 if there is some content associated.\r
+*/\r
+int fmi1_xml_is_model_description_empty(fmi1_xml_model_description_t* md);\r
+\r
+/**Error handling:\r
+* Many functions in the library return pointers to struct. An error is indicated by returning NULL/0-pointer.\r
+* If error is returned than fmiGetLastError() functions can be used to retrieve the error message.\r
+* If logging callbacks were specified then the same information is reported via logger.\r
+* Memory for the error string is allocated and deallocated in the module.\r
+* Client code should not store the pointer to the string since it can become invalid.\r
+* @param md A model description object as returned by fmi1_xml_allocate_model_description.\r
+* @return NULL-terminated string with an error message.\r
+*/\r
+const char* fmi1_xml_get_last_error(fmi1_xml_model_description_t* md);\r
+\r
+/**\r
+fmiClearLastError clears the error message .\r
+*/\r
+void fmi1_xml_clear_last_error(fmi1_xml_model_description_t* md);\r
+\r
+/**Release the memory allocated\r
+@param md A model description object as returned by fmi1_xml_allocate_model_description.\r
+*/\r
+void fmi1_xml_free_model_description(fmi1_xml_model_description_t* md);\r
+\r
+/** @} */\r
+/** \addtogroup fmi1_xml_gen\r
+ * \brief Functions for retrieving general model information. Memory for the strings is allocated and deallocated in the module.\r
+ * All the functions take a model description object as returned by fmi1_xml_allocate_model_description() as a parameter. \r
+ * The information is retrieved from the XML file.\r
+ * @{\r
+*/\r
+const char* fmi1_xml_get_model_name(fmi1_xml_model_description_t* md);\r
+\r
+const char* fmi1_xml_get_model_identifier(fmi1_xml_model_description_t* md);\r
+\r
+const char* fmi1_xml_get_GUID(fmi1_xml_model_description_t* md);\r
+\r
+const char* fmi1_xml_get_description(fmi1_xml_model_description_t* md);\r
+\r
+const char* fmi1_xml_get_author(fmi1_xml_model_description_t* md);\r
+\r
+const char* fmi1_xml_get_model_version(fmi1_xml_model_description_t* md);\r
+const char* fmi1_xml_get_model_standard_version(fmi1_xml_model_description_t* md);\r
+const char* fmi1_xml_get_generation_tool(fmi1_xml_model_description_t* md);\r
+const char* fmi1_xml_get_generation_date_and_time(fmi1_xml_model_description_t* md);\r
+\r
+fmi1_variable_naming_convension_enu_t fmi1_xml_get_naming_convention(fmi1_xml_model_description_t* md);\r
+\r
+unsigned int fmi1_xml_get_number_of_continuous_states(fmi1_xml_model_description_t* md);\r
+\r
+unsigned int fmi1_xml_get_number_of_event_indicators(fmi1_xml_model_description_t* md);\r
+\r
+double fmi1_xml_get_default_experiment_start(fmi1_xml_model_description_t* md);\r
+\r
+void fmi1_xml_set_default_experiment_start(fmi1_xml_model_description_t* md, double);\r
+\r
+double fmi1_xml_get_default_experiment_stop(fmi1_xml_model_description_t* md);\r
+\r
+void fmi1_xml_set_default_experiment_stop(fmi1_xml_model_description_t* md, double);\r
+\r
+double fmi1_xml_get_default_experiment_tolerance(fmi1_xml_model_description_t* md);\r
+\r
+void fmi1_xml_set_default_experiment_tolerance(fmi1_xml_model_description_t* md, double);\r
+\r
+fmi1_fmu_kind_enu_t fmi1_xml_get_fmu_kind(fmi1_xml_model_description_t* md);\r
+\r
+fmi1_xml_capabilities_t* fmi1_xml_get_capabilities(fmi1_xml_model_description_t* md);\r
+\r
+jm_vector(jm_voidp)* fmi1_xml_get_variables_original_order(fmi1_xml_model_description_t* md);\r
+\r
+jm_vector(jm_named_ptr)* fmi1_xml_get_variables_alphabetical_order(fmi1_xml_model_description_t* md);\r
+\r
+jm_vector(jm_voidp)* fmi1_xml_get_variables_vr_order(fmi1_xml_model_description_t* md);\r
+\r
+/**\r
+ \brief Get variable by variable name.\r
+ \param md - the model description\r
+ \param name - variable name\r
+ \return variable pointer.\r
+*/\r
+fmi1_xml_variable_t* fmi1_xml_get_variable_by_name(fmi1_xml_model_description_t* md, const char* name);\r
+\r
+/**\r
+ \brief Get variable by value reference.\r
+ \param md - the model description\r
+ \param baseType - basic data type\r
+ \param vr - value reference\r
+ \return variable pointer.\r
+*/\r
+fmi1_xml_variable_t* fmi1_xml_get_variable_by_vr(fmi1_xml_model_description_t* md, fmi1_base_type_enu_t baseType, fmi1_value_reference_t vr);\r
+\r
+/** @} */\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#include "fmi1_xml_type.h"\r
+#include "fmi1_xml_unit.h"\r
+#include "fmi1_xml_variable.h"\r
+#include "fmi1_xml_vendor_annotations.h"\r
+#include "fmi1_xml_capabilities.h"\r
+#include "fmi1_xml_cosim.h"\r
+\r
+#endif\r