Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
Plugin Struct Reference

A Plugin is a dynamically-loaded component to provide a piece of functionality. More...

#include <plugin.h>

Collaboration diagram for Plugin:
[legend]

Public Member Functions

const GRASSROOTS_PLUGIN_API char * GetPluginConfigName (const Plugin *const plugin_p)
 Get the string with the platform-specific plugin parts e.g. More...
 
GRASSROOTS_PLUGIN_API PluginAllocatePlugin (const char *const path_s, struct GrassrootsServer *server_p)
 The following functions are platform-specific. More...
 
GRASSROOTS_PLUGIN_API void FreePlugin (Plugin *const plugin_p)
 Free a Plugin. More...
 
GRASSROOTS_PLUGIN_API bool OpenPlugin (Plugin *const plugin_p)
 Open a Plugin in preparation for getting the actual component. More...
 
GRASSROOTS_PLUGIN_API void ClosePlugin (Plugin *const plugin_p)
 Close a Plugin. More...
 
GRASSROOTS_PLUGIN_API void * GetSymbolFromPlugin (Plugin *plugin_p, const char *const symbol_s)
 Get a symbol from a Plugin. More...
 
GRASSROOTS_PLUGIN_API char * DeterminePluginName (const char *const full_plugin_path_s)
 Get the platform-independent Plugin name from a platform-specific filename possibly spanning multiple directories. More...
 
GRASSROOTS_PLUGIN_API char * MakePluginName (const char *const name_s)
 Make the platform-specific filename for a given Plugin name. More...
 
GRASSROOTS_PLUGIN_API void IncrementPluginOpenCount (Plugin *plugin_p)
 Increment the number of objects that this Plugin has open. More...
 
GRASSROOTS_PLUGIN_API void DecrementPluginOpenCount (Plugin *plugin_p)
 Decrement the number of objects that this Plugin has open. More...
 
GRASSROOTS_PLUGIN_API void ClearPluginValue (Plugin *const plugin_p)
 Clear all values in a given Plugin ready for it to be reused. More...
 

Data Fields

char * pl_path_s
 The path of the plugin. More...
 
MEM_FLAG pl_path_mem
 Memory ownership of the path variable. More...
 
char * pl_name_s
 A multi-platform name for the Plugin. More...
 
PluginStatus pl_status
 The current status of the Plugin. More...
 
PluginNature pl_type
 The type of this Plugin e.g. More...
 
PluginValue pl_value
 The data specific for the PluginNature of this Plugin. More...
 
int32 pl_open_count
 The count of how many current tasks have this Plugin open. More...
 
struct GrassrootsServerpl_server_p
 

Detailed Description

A Plugin is a dynamically-loaded component to provide a piece of functionality.

The plugin is stored in a platform-specific container e.g. a .dll on Windows, a .so on Unix, etc.

Member Function Documentation

◆ GetPluginConfigName()

const GRASSROOTS_PLUGIN_API char * GetPluginConfigName ( const Plugin *const  plugin_p)

Get the string with the platform-specific plugin parts e.g.

*.dll for windows, lib*.so for unix. for use in the configuration hash table.

Parameters
plugin_pThe Plugin to get the config string for.
Returns
A read-only string containing the config string or NULL upon error.

◆ AllocatePlugin()

GRASSROOTS_PLUGIN_API Plugin * AllocatePlugin ( const char *const  path_s,
struct GrassrootsServer server_p 
)

The following functions are platform-specific.

Allocate a new Plugin.

Parameters
path_sThe path to the file where the Plugin will be loaded from.
Returns
A newly-allocated Plugin or NULL upon error.
See also
FreePlugin

◆ FreePlugin()

GRASSROOTS_PLUGIN_API void FreePlugin ( Plugin *const  plugin_p)

Free a Plugin.

Parameters
plugin_pThe plugin to free.
See also
FreePlugin

◆ OpenPlugin()

GRASSROOTS_PLUGIN_API bool OpenPlugin ( Plugin *const  plugin_p)

Open a Plugin in preparation for getting the actual component.

This checks that the Plugin is a valid platfrom-specific module.

Parameters
plugin_pThe Plugin to open.
Returns
true if the Plugin was opened succesfully, false otherwise.
See also
ClosePlugin

◆ ClosePlugin()

GRASSROOTS_PLUGIN_API void ClosePlugin ( Plugin *const  plugin_p)

Close a Plugin.

Parameters
plugin_pThe Plugin to close.
Returns
true if the Plugin was closed succesfully, false otherwise.
See also
OpenPlugin

◆ GetSymbolFromPlugin()

GRASSROOTS_PLUGIN_API void * GetSymbolFromPlugin ( Plugin plugin_p,
const char *const  symbol_s 
)

Get a symbol from a Plugin.

This is used to get a given function name from a Plugin.

Parameters
plugin_pThe Plugin to get the symbol from.
symbol_sThe symbol to get.
Returns
A pointer to the symbol's code or NULL upon error.

◆ DeterminePluginName()

GRASSROOTS_PLUGIN_API char * DeterminePluginName ( const char *const  full_plugin_path_s)

Get the platform-independent Plugin name from a platform-specific filename possibly spanning multiple directories.

For example, on Unix foo/bar/libmy_module.xso would return my_module

Parameters
full_plugin_path_sThe name to use to get the platform-specific plugin name.
Returns
The platform-independent Plugin name which will be need to be freed with FreeCopiedString when finished with to avoid a memory leak. Upon error, this will return NULL
See also
FreeCopiedString

◆ MakePluginName()

GRASSROOTS_PLUGIN_API char * MakePluginName ( const char *const  name_s)

Make the platform-specific filename for a given Plugin name.

Parameters
name_sThe name to use to get the platform-specific plugin name.
Returns
The filename which will be need to be freed with FreeCopiedString when finished with to avoid a memory leak. Upon error, this will return NULL
See also
FreeCopiedString

◆ IncrementPluginOpenCount()

GRASSROOTS_PLUGIN_API void IncrementPluginOpenCount ( Plugin plugin_p)

Increment the number of objects that this Plugin has open.

Parameters
plugin_pThe Plugin to alter.

◆ DecrementPluginOpenCount()

GRASSROOTS_PLUGIN_API void DecrementPluginOpenCount ( Plugin plugin_p)

Decrement the number of objects that this Plugin has open.

If the open count falls to zero then the Plugin will be freed.

Parameters
plugin_pThe Plugin to alter.

◆ ClearPluginValue()

GRASSROOTS_PLUGIN_API void ClearPluginValue ( Plugin *const  plugin_p)

Clear all values in a given Plugin ready for it to be reused.

Parameters
plugin_pThe Plugin to clear.

Field Documentation

◆ pl_path_s

char* pl_path_s

The path of the plugin.

◆ pl_path_mem

MEM_FLAG pl_path_mem

Memory ownership of the path variable.

See also
pl_path_s

◆ pl_name_s

char* pl_name_s

A multi-platform name for the Plugin.

◆ pl_status

PluginStatus pl_status

The current status of the Plugin.

◆ pl_type

PluginNature pl_type

The type of this Plugin e.g.

Client, Service, etc.

◆ pl_value

PluginValue pl_value

The data specific for the PluginNature of this Plugin.

◆ pl_open_count

int32 pl_open_count

The count of how many current tasks have this Plugin open.

◆ pl_server_p

struct GrassrootsServer* pl_server_p

The documentation for this struct was generated from the following file: