sos_capi_common.h File Reference
Last update: 16.07.2025C-API for utility functions (load/unload library, license management, error handling) More...
Go to the source code of this file.
Enumerations | |
Public type definitions | |
Pubic type definitions used within this API | |
| enum | fmop_error_t { fmop_success = 0 , fmop_invalid_handle = 1 , fmop_exception_occurred = 2 , fmop_settings_error = 3 , fmop_model_missing = 4 , fmop_license_error = 5 , fmop_script_error = 6 , fmop_script_no_object = 7 , fmop_script_wrong_type = 8 , fmop_not_implemented = 16382 , fmop_const_max = 16383 } |
| Error code definitions. More... | |
| enum | fmop_license_t { fmop_mesh_signal = 10 , fmop_mesh_all = 30 } |
| FMOP mesh features which need to be unlocked by a valid license. More... | |
| enum | fmop_dataobject_types { fmop_node_data = 0 , fmop_element_data = 1 , fmop_scalar_data = 3 } |
| Data type definitions. More... | |
Functions | |
License handling | |
API handling licenes requests | |
| DYNARDO_FMOP_API fmop_error_t | FMOP_appendLicenseSearchPath (const char *abs_path) |
| Appends another license search path to the default ones. More... | |
| DYNARDO_FMOP_API fmop_error_t | FMOP_acquireLicense () |
| Acquires an optiSLang enterprise license. More... | |
| DYNARDO_FMOP_API bool | FMOP_licenseLocked () |
| Check whether any license feature was acquired. More... | |
| DYNARDO_FMOP_API fmop_error_t | FMOP_releaseLicense () |
| Release the acquired license. More... | |
Error Handling | |
API to access and interpret recent data object error messages | |
| DYNARDO_FMOP_API const char * | FMOP_getLastErrorString () |
| Returns internal log messages of level warning and above. More... | |
| DYNARDO_FMOP_API fmop_error_t | FMOP_getLastErrno () |
| Returns the error number which has been set at the last library call. More... | |
| DYNARDO_FMOP_API const char * | FMOP_getLastErrnoString () |
| Returns a pointer to a string that describes the error code which has been set at the last library call. More... | |
| DYNARDO_FMOP_API const char * | FMOP_getLastLogString () |
| Returns internal log messages of log levels defined by FMOP_setLogLevel. Serves as debug logger. More... | |
| DYNARDO_FMOP_API int | FMOP_setLogLevel (int log_level) |
| Defines the new log level filter. Valid for all subsequent library calls until a new log level gets set. More... | |
| DYNARDO_FMOP_API const char * | FMOP_getErrnoString (fmop_error_t error_num) |
| Returns a string description for the error number given. More... | |
Miscellaneous | |
| DYNARDO_FMOP_API const char * | FMOP_getVersionString () |
| Returns a version string. More... | |
FMOP library handling | |
| DYNARDO_FMOP_API fmop_error_t | FMOP_initializeLibrary () |
| Initialize the FMOP library Allocates memory for the global script engine. Call FMOP_unloadLibrary() to release it. A warning is logged if the library was initialized already. More... | |
| DYNARDO_FMOP_API fmop_error_t | FMOP_unloadLibrary () |
| Unload the FMOP library Clears the FMOP library from memory. A warning is logged if the library was unloaded already. | |
Detailed Description
C-API for utility functions (load/unload library, license management, error handling)
- Copyright
- DYNARDO Austria GmbH
Enumeration Type Documentation
◆ fmop_dataobject_types
◆ fmop_error_t
| enum fmop_error_t |
Error code definitions.
◆ fmop_license_t
| enum fmop_license_t |
Function Documentation
◆ FMOP_acquireLicense()
| DYNARDO_FMOP_API fmop_error_t FMOP_acquireLicense | ( | ) |
Acquires an optiSLang enterprise license.
- Returns
- fmop_settings_error if a license has already been acquired successfully
- fmop_exception_occurred if any error occures while checking out the requested feature(s)
- fmop_success if a license has been acquired successfully
- Call FMOP_getErrnoString() to get a human readable representation
◆ FMOP_appendLicenseSearchPath()
| DYNARDO_FMOP_API fmop_error_t FMOP_appendLicenseSearchPath | ( | const char * | abs_path | ) |
Appends another license search path to the default ones.
By default the following license search paths will be checked in the order given:
- @localhost
- the current working directory
- the path pointed to by the environment variable 'LM_LICENSE_FILE'
- the path pointed to by the environment variable 'DYNARDO_LICENSE_FILE'
- Parameters
-
[in] abs_path An absolute file system path, e.g. '/opt/DYNARDO/licensing', 'D:\Licenses', ...
- Returns
- fmop_settings_error if the path given does not exist
- fmop_exception_occurred if the path given invoces any other filesystem error
- fmop_success if the path has been appended successfully
- Call FMOP_getErrnoString() to get a human readable representation
◆ FMOP_getErrnoString()
| DYNARDO_FMOP_API const char* FMOP_getErrnoString | ( | fmop_error_t | error_num | ) |
Returns a string description for the error number given.
- Parameters
-
[in] error_num The error number
- Returns
- A human readable string description for the error number given.The returned string will be overwritten by this function at the next call and will be destroyed on program termination
- Note
- Calling this function will neither manipulate the internal log message stack nor the errno state of the last library call
- DON'T USE ERRNO as agrument identifier as this seems to be defined as a macro identifier Refer to http://www.cplusplus.com/reference/cerrno/errno/ for details
◆ FMOP_getLastErrno()
| DYNARDO_FMOP_API fmop_error_t FMOP_getLastErrno | ( | ) |
Returns the error number which has been set at the last library call.
- Returns
- The error number which has been set at the last library call
◆ FMOP_getLastErrnoString()
| DYNARDO_FMOP_API const char* FMOP_getLastErrnoString | ( | ) |
Returns a pointer to a string that describes the error code which has been set at the last library call.
- Returns
- A human readable string description for the error code that has been set at the last library call. The returned string will be overwritten by this function at the next call and will be destroyed on program termination
- Note
- Calling this function will neither manipulate the internal log message stack nor the errno state of the last library call
◆ FMOP_getLastErrorString()
| DYNARDO_FMOP_API const char* FMOP_getLastErrorString | ( | ) |
Returns internal log messages of level warning and above.
This log level is immutable. FMOP_setLogLevel() can not modify it. If the internal logger is empty, the value of FMOP_getLastErrnoString() will be returned
- Returns
- Returns all internal, formatted log messages of log level warning and above if either a warning or an error message occured during the last library call. Otherwise the return value of FMOP_getLastErrnoString() will be returned. The returned string will be overwritten by this function at its next call and will be destroyed on program termination
- Note
- Calling this function will neither manipulate the internal log message stack nor the errno state of the last library call
◆ FMOP_getLastLogString()
| DYNARDO_FMOP_API const char* FMOP_getLastLogString | ( | ) |
Returns internal log messages of log levels defined by FMOP_setLogLevel. Serves as debug logger.
Initially all log levels are deactivated and no log messages will be buffered. Call FMOP_setLogLevel ( >0 ) to activate the logger and FMOP_setLogLevel (0) to deactivate it again.
- Returns
- Returns all internal, formatted log messages of the last library call. The returned string will be overwritten by this function at the next call and will be destroyed on program termination
- Note
- Calling this function will not manipulate the internal log message stack. Though the errno number will be set and can be queried calling FMOP_getLastErrno()
◆ FMOP_getVersionString()
| DYNARDO_FMOP_API const char* FMOP_getVersionString | ( | ) |
Returns a version string.
- Returns
- A const pointer to a character array holding the version string. Ownership is handled internally.
- Note
- Calling this function will not manipulate the internal log message stack. Though the errno number will be set and can be queried calling FMOP_getLastErrno()
◆ FMOP_initializeLibrary()
| DYNARDO_FMOP_API fmop_error_t FMOP_initializeLibrary | ( | ) |
Initialize the FMOP library Allocates memory for the global script engine. Call FMOP_unloadLibrary() to release it. A warning is logged if the library was initialized already.
- Note
- This method must be called once, before requesting the global script engine with FMOP_globalScriptEngine();
◆ FMOP_licenseLocked()
| DYNARDO_FMOP_API bool FMOP_licenseLocked | ( | ) |
Check whether any license feature was acquired.
- Returns
- True if any license feature is locked, false otherwise
◆ FMOP_releaseLicense()
| DYNARDO_FMOP_API fmop_error_t FMOP_releaseLicense | ( | ) |
Release the acquired license.
Note, that no previously acquired license is released if not all loaded Database and FMOP objects are already released
- Returns
- fmop_settings_error if any Database or FMOP object is not already released
- fmop_success in all other cases
- Call FMOP_getErrnoString() to get a human readable representation
◆ FMOP_setLogLevel()
| DYNARDO_FMOP_API int FMOP_setLogLevel | ( | int | log_level | ) |
Defines the new log level filter. Valid for all subsequent library calls until a new log level gets set.
- Parameters
-
[in] log_level Defines the new log level filter for messages returned by FMOP_getLastLog. Accepts the following integer values only: - 0 ... filter all log levels
- 1 ... return only log messages of log level ERROR
- 2 ... return only log messages of log level WARNING and below
- 3 ... return only log messages of log level INFO and below
- 4 ... return only log messages of log level DEBUG and below
- 5 ... return all log messages, i.e. ERROR, WARNING INFO, DEBUG, TRACE. The log level TRACE is not existing in maintenance, i.e. in customer builds.
- Returns
- The former log level or -1 if the log_level is unknown
- Note
- Calling this function will not manipulate the internal log message stack. Though the errno number will be set and can be queried calling FMOP_getLastErrno()