GemaCoreLib
The GeMA Core library
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GmPluginInfo Class Reference

Base class used to store information about a generic plugin. More...

#include <gmPluginInfo.h>

Collaboration diagram for GmPluginInfo:
Collaboration graph
[legend]

Public Member Functions

 ~GmPluginInfo ()
 Destructor.
 
QString path () const
 Returns the path to the shared library that implements this plugin.
 
QString name () const
 Returns the plugin name.
 
QString version () const
 Returns the optional plugin version from the Lua file, NOT from the plugin itself.
 
const QStringListcategoryList () const
 Returns the plugin type.
 
QString categoryStr () const
 Returns a comma separated string combining the names of all categories supported by this plugin.
 
int categoryIndex (QString cat) const
 Returns the index of the given category in the category list or -1 if not found.
 
const QStringListtypeList (int catIndex) const
 Returns a list with the object types implemented by the plugin for one entry in the categoryList.
 
int typeIndex (int catIndex, QString objType) const
 Returns the index of the given object type in the type list or -1 if not found.
 
QString typeName (int catIndex, int typeIndex) const
 Returns the full hierarchical type name for one entry in the typeList.
 
QString pluginLuaRsrc () const
 Returns the rsrc name for a set of Lua functions defined by the plugin or "" if the plugin does not have a Lua rsrc file.
 
QString pluginLuaTableName () const
 Returns the name of the Lua table used to host functions defined in the plugin rsrc (if it exists)
 
QString checkAttributesFunction () const
 Returns the name of the Lua function defined in the resource returned by pluginLuaRsrc() used to validate plugin attributes on model loading. Can be empty.
 
QString pluginDataCheckFunction () const
 Returns the name of the Lua function defined in the resource returned by pluginLuaRsrc() used to validate PluginData objects on model loading. Can be empty.
 
const QStringListpluginDataAliases () const
 Returns a list of aliases for PluginData objects understood by this plugin.
 
const QVariantMap & attributes () const
 Map with additional attributes describing the plugin and unused by the plugin manager.
 
const QStringListdependencies () const
 Returns a list of plugins that must be loaded before this plugin can be loaded to memory.
 
void printParameters (const GmLogCategory &logger)
 Prints plugin parameters to the logger.
 

Static Public Member Functions

static GmPluginInfoinstance (QString infoFileName, QString sharedFileName, const GmLogCategory &logger)
 Factory function used to load information from infoFileName and instanciate a GmPluginInfo object. More...
 
static void splitTypeName (QString typeName, QString &pluginName, QString &pluginType)
 Splits a type name, composed of a plugin name + "." + type name into its components. More...
 

Private Member Functions

 GmPluginInfo (QString name, const QStringList &category, QString version, const QList< QStringList > &typeList, QVariantMap pluginAttr, QString rsrc, QString checkFuncName, const QStringList &dependencies, QString pluginDataCheckFuncName, const QStringList &pluginDataAliases, QString sharedFilePath)
 Private constructor. More...
 

Private Attributes

QString _path
 Path to the plugin shared library.
 
QString _name
 Plugin name.
 
QString _version
 Plugin version (optional, from the Lua file, NOT from the plugin itself)
 
QStringList _categoryList
 Plugin category list.
 
QList< QStringList_typeList
 List of object types implemented by the plugin per category. Ordered as _categoryList.
 
QVariantMap _pluginAttributes
 Map with additional attributes provided by the plugin.
 
QString _pluginRsrc
 Rsrc containing a Lua script with functions used by the plugin.
 
QString _checkFunctionName
 Name of a Lua function used to validate plugin parameters.
 
QStringList _pluginDependencies
 List of plugins that should be loaded before this one. Can be empty.
 
QString _pluginDataCheckFunctionName
 Name of a Lua function used to validate associated plugin data.
 
QStringList _pluginDataAliases
 List of aliases for PluginData objects understood by this plugin.
 

Detailed Description

Base class used to store information about a generic plugin.

Instances of a plugin info object should be created by a call to GmPluginInfo::instance(). This function is a factory that will retrieve the appropriate information from the plugin description file and instanciate the PluginInfo object.

Basic plugin information is loaded from a Lua table containing the following known fields:

1) String defining the plugin name. REQUIRED. pluginName = "plugin name" 2) String / string list defining the plugin categories. REQUIRED. pluginCategory = "Physics" | "Mesh" | ... or pluginCategory = {"xxx", "yyy", ... } for a plugin exporting several categories See gmPluginCategory for a list of predefined values. Other values are accepted to support user defined categories. 3) String defining the plugin version. OPTIONAL pluginVersion = '0.01' 4) Table containing the names of the object types that can be instanciated by this plugin. REQUIRED. Should have at least one entry per category. objectTypes = { "type name 1", "type name 2", ... } for single category plugins. objectTypes = { {...}, {...}, ... } for multiple category plugins. 5) String defining the resource name containing 'private' Lua functions used by the plugin. OPTIONAL. pluginRsrc = ":/GeMA_Xxx/name.lua" 6) String defining the name of the Lua function used to check plugin attributes for correctness while loading a model. OPTIONAL. checkAttributesFunction = 'function name' 7) String defining the name of the Lua function used to check PluginData objects associated with this plugin for correctness while loading a model. OPTIONAL. checkPluginDataFunction = 'function name' 8) Table containing the names of plugin data object aliases associated with this plugin. Alias names should be unique across all the available plugins. OPTIONAL. pluginDataAliases = {'name1', 'name2', ...} 9) Table defining the set of plugins that this plugin depends upon. Those plugins must be loaded before this one. OPTIONAL. pluginDependencies = {'plugin1', 'plugin2', ...} 10) Table with additional attributes describing the plugin

Constructor & Destructor Documentation

◆ GmPluginInfo()

GmPluginInfo::GmPluginInfo ( QString  name,
const QStringList category,
QString  version,
const QList< QStringList > &  typeList,
QVariantMap  pluginAttr,
QString  rsrc,
QString  checkFuncName,
const QStringList dependencies,
QString  pluginDataCheckFuncName,
const QStringList pluginDataAliases,
QString  sharedFilePath 
)
private

Private constructor.

Parameters
namePlugin name
categoryList of the category of the objects that can be instanced by this plugin
versionPlugin version
typeListList of object types that can be instanced by this plugin. Must have the same size as category. Each entrie should be a list with the object types available for the category.
pluginAttrMap storing any additional atributes given in the plugin configuration file
rsrcName of the Qt resource storing auxiliary Lua functions used to help validate object parameters while parsing the simulation file
checkFuncNameName of the function defined in rsrc to validate object parameters
dependenciesList of plugins that this plugin depends upon.
pluginDataCheckFuncNameName of the function defined in rsrc to validate PluginData objects
pluginDataAliasesTHe set of alias names for plugin data objects understood by this plugin
sharedFilePathPath for the shared library

Member Function Documentation

◆ instance()

GmPluginInfo * GmPluginInfo::instance ( QString  infoFileName,
QString  sharedFileName,
const GmLogCategory logger 
)
static

Factory function used to load information from infoFileName and instanciate a GmPluginInfo object.

Parameters
infoFileNamePath to the information file describing the plugin
sharedFileNamePath to the shared library implementing the plugin
loggerLogger object used to log relevant messages
Returns
Returns a new GmPluginInfo object if successfull, NULL otherwise.

◆ splitTypeName()

void GmPluginInfo::splitTypeName ( QString  typeName,
QString pluginName,
QString pluginType 
)
static

Splits a type name, composed of a plugin name + "." + type name into its components.

If the input string(typeName) does not contains a dot, assumes that typeName is the pluginName


The documentation for this class was generated from the following files: