Open Lighting Architecture: olad/PluginManager.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
PluginManager.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * PluginManager.h
17 * Interface to the PluginManager class
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef OLAD_PLUGINMANAGER_H_
22#define OLAD_PLUGINMANAGER_H_
23
24#include <map>
25#include <vector>
26
27#include "ola/base/Macro.h"
28#include "ola/plugin_id.h"
29
30namespace ola {
31
32class PluginLoader;
33class PluginAdaptor;
34class AbstractPlugin;
35
52 class PluginManager {
53 public:
59 PluginManager(const std::vector<PluginLoader*> &plugin_loaders,
60 PluginAdaptor *plugin_adaptor);
61
65 ~PluginManager();
66
72 void LoadAll();
73
77 void UnloadAll();
78
85 void Plugins(std::vector<AbstractPlugin*> *plugins) const;
86
91 void ActivePlugins(std::vector<AbstractPlugin*> *plugins) const;
92
97 void EnabledPlugins(std::vector<AbstractPlugin*> *plugins) const;
98
104 AbstractPlugin* GetPlugin(ola_plugin_id plugin_id) const;
105
111 bool IsActive(ola_plugin_id plugin_id) const;
112
118 bool IsEnabled(ola_plugin_id plugin_id) const;
119
129 bool EnableAndStartPlugin(ola_plugin_id plugin_id);
130
135 void DisableAndStopPlugin(ola_plugin_id plugin_id);
136
142 void GetConflictList(ola_plugin_id plugin_id,
143 std::vector<AbstractPlugin*> *plugins);
144
145 private:
146 typedef std::map<ola_plugin_id, AbstractPlugin*> PluginMap;
147
148 std::vector<PluginLoader*> m_plugin_loaders;
149 PluginMap m_loaded_plugins; // plugins that are loaded
150 PluginMap m_active_plugins; // active plugins
151 PluginMap m_enabled_plugins; // enabled plugins
152 PluginAdaptor *m_plugin_adaptor;
153
154 bool StartIfSafe(AbstractPlugin *plugin);
155 AbstractPlugin* CheckForRunningConflicts(const AbstractPlugin *plugin) const;
156
157 PluginManager(const PluginManager &) = delete;
158 const PluginManager &operator=(const PluginManager &) = delete;
159};
160} // namespace ola
161#endif // OLAD_PLUGINMANAGER_H_
Macro.h
Helper macros.
ola::AbstractPlugin
Definition Plugin.h:38
ola::PluginAdaptor
Definition PluginAdaptor.h:41
ola::PluginLoader
The interface used to load plugins.
Definition PluginLoader.h:33
ola::PluginManager::PluginManager
PluginManager(const std::vector< PluginLoader * > &plugin_loaders, PluginAdaptor *plugin_adaptor)
Create a new PluginManager.
Definition PluginManager.cpp:36
ola::PluginManager::EnabledPlugins
void EnabledPlugins(std::vector< AbstractPlugin * > *plugins) const
Return a list of enabled plugins.
Definition PluginManager.cpp:113
ola::PluginManager::IsEnabled
bool IsEnabled(ola_plugin_id plugin_id) const
Check if a plugin is enabled.
Definition PluginManager.cpp:126
ola::PluginManager::IsActive
bool IsActive(ola_plugin_id plugin_id) const
Check if a plugin is active.
Definition PluginManager.cpp:122
ola::PluginManager::EnableAndStartPlugin
bool EnableAndStartPlugin(ola_plugin_id plugin_id)
Enable & start a plugin.
Definition PluginManager.cpp:145
ola::PluginManager::GetConflictList
void GetConflictList(ola_plugin_id plugin_id, std::vector< AbstractPlugin * > *plugins)
Return a list of plugins that conflict with this particular plugin.
Definition PluginManager.cpp:163
ola::PluginManager::Plugins
void Plugins(std::vector< AbstractPlugin * > *plugins) const
Return the list of loaded plugins.
Definition PluginManager.cpp:103
ola::PluginManager::LoadAll
void LoadAll()
Attempt to load all the plugins and start them.
Definition PluginManager.cpp:46
ola::PluginManager::GetPlugin
AbstractPlugin * GetPlugin(ola_plugin_id plugin_id) const
Lookup a plugin by ID.
Definition PluginManager.cpp:118
ola::PluginManager::UnloadAll
void UnloadAll()
Definition PluginManager.cpp:87
ola::PluginManager::DisableAndStopPlugin
void DisableAndStopPlugin(ola_plugin_id plugin_id)
Disable & stop a plugin.
Definition PluginManager.cpp:130
ola::PluginManager::~PluginManager
~PluginManager()
Destructor.
Definition PluginManager.cpp:42
ola::PluginManager::ActivePlugins
void ActivePlugins(std::vector< AbstractPlugin * > *plugins) const
Return a list of active plugins.
Definition PluginManager.cpp:108
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44