2 Copyright (C) 2012 Modelon AB
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the BSD style license.
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.
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>.
16 #ifndef FMI1_IMPORT_UTIL_H_
\r
17 #define FMI1_IMPORT_UTIL_H_
\r
19 #include <JM/jm_callbacks.h>
\r
25 \addtogroup fmi_import_utils Utility functions supporting interactions with the library
\r
29 \brief Create a unique temporary directory
\r
30 \param cb - callbacks for memory allocation and logging. Default callbacks are used if this parameter is NULL.
\r
31 \param systemTempDir - directory where the temp dir should be located both absolute and relative path are accepted.
\r
32 System-wide directory is used if this parameter is NULL.
\r
33 \param tempPrefix - File name template prefix used when creating temporaty directories. "fmil" is used if this is NULL.
\r
34 \return A pointer to the temporary directory name (absolute path, no terminating '/'). Caller is responsible for freeing the memory.
\r
35 The function returns NULL if there were errors in which case a message is send to the logger.
\r
37 FMILIB_EXPORT char* fmi_import_mk_temp_dir(jm_callbacks* cb, const char* systemTempDir, const char* tempPrefix);
\r
40 \brief Remove directory and all it contents.
\r
41 \param cb - callbacks for memory allocation and logging. Default callbacks are used if this parameter is NULL.
\r
42 \param dir - path to be removed.
\r
43 \return Statuc success or error.
\r
45 FMILIB_EXPORT jm_status_enu_t fmi_import_rmdir(jm_callbacks* cb, const char* dir);
\r
48 \brief Create a file:// URL from absolute path
\r
49 \param cb - callbacks for memory allocation and logging. Default callbacks are used if this parameter is NULL.
\r
50 \param absPath - absolute path to be converted into the URL
\r
51 \return A pointer to the URL. Caller is responsible for freeing the memory.
\r
52 The function returns NULL if there were errors in which case a message is send to the logger.
\r
54 FMILIB_EXPORT char* fmi_import_create_URL_from_abs_path(jm_callbacks* cb, const char* absPath);
\r
56 /** Given directory name fmu_unzipped_path and model identifier consturct Dll/so name
\r
57 @return Pointer to a string with the file name. Caller is responsible for freeing the memory.
\r
59 FMILIB_EXPORT char* fmi_import_get_dll_path(const char* fmu_unzipped_path, const char* model_identifier, jm_callbacks* callBackFunctions);
\r
61 /** Given directory name fmu_unzipped_path and model identifier consturct XML file name
\r
62 @return Pointer to a string with the file name. Caller is responsible for freeing the memory.
\r
64 FMILIB_EXPORT char* fmi_import_get_model_description_path(const char* fmu_unzipped_path, jm_callbacks* callBackFunctions);
\r
73 #endif /* End of header file FMI1_IMPORT_UTIL_H_ */