cx_plugin
Base class for CLIPS plugins
README
cx_plugin
Base class for all CLIPS plugins.
CLIPS plugins are plugins that can be dynamically loaded by the CX plugin manager to interface with CLIPS Environments via the CLIPS C API (see the Advanced Programming Guide at clipsrules.net.
The most common usage is to provide user-defined functions or external data to CLIPS, e.g., protobuf messages along with functions to access their content.
As an example package that can serve as a boilerplate, please have a look at the cx_example_plugin package.
Writing a CLIPS Plugin
As CLIPS plugins are realized via pluginlib, it boils down to building a plugin and exporting it’s information properly.
Write a plugin class that inherits from the ClipsPlugin base class provided here.
Export the plugin via
PLUGINLIB_EXPORT_CLASS
.Export a plugin description via cmake
pluginlib_export_plugin_description_file
with base class packagecx_plugin
.
In the following, the virtual functions and their purpose are described.
initialize()
This function is called exactly once when a plugin is loaded, before it actually provides it’s features to CLIPS environments.
Typical uses include
Reading of parameters from specified in the parent node.
Initialization of Environmnent-agnostic class members.
finalize()
This function is called exactly once when a plugin is finally unloaded again, hence all resources should be freed for a graceful destruction of the object.