8. Plugin Manager, Plugin Settings - PluginManager , PluginSetting

The PluginManager module facilitates loading operations of plugin that will be used with the PluginLib object. Operation includes loading plugins, closing the loaded plugins, and setting the plugin log verbosity. Any plugin loaded with the PluginManager and not explicitly closed can be used through the PluginLib object and the LMan object.

The methods associated with a PluginManager object are the following.

Instance a PluginManager object using vdm_PluginLibBegin(). Once instanced set pointers to abstract data functions using vdm_PluginLibDataFun().

8.1. Function Descriptions

The currently available PluginManager functions are described in detail in this section.

vdm_PluginManager *vdm_PluginManagerBegin(void)

create an instance of a PluginManager object

Create an instance of a PluginManager object. Memory is allocated for the object private data and the pointer to the data is returned.

Destroy an instance of a PluginManager object using

void vdm_PluginManagerEnd (vdm_PluginManager *PluginManager)

Return the current value of a PluginManager object error flag using

Vint vdm_PluginManagerError (vdm_PluginManager *PluginManager)

Returns:

The function returns a pointer to the newly created PluginManager object. If the object creation fails, NULL is returned.

void vdm_PluginManagerEnd(vdm_PluginManager *p)

end an instance of a PluginManager object

See vdm_PluginManagerBegin()

void vdm_PluginManagerShutdown(vdm_PluginManager *p)

clear the current instance of loaded plugins

void vdm_PluginManagerLoadPlugin(vdm_PluginManager *p, Vchar *pathToPluginLibraryWithoutExtension)

load a pluginlibrary

Load a pluginlibrary. The path to the plugin library to load must not include the library extension: .dll, .so or .dylib.

Parameters:
  • p – Pointer to PluginManager object.

  • pathToPluginLibraryWithoutExtension – Path to the plugin to load.

void vdm_PluginManagerLoadPluginSettings(vdm_PluginManager *p, Vchar *fileMask, vdm_PluginSettings *pluginSettings)

return the plugin settings (initialization options)

Load the initialization options a given plugin can have. The plugin must have been already Loaded This initialization options can be used to specify the behavior of a given plugin if injected in the vdm_dataFunApplySettings using the vdm_Setting object.

Parameters:
  • p – Pointer to PluginManager object.

  • fileMask – Vchar extension i.e (“.vtu”) to identify from the loaded plugins.

  • pluginSettings – Pointer to PluginSettings object.

Returns:

initialized plugin options container PluginOptions

Vint vdm_PluginManagerError(vdm_PluginManager *p)

return the current value of a PluginManager object error flag

Report total number of errors notified. This will reset the counter to zero after

Parameters:

p – Pointer to PluginManager object.

Returns:

Integer error count

void vdm_PluginManagerSetErrorLevel(vdm_PluginManager *p, Vint errorLevel)

set plugin manager error level

Parameters:
  • p – Pointer to PluginManager object.

  • errorLevel – Error level for the plugin manager

    =0     No log (default)
    =1     Error
    =2     Warning
    =3     Info
    =4     Debug
    

Vint vdm_PluginManagerGetErrorLevel(vdm_PluginManager *p)

return plugin manager error level

Parameters:

p – Pointer to PluginManager object.

Returns:

Integer error level

The PluginSettings module facilitates loading dynamically the initialization options of a plugin previously loaded uisng the PluginManager. Those settings can be edited and injected to configure the opening behvior of the PluginLib object.

The methods associated with a PluginSettings object are the following.

Instance a PluginSettings object using vdm_PluginSettingsBegin(). Once instanced set pointers to abstract data functions using vdm_PluginMangagerLoadPluginSettings().

8.2. Function Descriptions

The currently available PluginSettings functions are described in detail in this section.

vdm_PluginSettings *vdm_PluginSettingsBegin(void)

create an instance of a PlugingSettings object

Create an instance of a PluginSettings object. Memory is allocated for the object private data and the pointer to the data is returned.

Destroy an instance of a PluginSettings object using

void vdm_PluginSettingsEnd (vdm_PlugingSettings *plugingsettings)

Returns:

The function returns a pointer to the newly created PluginSettings object. If the object creation fails, NULL is returned.

void vdm_PluginSettingsEnd(vdm_PluginSettings *p)

destroy an instance of a PluginSettings object

See vdm_PluginSettingsBegin()

Vint vdm_PluginSettingsError(vdm_PluginSettings *p)

return the current value of a PluginSettings object error flag

See vdm_PluginSettingsBegin()

void vdm_PluginSettingsDef(vdm_PluginSettings *p, Vchar *idstring)

define string identifier for the settings

Suggest a name for the plugin settings. Usually the name used is the providerId

Find the idstring name which may be managed with the presently allocated storage using

void vdm_PluginSettingsInq (const vdm_PluginSettings *p,
                      Vchar *idstring)

Parameters:
  • p – Pointer to DblHash object.

  • idstring – name to identify the current plugin settings

void vdm_PluginSettingsInq(vdm_PluginSettings *p, Vchar *idstring)

get the name identifier storage

See vdm_PluginSettingsDef()

Vint vdm_PluginSettingsCount(vdm_PluginSettings *p, Vint *integerkeyCount, Vint *doublekeyCount, Vint *stringkeyCount)

get number of contained keys

Get the number of total keys as well as the number of integer, doubles and string keys which have been inserted using method Push.

Parameters:
  • p – Pointer to PluginSettings object.

  • return[out] Number of total keys held the in PluginSettings object.

  • integerkeyCount[out] Number of integer keys held the in PluginSettings object.

  • doublekeyCount[out] Number of double keys held the in PluginSettings object.

  • stringkeyCount[out] Number of string keys held the in PluginSettings object.

void vdm_PluginSettingsGetInteger(vdm_PluginSettings *p, Vint intergerIndex, Vchar *key, Vchar *description, Vint *value)

find the integer at a specified location

Get the integer value associated the specified key. Returns a SYS_INT_UNDEFINED value if no data has been entered with this key.

Parameters:
  • p – Pointer to PluginSettings object.

  • intergerIndex – Integer index values.

  • description[out] string description associated with key.

  • value[out] Integer value associated with key.

void vdm_PluginSettingsPushInteger(vdm_PluginSettings *p, Vchar *key, Vchar *description, Vint value)

place an integer in the settings container

Place the integer value in the PluginSettings object. Associate the integer key value with this new integer, and replace any integer which may have been previously associated with this same key.

The only mandatory fields are the key and the value. The description is used to help the caller to understand better what the given key is suppose to do for the plugin.

Parameters:
  • p – Pointer to PluginSettings object.

  • key – string value used as key .

  • description – string value used as description .

  • value – Integer, used as value

void vdm_PluginSettingsGetDouble(vdm_PluginSettings *p, Vint doubleIndex, Vchar *key, Vchar *description, Vdouble *value)

find the double at a specified location

Get the double value associated the specified key. Returns a SYS_DOUBLE_UNDEFINED value if no data has been entered with this key.

Parameters:
  • p – Pointer to PluginSettings object.

  • intergerIndex – Integer index values.

  • description[out] string description associated with key.

  • value[out] double value associated with key.

void vdm_PluginSettingsPushDouble(vdm_PluginSettings *p, Vchar *key, Vchar *description, double value)

place an double in the settings container

Place the double value in the PluginSettings object. Associate the double key value with this new double, and replace any double which may have been previously associated with this same key.

The only mandatory fields are the key and the value. The description is used to help the caller to understand better what the given key is suppose to do for the plugin.

Parameters:
  • p – Pointer to PluginSettings object.

  • key – string value used as key .

  • description – string value used as description .

  • value – double, used as value

void vdm_PluginSettingsGetString(vdm_PluginSettings *p, Vint stringIndex, Vchar *key, Vchar *description, Vchar *value)

find the string at a specified location

Get the string value associated the specified key. Returns a null string value if no data has been entered with this key.

Parameters:
  • p – Pointer to PluginSettings object.

  • intergerIndex – Integer index values.

  • description[out] string description associated with key.

  • value[out] string value associated with key.

void vdm_PluginSettingsPushString(vdm_PluginSettings *p, Vchar *key, Vchar *description, Vchar *value)

place an string in the settings container

Place the string value in the PluginSettings object. Associate the string key value with this new string, and replace any string which may have been previously associated with this same key.

The only mandatory fields are the key and the value. The description is used to help the caller to understand better what the given key is suppose to do for the plugin.

Parameters:
  • p – Pointer to PluginSettings object.

  • key – string value used as key .

  • description – string value used as description .

  • value – string, used as value

void vdm_PluginSettingsPrint(vdm_PluginSettings *p)

print the content of the settings container

Print using printf() the content of the plugin settings.

Parameters:

p – Pointer to PluginSettings object.