Tulip  4.0.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
tlp::PluginLister Class Reference

#include <PluginLister.h>

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 std::list< tlp::DependencygetPluginDependencies (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 (std::string name)
 
static tlp::PluginListerinstance ()
 
static bool pluginExists (const std::string &pluginName)
 
static const PluginpluginInformations (const std::string &name)
 
static void registerPlugin (FactoryInterface *objectFactory)
 
static void removePlugin (const std::string &name)
 

Static Public Attributes

static PluginLoadercurrentLoader
 

Static Protected Member Functions

static std::string getPluginRelease (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 informations about them.

This class holds various methods to check informations about plugins currently loaded into Tulip. You can use it to list plugins, get dependencies informations 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 59 of file PluginLister.h.

Member Function Documentation

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

Gets the list of plug-ins that registered themselves in this factory.

Returns
:Iterator< std::string >* An iterator over the names of the plug-ins registered in this factory.
static void tlp::PluginLister::checkLoadedPluginsDependencies ( tlp::PluginLoader loader)
static

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 std::list<tlp::Dependency> tlp::PluginLister::getPluginDependencies ( 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 123 of file PluginLister.h.

static const ParameterDescriptionList tlp::PluginLister::getPluginParameters ( 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 ( std::string  name)
staticprotected

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.
static tlp::PluginLister* tlp::PluginLister::instance ( )
static

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 101 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::pluginInformations ( const std::string &  name)
static

Gets more detailed informations about one specific plug-in.

Parameters
nameThe name of the plugin to retrieve informations for.
Returns
:Plugin* The informations 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 221 of file PluginLister.h.