FMI Library: part of JModelica.org
Functions
Constuction, destruction and error handling

Functions

FMILIB_EXPORT fmi1_import_tfmi1_import_parse_xml (fmi_import_context_t *context, const char *dirPath)
 Create fmi1_import_t structure and parse the XML file. More...
 
FMILIB_EXPORT const charfmi1_import_get_last_error (fmi1_import_t *fmu)
 Retrieve the last error message. More...
 
FMILIB_EXPORT int fmi1_import_clear_last_error (fmi1_import_t *fmu)
 Clear the error message. More...
 
FMILIB_EXPORT void fmi1_import_free (fmi1_import_t *fmu)
 Release the memory allocated. More...
 

Detailed Description

Function Documentation

FMILIB_EXPORT fmi1_import_t* fmi1_import_parse_xml ( fmi_import_context_t context,
const char dirPath 
)

Create fmi1_import_t structure and parse the XML file.

Parameters
contextA context data strucutre is used to propagate the callbacks for memory handling and logging.
dirPathA directory name (full path) of a directory where the FMU was unzipped.
Returns
The new structure if parsing was successfull. 0-pointer is returned on error.
FMILIB_EXPORT const char* fmi1_import_get_last_error ( fmi1_import_t fmu)

Retrieve the last error message.

Error handling:

Many functions in the library return pointers to struct. An error is indicated by returning NULL/0-pointer. If error is returned than fmi1_import_get_last_error() functions can be used to retrieve the error message. If logging callbacks were specified then the same information is reported via logger. Memory for the error string is allocated and deallocated in the module. Client code should not store the pointer to the string since it can become invalid.

Parameters
fmuAn FMU object as returned by fmi1_import_parse_xml().
Returns
NULL-terminated string with an error message.
FMILIB_EXPORT int fmi1_import_clear_last_error ( fmi1_import_t fmu)

Clear the error message.

Parameters
fmuAn FMU object as returned by fmi1_import_parse_xml().
Returns
0 if further processing is possible. If it returns 1 then the error was not recoverable. The fmu object should then be freed and recreated.
FMILIB_EXPORT void fmi1_import_free ( fmi1_import_t fmu)

Release the memory allocated.

Parameters
fmuAn fmu object as returned by fmi1_import_parse_xml().