Tulip  4.6.0
Better Visualization Through Research
tlp::PluginLister Class Reference

#include <PluginLister.h>

+ Inheritance diagram for tlp::PluginLister:
+ Collaboration diagram for tlp::PluginLister:

List of all members.

Public Member Functions

template<typename PluginType >
std::list< std::string > availablePlugins ()
template<typename PluginType >
PluginType * getPluginObject (const std::string &name, tlp::PluginContext *context)
template<typename PluginType >
bool pluginExists (const std::string &pluginName)

Static Public Member Functions

static std::list< std::string > availablePlugins ()
static void checkLoadedPluginsDependencies (tlp::PluginLoader *loader)
static const std::list
< tlp::Dependency > & 
getPluginDependencies (const std::string &name)
static std::string getPluginLibrary (const std::string &name)
static tlp::PlugingetPluginObject (const std::string &name, tlp::PluginContext *context)
static const
ParameterDescriptionList
getPluginParameters (const std::string &name)
static tlp::PluginListerinstance ()
static bool pluginExists (const std::string &pluginName)
static const PluginpluginInformation (const std::string &name)
static const PluginpluginInformations (const std::string &name)
static void registerPlugin (FactoryInterface *objectFactory)
static void removePlugin (const std::string &name)

Static Public Attributes

static PluginLoadercurrentLoader

Protected Member Functions

void sendPluginAddedEvent (const std::string &pluginName)
void sendPluginRemovedEvent (const std::string &pluginName)

Static Protected Member Functions

static std::string getPluginRelease (const std::string &name)

Protected Attributes

std::map< std::string,
PluginDescription > 
_plugins

Static Protected Attributes

static PluginLister_instance

Detailed Description

The PluginLister class is a singleton used to list plugins currently loaded into Tulip and retrieve information about them.

This class holds various methods to check information about plugins currently loaded into Tulip. You can use it to list plugins, get dependencies information or create an instance of a plugin.

Note:
Since a plugin name is unique, Plugins are mainly identified by their name (tlp::Plugin::name()) when interfaced with the plugin lister.
See also:
tlp::Plugin
tlp::PluginLoader
tlp::PluginLibraryLoader

Definition at line 60 of file PluginLister.h.


Member Function Documentation

static std::list<std::string> tlp::PluginLister::availablePlugins ( ) [static]

Gets the list of plugins of a given type (template parameter). *.

Returns:
A std::list<std::string> containing the names of the plugins.

Checks if all registered plug-ins have their dependencies met.

Parameters:
loaderIf there are errors, the loader is informed about them so they can be displayed.
Returns:
void
static const std::list<tlp::Dependency>& tlp::PluginLister::getPluginDependencies ( const std::string &  name) [static]

Gets the dependencies of a plug-in.

Parameters:
nameThe name of the plug-in to retrieve the dependencies of.
Returns:
:list< tlp::Dependency, std::allocator< tlp::Dependency > > The list of dependencies of the plug-in.
static std::string tlp::PluginLister::getPluginLibrary ( const std::string &  name) [static]

Gets the library from which a plug-in has been loaded.

Parameters:
nameThe name of the plug-in to retrieve the library of.
Returns:
std::string The library from which the plug-in was loaded.
static tlp::Plugin* tlp::PluginLister::getPluginObject ( const std::string &  name,
tlp::PluginContext context 
) [static]

Constructs a plug-in.

Parameters:
nameThe name of the plug-in to instantiate.
pThe context to give to the plug-in.
Returns:
ObjectType* The newly constructed plug-in.
template<typename PluginType >
PluginType* tlp::PluginLister::getPluginObject ( const std::string &  name,
tlp::PluginContext context 
) [inline]

Similar to tlp::PluginLister::getPluginObject() but returns a typed instance.

This method instantiate a plugin from its name and returns it casted into the given type.

Parameters:
nameThe plugin's name
contextThe context to give to the plugin
Returns:
The plugin instance. If there is no such plugin or if the plugin does not match the required type, this method returns NULL

Definition at line 126 of file PluginLister.h.

static const ParameterDescriptionList& tlp::PluginLister::getPluginParameters ( const std::string &  name) [static]

Gets the list of parameters for the given plug-in.

Parameters:
nameThe name of the plug-in to retrieve the parameters of.
Returns:
:ParameterDescriptionList The parameters of the plug-in.
static std::string tlp::PluginLister::getPluginRelease ( const std::string &  name) [static, protected]

Gets the release number of the given plug-in.

Parameters:
nameThe name of the plug-in to retrieve the version number of.
Returns:
:string The version number, ussually formatted as X[.Y], where X is the major, and Y the minor.

Gets the static instance of this class. If not already done, creates it beforehand.

Returns:
PluginLister< ObjectType, Context >* The only instance of this object that exists in the whole program.
template<typename PluginType >
bool tlp::PluginLister::pluginExists ( const std::string &  pluginName) [inline]

Checks if a plugin of a given type is loaded This method checks the plugin "pluginName" is currently loaded into Tulip and if it's of type PluginType.

Parameters:
PluginTypethe class type of the plugin
pluginNamethe name of the plugin
Returns:
true if a matching plugin is currently loaded into Tulip.

Definition at line 108 of file PluginLister.h.

static bool tlp::PluginLister::pluginExists ( const std::string &  pluginName) [static]

Checks if a given name is registered in this factory.

Parameters:
pluginNameThe name of the plug-in to look for.
Returns:
bool Whether there is a plug-in with the given name registered in this factory.
static const Plugin& tlp::PluginLister::pluginInformation ( const std::string &  name) [static]

Gets more detailed information about one specific plug-in.

Parameters:
nameThe name of the plugin to retrieve information for.
Returns:
:const Plugin& The information on the plugin.
static const Plugin& tlp::PluginLister::pluginInformations ( const std::string &  name) [static]

Gets more detailed information about one specific plug-in.

Deprecated:
this function should not be used anymore, please use PluginLister::pluginInformation() instead.
Parameters:
nameThe name of the plugin to retrieve information for.
Returns:
:const Plugin& The information on the plugin.
static void tlp::PluginLister::registerPlugin ( FactoryInterface objectFactory) [static]

Registers a plugin into Tulip.

Warning:
This method should only be called by tlp::FactoryInterface subclasses
See also:
PLUGIN
static void tlp::PluginLister::removePlugin ( const std::string &  name) [static]

Removes a plug-in from this factory. This is usefull when a plug-in has unmet dependencies, or appears more than once.

Parameters:
nameThe name of the plug-in to remove.
Returns:
void

Member Data Documentation

std::map<std::string , PluginDescription> tlp::PluginLister::_plugins [protected]

Stores the factory, dependencies, and parameters of all the plugins that register into this factory.

Definition at line 236 of file PluginLister.h.

 All Classes Files Functions Variables Enumerations Enumerator Properties