]> gerrit.simantics Code Review - simantics/fmil.git/blobdiff - org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI/fmi_import_context.h
Add FMILibrary-2.0.3 to org.simantics.fmil.core\native.
[simantics/fmil.git] / org.simantics.fmil.core / native / FMILibrary / src / Import / include / FMI / fmi_import_context.h
diff --git a/org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI/fmi_import_context.h b/org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI/fmi_import_context.h
new file mode 100644 (file)
index 0000000..06612e0
--- /dev/null
@@ -0,0 +1,136 @@
+/*\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
+/** \file fmi_import_context.h\r
+*  \brief Import context is the entry point to the library. It is used to initialize, unzip, get FMI version and start parsing.\r
+*/\r
+\r
+#ifndef FMI_IMPORT_CONTEXT_H_\r
+#define FMI_IMPORT_CONTEXT_H_\r
+\r
+#include <stddef.h>\r
+#include <fmilib_config.h>\r
+#include <JM/jm_callbacks.h>\r
+#include <FMI2/fmi2_xml_callbacks.h>\r
+#include <FMI/fmi_version.h> \r
+#include <FMI1/fmi1_types.h>\r
+#include <FMI1/fmi1_enums.h>\r
+#include <FMI2/fmi2_types.h>\r
+#include <FMI2/fmi2_enums.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+       \r
+/** \r
+\addtogroup fmi_import FMI import library\r
+@{\r
+\addtogroup fmi_import_context Library initialization\r
+Interaction with an FMU by means of the FMI Library starts with allocation of \r
+an ::fmi_import_context_t structure. This is done with a call to fmi_import_allocate_context().\r
+The next step is detection of FMI standard used in the specific FMU. This is achieved by\r
+calling fmi_import_get_fmi_version() function. When the standard is known a standard\r
+specific function for processing model description XML should be called to create an\r
+opaque FMU structure. This is done by calling either fmi1_import_parse_xml() or fmi2_import_parse_xml().\r
+With the FMU structure available one can proceed by loading the FMU binary \r
+(fmi1_import_create_dllfmu() or fmi2_import_create_dllfmu()). After that \r
+the code is able to interact with the FMU by means of the methonds presented \r
+in \ref fmi1_import_capi and \ref fmi2_import_capi.\r
+\r
+\addtogroup  fmi1_import\r
+\addtogroup  fmi2_import\r
+\addtogroup  fmi_import_utils\r
+@}\r
+\addtogroup fmi_import_context\r
+@{\r
+*/\r
+\r
+/** \brief FMI version independent library context. \r
+       Opaque struct returned from fmi_import_allocate_context()\r
+*/\r
+typedef struct fmi_xml_context_t fmi_import_context_t ;\r
+\r
+/** \brief Create fmi_import_context_t structure.\r
+       @param callbacks - a pointer to the library callbacks for memory management and logging. May be NULL if defaults are utilized.\r
+       @return A new structure if memory allocation was successful.\r
+*/\r
+FMILIB_EXPORT fmi_import_context_t* fmi_import_allocate_context( jm_callbacks* callbacks);\r
+\r
+/**\r
+       \brief Free memory allocated for the library context.\r
+       @param c - library context allocated by fmi_import_allocate_context()\r
+*/\r
+FMILIB_EXPORT void fmi_import_free_context( fmi_import_context_t* c);\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 FMI_IMPORT_NAME_CHECK 1\r
+\r
+/**\r
+    \brief Sets advanced configuration, if zero is passed default configuration\r
+    is set. Currently only one non default configuration is available:\r
+    FMI_IMPORT_XML_NAME_CHECK.\r
+    @param conf - specifies the configuration to use\r
+*/\r
+FMILIB_EXPORT void fmi_import_set_configuration( fmi_import_context_t* c, int conf);\r
+\r
+/**\r
+       \brief Unzip an FMU specified by the fileName into directory dirName and parse XML to get FMI standard version.\r
+       @param c - library context.\r
+       @param fileName - an FMU file name.\r
+       @param dirName - a directory name where the FMU should be unpacked\r
+*/\r
+FMILIB_EXPORT fmi_version_enu_t fmi_import_get_fmi_version( fmi_import_context_t* c, const char* fileName, const char* dirName);\r
+\r
+/**\r
+       \brief FMU version 1.0 object\r
+*/\r
+typedef struct fmi1_import_t fmi1_import_t;\r
+\r
+/**\r
+       \brief FMU version 2.0 object\r
+*/\r
+typedef struct fmi2_import_t fmi2_import_t;\r
+\r
+/**\r
+       \brief Parse FMI 1.0 XML file found in the directory dirName.\r
+       \param c - library context.\r
+       \param dirName - a directory where the FMU was unpacked and XML file is present.\r
+       \return fmi1_import_t:: opaque object pointer\r
+*/\r
+FMILIB_EXPORT fmi1_import_t* fmi1_import_parse_xml( fmi_import_context_t* c, const char* dirName);\r
+\r
+/**\r
+    \brief Create ::fmi2_import_t structure and parse the FMI 2.0 XML file found in the directory dirName.\r
+       \param context - library context.\r
+       \param dirPath - a directory where the FMU was unpacked and XML file is present.\r
+       \param xml_callbacks Callbacks to use for processing of annotations (may be NULL).\r
+       \return fmi2_import_t:: opaque object pointer\r
+*/\r
+FMILIB_EXPORT fmi2_import_t* fmi2_import_parse_xml( fmi_import_context_t* context, const char* dirPath, fmi2_xml_callbacks_t* xml_callbacks);\r
+\r
+/** \r
+@}\r
+*/\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif\r