Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
ola::PluginManager Class Reference

Detailed Description

The manager of plugins.

The plugin manager is responsible for loading the plugins (via PluginLoaders) and retains ownership of the Plugin objects.

Each plugin has a numeric ID associated with it. The plugin IDs can be found in common/protocol/Ola.proto

Plugins can be disabled through the preferences file. Some plugins may conflict with others, in this case the first plugin will be started and the rest of the conflicting plugins are ignored.

Plugins are active if they weren't disabled, there were no conflicts that prevented them from loading, and the call to Start() was successful.

Public Member Functions

 PluginManager (const std::vector< PluginLoader * > &plugin_loaders, PluginAdaptor *plugin_adaptor)
 Create a new PluginManager. More...
 
 ~PluginManager ()
 Destructor.
 
void LoadAll ()
 Attempt to load all the plugins and start them. More...
 
void UnloadAll ()
 
void Plugins (std::vector< AbstractPlugin * > *plugins) const
 Return the list of loaded plugins. More...
 
void ActivePlugins (std::vector< AbstractPlugin * > *plugins) const
 Return a list of active plugins. More...
 
void EnabledPlugins (std::vector< AbstractPlugin * > *plugins) const
 Return a list of enabled plugins. More...
 
AbstractPluginGetPlugin (ola_plugin_id plugin_id) const
 Lookup a plugin by ID. More...
 
bool IsActive (ola_plugin_id plugin_id) const
 Check if a plugin is active. More...
 
bool IsEnabled (ola_plugin_id plugin_id) const
 Check if a plugin is enabled. More...
 
bool EnableAndStartPlugin (ola_plugin_id plugin_id)
 Enable & start a plugin. More...
 
void DisableAndStopPlugin (ola_plugin_id plugin_id)
 Disable & stop a plugin. More...
 
void GetConflictList (ola_plugin_id plugin_id, std::vector< AbstractPlugin * > *plugins)
 Return a list of plugins that conflict with this particular plugin. More...
 

Constructor & Destructor Documentation

ola::PluginManager::PluginManager ( const std::vector< PluginLoader * > &  plugin_loaders,
PluginAdaptor plugin_adaptor 
)

Create a new PluginManager.

Parameters
plugin_loadersthe list of PluginLoader to use.
plugin_adaptorthe PluginAdaptor to pass to each plugin.

Member Function Documentation

void ola::PluginManager::ActivePlugins ( std::vector< AbstractPlugin * > *  plugins) const

Return a list of active plugins.

Parameters
[out]pluginsthe list of active plugins.
void ola::PluginManager::DisableAndStopPlugin ( ola_plugin_id  plugin_id)

Disable & stop a plugin.

Parameters
plugin_idthe id of the plugin to stop.
bool ola::PluginManager::EnableAndStartPlugin ( ola_plugin_id  plugin_id)

Enable & start a plugin.

Parameters
plugin_idthe id of the plugin to start.
Returns
true if the plugin was started or was already running, false if it couldn't be started.

This call will enable a plugin, but may not start it due to conflicts with existing plugins.

void ola::PluginManager::EnabledPlugins ( std::vector< AbstractPlugin * > *  plugins) const

Return a list of enabled plugins.

Parameters
[out]pluginsthe list of enabled plugins.
void ola::PluginManager::GetConflictList ( ola_plugin_id  plugin_id,
std::vector< AbstractPlugin * > *  plugins 
)

Return a list of plugins that conflict with this particular plugin.

Parameters
plugin_idthe id of the plugin to check.
[out]pluginsthe list of plugins that conflict with this one.
AbstractPlugin * ola::PluginManager::GetPlugin ( ola_plugin_id  plugin_id) const

Lookup a plugin by ID.

Parameters
plugin_idthe id of the plugin to find.
Returns
the plugin matching the id or NULL if not found.
bool ola::PluginManager::IsActive ( ola_plugin_id  plugin_id) const

Check if a plugin is active.

Parameters
plugin_idthe id of the plugin to check.
Returns
true if the plugin is active, false otherwise.
bool ola::PluginManager::IsEnabled ( ola_plugin_id  plugin_id) const

Check if a plugin is enabled.

Parameters
plugin_idthe id of the plugin to check.
Returns
true if the plugin is enabled, false otherwise.
void ola::PluginManager::LoadAll ( )

Attempt to load all the plugins and start them.

Some plugins may not be started due to conflicts or being disabled.

void ola::PluginManager::Plugins ( std::vector< AbstractPlugin * > *  plugins) const

Return the list of loaded plugins.

Parameters
[out]pluginsthe list of plugins.

This list includes disabled and conflicting plugins.

void ola::PluginManager::UnloadAll ( )

Unload all the plugins.


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