![]() |
Public API Reference |
![]() |
This is the standard implementation of the plugin manager. More...
#include <csutil/plugmgr.h>
Public Member Functions | |
virtual void | Clear () |
Unload all plugins from this plugin manager. | |
csPluginManager (iObjectRegistry *object_reg) | |
Initialize plugin manager. | |
csPtr< iStringArray > | GetClassIDTags (const char *classID) |
Get all tags mapped to that class ID. | |
virtual csPtr< iPluginIterator > | GetPluginInstances () |
Get an iterator to iterate over all loaded plugins in the plugin manager. | |
const char * | GetTagClassIDMapping (const char *tag) |
Get the class ID mapped to a tag. | |
virtual csPtr< iComponent > | LoadPluginInstance (const char *iClassID, uint flags) |
Load a plugin (optionally loading dependencies) and (optionally) initialize it. | |
csPtr< iComponent > | LoadTagPluginInstance (const char *tag, uint loadFlags) |
Load a plugin for a tag. | |
virtual void | QueryOptions (iComponent *iObject) |
Query all options supported by given plugin and place into OptionList. | |
virtual csPtr< iComponent > | QueryPluginInstance (const char *iInterface, int iVersion) |
Get one of the loaded plugins that supports given interface ID. | |
csPtr< iComponent > | QueryPluginInstance (const char *classID) |
Find a plugin given its class ID. | |
virtual csPtr< iComponent > | QueryPluginInstance (const char *iClassID, const char *iInterface, int iVersion) |
Find a plugin given its class ID. | |
csPtr< iComponent > | QueryTagPluginInstance (const char *tag) |
Query a plugin for a tag. | |
virtual bool | RegisterPluginInstance (const char *iClassID, iComponent *iObject) |
Register a object that implements the iComponent interface as a plugin. | |
bool | SetTagClassIDMapping (const char *tag, const char *classID) |
Set the class ID mapped to an object registry tag. | |
virtual bool | UnloadPluginInstance (iComponent *iObject) |
Remove a plugin from the plugin manager's plugin list. | |
bool | UnsetTagClassIDMapping (const char *tag) |
Remove a class ID mapping for a tag. | |
virtual | ~csPluginManager () |
Destruct. |
This is the standard implementation of the plugin manager.
The plugin manager is thread-safe.
csPluginManager::csPluginManager | ( | iObjectRegistry * | object_reg | ) |
Initialize plugin manager.
virtual csPluginManager::~csPluginManager | ( | ) | [virtual] |
Destruct.
virtual void csPluginManager::Clear | ( | ) | [virtual] |
Unload all plugins from this plugin manager.
Implements iPluginManager.
csPtr<iStringArray> csPluginManager::GetClassIDTags | ( | const char * | classID | ) | [virtual] |
Get all tags mapped to that class ID.
classID can be wildcard (ending in '.') which means all class IDs starting with classID are considered,
Implements iPluginManager.
virtual csPtr<iPluginIterator> csPluginManager::GetPluginInstances | ( | ) | [virtual] |
Get an iterator to iterate over all loaded plugins in the plugin manager.
This iterator will contain a copy of the plugins so it will not lock the plugin manager while looping over the plugins.
Implements iPluginManager.
const char* csPluginManager::GetTagClassIDMapping | ( | const char * | tag | ) | [inline, virtual] |
Get the class ID mapped to a tag.
Implements iPluginManager.
virtual csPtr<iComponent> csPluginManager::LoadPluginInstance | ( | const char * | classID, |
uint | loadFlags | ||
) | [virtual] |
Load a plugin (optionally loading dependencies) and (optionally) initialize it.
If the lpiInitialize flag is given then the plugin will be initialized (that is, the iComponent's Initialize() method is called) and QueryOptions() will be called. This is risky. In a multi-threaded situation two threads may request the same plugin (almost) simultaneously; if one thread does not request initialization, but another thread does (and assumes to get an initialized instance), the other thread may in fact receive an uninitialized instance (and likely break). Use this flag with caution! If the lpiReportErrors flag is given then loading failures are reported using the reporter. If the lpiLoadDependencies flag is given dependent plugins (as specified in the plugin's metadata) will be loaded as well. Note that dependencies are *always* loaded.
classID | Class ID of the plugin to load. |
loadFlags | Load options. |
Implements iPluginManager.
csPtr<iComponent> csPluginManager::LoadTagPluginInstance | ( | const char * | tag, |
uint | loadFlags | ||
) | [inline, virtual] |
Load a plugin for a tag.
Canonically equivalent to LoadTagPluginInstance ( GetTagClassIDMapping (tag), loadFlags).
Implements iPluginManager.
virtual void csPluginManager::QueryOptions | ( | iComponent * | iObject | ) | [virtual] |
Query all options supported by given plugin and place into OptionList.
Implements iPluginManager.
virtual csPtr<iComponent> csPluginManager::QueryPluginInstance | ( | const char * | iInterface, |
int | iVersion | ||
) | [virtual] |
Get one of the loaded plugins that supports given interface ID.
Implements iPluginManager.
csPtr<iComponent> csPluginManager::QueryPluginInstance | ( | const char * | classID | ) | [virtual] |
Find a plugin given its class ID.
Implements iPluginManager.
virtual csPtr<iComponent> csPluginManager::QueryPluginInstance | ( | const char * | classID, |
const char * | iInterface, | ||
int | iVersion | ||
) | [virtual] |
Find a plugin given its class ID.
Implements iPluginManager.
csPtr<iComponent> csPluginManager::QueryTagPluginInstance | ( | const char * | tag | ) | [inline, virtual] |
Query a plugin for a tag.
Canonically equivalent to QueryPluginInstance (GetTagClassIDMapping (tag)).
Implements iPluginManager.
virtual bool csPluginManager::RegisterPluginInstance | ( | const char * | classID, |
iComponent * | obj | ||
) | [virtual] |
Register a object that implements the iComponent interface as a plugin.
Implements iPluginManager.
bool csPluginManager::SetTagClassIDMapping | ( | const char * | tag, |
const char * | classID | ||
) | [inline, virtual] |
Set the class ID mapped to an object registry tag.
Tag mappings are used in dependency resolution while plugin loading.
Implements iPluginManager.
virtual bool csPluginManager::UnloadPluginInstance | ( | iComponent * | obj | ) | [virtual] |
Remove a plugin from the plugin manager's plugin list.
Implements iPluginManager.
bool csPluginManager::UnsetTagClassIDMapping | ( | const char * | tag | ) | [inline, virtual] |
Remove a class ID mapping for a tag.
Implements iPluginManager.