API overview
SmartCGMS is a framework with one central element - the scgms
library. This library, formerly known as scgms factory
, is an entry point for creating and managing SmartCGMS entities, configuring and controlling the simulation
and resource management. The library itself is compiled as a dynamic library (scgms.dll
on MS Windows, libscgms.so
on Linux-based systems, libscgms.dylib
on macOS, etc.) and exports a number of functions, further listed on
a separate page. These functions are often called through the supplied C++ SDK.
The SmartCGMS entity API definition consist of two basic interface definitions:
- library interface - a library must export a set of functions to indicate, that it contains the implementation of given entity and is able to create an instance of it
- entity interface - any entity must comply with the interface definition of its kind (e.g.; filter must implement
scgms::IFilter
interface, etc.)
The scgms
library expects the following directory structure (demonstrated on MS Windows naming conventions):
filters
customfilter.dll
data.dll
metrics.dll
- ...
scgms.dll
frontend.exe
(optional, just to demonstrate the usual placement)
scgms
library loads only dynamic libraries, placed in the filters
subdirectory, following the platform-specific shared object
naming conventions.
For example, if a developer intends to introduce a new filter, he has to create a new dynamic library (or enhance an existing one), export do_get_filter_descriptors
and do_create_filter
and place it into the filters directory just
next to the library itself. The scgms
library then registers the newly created dynamic library as a part of SmartCGMS and loads descriptors from it. The developer then
needs to create a descriptor of the entity he intend to implement, assign an unique GUID (preferably using a generator) and let the appropriate function return it. When the user
creates a configuration, that contains the newly developed filter, the scgms
library calls the matching create_filter
function. The developer thus needs to
implement this function to create a new entity, complying with the scgms::IFilter
interface (further described here).