Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
30 namespace ola {
31 
32 class PluginLoader;
33 class PluginAdaptor;
34 class AbstractPlugin;
35 
53  public:
59  PluginManager(const std::vector<PluginLoader*> &plugin_loaders,
60  PluginAdaptor *plugin_adaptor);
61 
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 
98  AbstractPlugin* GetPlugin(ola_plugin_id plugin_id) const;
99 
105  bool IsActive(ola_plugin_id plugin_id) const;
106 
112  void GetConflictList(ola_plugin_id plugin_id,
113  std::vector<AbstractPlugin*> *plugins);
114 
115  private:
116  typedef std::map<ola_plugin_id, AbstractPlugin*> PluginMap;
117 
118  std::vector<PluginLoader*> m_plugin_loaders;
119  PluginMap m_loaded_plugins; // plugins that are loaded
120  PluginMap m_active_plugins; // active plugins
121  PluginAdaptor *m_plugin_adaptor;
122 
123  DISALLOW_COPY_AND_ASSIGN(PluginManager);
124 };
125 } // namespace ola
126 #endif // OLAD_PLUGINMANAGER_H_