FMI Library: part of JModelica.org
|
Data Structures | |
struct | jm_callbacks |
The callbacks struct is sent to all the modules in the library. More... | |
Macros | |
#define | JM_MAX_ERROR_MESSAGE_SIZE 2000 |
Maximum message size that can be stored in the jm_callbacks struct. More... | |
Typedefs | |
typedef struct jm_callbacks | jm_callbacks |
typedef void(* | jm_logger_f) (jm_callbacks *c, jm_string module, jm_log_level_enu_t log_level, jm_string message) |
Logger callback type. More... | |
Functions | |
static jm_string | jm_get_last_error (jm_callbacks *cb) |
Get the last log message produced by the library. More... | |
static void | jm_clear_last_error (jm_callbacks *cb) |
Clear the last generated log message. More... | |
FMILIB_EXPORT void | jm_set_default_callbacks (jm_callbacks *c) |
Set the structure to be returned by jm_get_default_callbacks(). More... | |
FMILIB_EXPORT jm_callbacks * | jm_get_default_callbacks (void) |
Get default callbacks. The function never returns NULL. More... | |
FMILIB_EXPORT void | jm_default_logger (jm_callbacks *c, jm_string module, jm_log_level_enu_t log_level, jm_string message) |
The default logger implementation prints messages to stderr. More... | |
FMILIB_EXPORT void | jm_log (jm_callbacks *cb, const char *module, jm_log_level_enu_t log_level, const char *fmt,...) |
Send a message to the logger function. More... | |
FMILIB_EXPORT void | jm_log_v (jm_callbacks *cb, const char *module, jm_log_level_enu_t log_level, const char *fmt, va_list ap) |
Send a message to the logger function. More... | |
FMILIB_EXPORT void | jm_log_fatal_v (jm_callbacks *cb, const char *module, const char *fmt, va_list ap) |
Send a fatal error message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_fatal (jm_callbacks *cb, const char *module, const char *fmt,...) |
Send a fatal error message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_error_v (jm_callbacks *cb, const char *module, const char *fmt, va_list ap) |
Send a error message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_error (jm_callbacks *cb, const char *module, const char *fmt,...) |
Send a error message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_warning_v (jm_callbacks *cb, const char *module, const char *fmt, va_list ap) |
Send a warning message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_warning (jm_callbacks *cb, const char *module, const char *fmt,...) |
Send a warning message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_info_v (jm_callbacks *cb, const char *module, const char *fmt, va_list ap) |
Send an info message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_info (jm_callbacks *cb, const char *module, const char *fmt,...) |
Send an info message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_verbose_v (jm_callbacks *cb, const char *module, const char *fmt, va_list ap) |
Send a verbose message to the logger function. See jm_log() for details. More... | |
FMILIB_EXPORT void | jm_log_verbose (jm_callbacks *cb, const char *module, const char *fmt,...) |
Send a verbose message to the logger function. See jm_log() for details. More... | |
static void | jm_log_debug_v (jm_callbacks *cb, const char *module, const char *fmt, va_list ap) |
Send a debug message to the logger function. See jm_log() for details. More... | |
static void | jm_log_debug (jm_callbacks *cb, const char *module, const char *fmt,...) |
Send a debug message to the logger function. See jm_log() for details. More... | |
Memory management callbacks | |
jm_malloc_f, jm_realloc_f, jm_calloc_f, jm_free_f function types correspond to the standard C memory management functions | |
typedef jm_voidp(* | jm_malloc_f) (size_t size) |
Allocation function type. More... | |
typedef jm_voidp(* | jm_realloc_f) (void *ptr, size_t size) |
Re-allocation function type. More... | |
typedef jm_voidp(* | jm_calloc_f) (size_t numitems, size_t itemsize) |
Zero-initialized allocation function type. More... | |
typedef void(* | jm_free_f) (jm_voidp p) |
Free memory function type. More... | |
#define JM_MAX_ERROR_MESSAGE_SIZE 2000 |
Maximum message size that can be stored in the jm_callbacks struct.
Definition at line 70 of file jm_callbacks.h.
typedef struct jm_callbacks jm_callbacks |
Definition at line 37 of file jm_callbacks.h.
Allocation function type.
Definition at line 45 of file jm_callbacks.h.
Re-allocation function type.
Definition at line 48 of file jm_callbacks.h.
Zero-initialized allocation function type.
Definition at line 51 of file jm_callbacks.h.
typedef void(* jm_free_f) (jm_voidp p) |
Free memory function type.
Definition at line 54 of file jm_callbacks.h.
typedef void(* jm_logger_f) (jm_callbacks *c, jm_string module, jm_log_level_enu_t log_level, jm_string message) |
Logger callback type.
The logger callback is used to report errors. Note that this function is by default only used in FMI standard intependent code (e.g., fmi_import_get_fmi_version()). Since logging functions are different between different standard versions separate logging functions are necessary for each fmi implementation.
Defaults are provided for each standard.
Definition at line 67 of file jm_callbacks.h.
|
static |
Get the last log message produced by the library.
An alternative way to get error information is to use jm_get_last_error(). This is only meaningful if logger function is not present.
Definition at line 98 of file jm_callbacks.h.
|
static |
Clear the last generated log message.
Definition at line 103 of file jm_callbacks.h.
FMILIB_EXPORT void jm_set_default_callbacks | ( | jm_callbacks * | c | ) |
Set the structure to be returned by jm_get_default_callbacks().
c | - a pointer to initialized struct to be used as default later on. If this is NULL library default implementation will be used. |
FMILIB_EXPORT jm_callbacks* jm_get_default_callbacks | ( | void | ) |
Get default callbacks. The function never returns NULL.
FMILIB_EXPORT void jm_default_logger | ( | jm_callbacks * | c, |
jm_string | module, | ||
jm_log_level_enu_t | log_level, | ||
jm_string | message | ||
) |
The default logger implementation prints messages to stderr.
FMILIB_EXPORT void jm_log | ( | jm_callbacks * | cb, |
const char * | module, | ||
jm_log_level_enu_t | log_level, | ||
const char * | fmt, | ||
... | |||
) |
Send a message to the logger function.
cb | - callbacks to be used for reporting; |
module | - a name of reporting module; |
log_level | - message kind; |
fmt | - "printf" type of format followed by the arguments. |
FMILIB_EXPORT void jm_log_v | ( | jm_callbacks * | cb, |
const char * | module, | ||
jm_log_level_enu_t | log_level, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Send a message to the logger function.
cb | - callbacks to be used for reporting; |
module | - a name of reporting module; |
log_level | - message kind; |
fmt | - "printf" type of format followed by the arguments. |
ap | - variable size argument list. |
FMILIB_EXPORT void jm_log_fatal_v | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Send a fatal error message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_fatal | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
... | |||
) |
Send a fatal error message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_error_v | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Send a error message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_error | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
... | |||
) |
Send a error message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_warning_v | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Send a warning message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_warning | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
... | |||
) |
Send a warning message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_info_v | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Send an info message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_info | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
... | |||
) |
Send an info message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_verbose_v | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Send a verbose message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_verbose | ( | jm_callbacks * | cb, |
const char * | module, | ||
const char * | fmt, | ||
... | |||
) |
Send a verbose message to the logger function. See jm_log() for details.
|
static |
Send a debug message to the logger function. See jm_log() for details.
Note that the function is only active if the library is configure with FMILIB_ENABLE_LOG_LEVEL_DEBUG=ON
Definition at line 208 of file jm_callbacks.h.
|
static |
Send a debug message to the logger function. See jm_log() for details.
Note that the function is only active if the library is configure with FMILIB_ENABLE_LOG_LEVEL_DEBUG=ON
Definition at line 213 of file jm_callbacks.h.