CrystalSpace

Public API Reference

csPluginManager Class Reference

This is the standard implementation of the plugin manager. More...

#include <csutil/plugmgr.h>

Inheritance diagram for csPluginManager:

List of all members.

Public Member Functions

virtual void Clear ()
 Unload all plugins from this plugin manager.
 csPluginManager (iObjectRegistry *object_reg)
 Initialize plugin manager.
csPtr< iStringArrayGetClassIDTags (const char *classID)
 Get all tags mapped to that class ID.
virtual csPtr< iPluginIteratorGetPluginInstances ()
 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< iComponentLoadPluginInstance (const char *iClassID, uint flags)
 Load a plugin (optionally loading dependencies) and (optionally) initialize it.
csPtr< iComponentLoadTagPluginInstance (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< iComponentQueryPluginInstance (const char *iClassID, const char *iInterface, int iVersion)
 Find a plugin given its class ID.
csPtr< iComponentQueryPluginInstance (const char *classID)
 Find a plugin given its class ID.
virtual csPtr< iComponentQueryPluginInstance (const char *iInterface, int iVersion)
 Get one of the loaded plugins that supports given interface ID.
csPtr< iComponentQueryTagPluginInstance (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.

Detailed Description

This is the standard implementation of the plugin manager.

The plugin manager is thread-safe.

Definition at line 43 of file plugmgr.h.


Constructor & Destructor Documentation

csPluginManager::csPluginManager ( iObjectRegistry object_reg  ) 

Initialize plugin manager.

virtual csPluginManager::~csPluginManager (  )  [virtual]

Destruct.


Member Function Documentation

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.

Definition at line 199 of file plugmgr.h.

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.

Parameters:
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.

Definition at line 207 of file plugmgr.h.

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 *  classID,
const char *  iInterface,
int  iVersion 
) [virtual]

Find a plugin given its class ID.

Warning:
It is valid to load multiple plugin instances for the same plugin class IDs. If this is the case, querying for an instance of a plugin class ID will return a random loaded plugin instance.

Implements iPluginManager.

csPtr<iComponent> csPluginManager::QueryPluginInstance ( const char *  classID  )  [virtual]

Find a plugin given its class ID.

Warning:
It is valid to load multiple plugin instances for the same plugin class IDs. If this is the case, querying for an instance of a plugin class ID will return a random loaded plugin instance.

Implements iPluginManager.

virtual csPtr<iComponent> csPluginManager::QueryPluginInstance ( const char *  iInterface,
int  iVersion 
) [virtual]

Get one of the loaded plugins that supports given interface ID.

Warning:
Usage of this function is usually not safe since multiple plugins can implement the same interface and there is no way to know which one is the correct one. This method will return a random plugin providing the given interface. It is usually better to use the object registry to obtain components with a certain interface.

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.

Definition at line 213 of file plugmgr.h.

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.

Definition at line 185 of file plugmgr.h.

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.

Definition at line 193 of file plugmgr.h.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1