forked from OpenLightingProject/ola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DynamicPluginLoader.cpp
244 lines (193 loc) · 5.28 KB
/
DynamicPluginLoader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* DynamicPluginLoader.cpp
* This class is responsible for loading and unloading the plugins
* Copyright (C) 2005 Simon Newton
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <vector>
#include "ola/stl/STLUtils.h"
#include "olad/DynamicPluginLoader.h"
#include "olad/Plugin.h"
#ifdef USE_ARTNET
#include "plugins/artnet/ArtNetPlugin.h"
#endif
#ifdef USE_DUMMY
#include "plugins/dummy/DummyPlugin.h"
#endif
#ifdef USE_E131
#include "plugins/e131/E131Plugin.h"
#endif
#ifdef USE_ESPNET
#include "plugins/espnet/EspNetPlugin.h"
#endif
#ifdef USE_GPIO
#include "plugins/gpio/GPIOPlugin.h"
#endif
#ifdef USE_KARATE
#include "plugins/karate/KaratePlugin.h"
#endif
#ifdef USE_KINET
#include "plugins/kinet/KiNetPlugin.h"
#endif
#ifdef USE_MILINST
#include "plugins/milinst/MilInstPlugin.h"
#endif
#ifdef USE_OPENDMX
#include "plugins/opendmx/OpenDmxPlugin.h"
#endif
#ifdef USE_OPENPIXELCONTROL
#include "plugins/openpixelcontrol/OPCPlugin.h"
#endif
#ifdef USE_OSC
#include "plugins/osc/OSCPlugin.h"
#endif
#ifdef USE_PATHPORT
#include "plugins/pathport/PathportPlugin.h"
#endif
#ifdef USE_RENARD
#include "plugins/renard/RenardPlugin.h"
#endif
#ifdef USE_SANDNET
#include "plugins/sandnet/SandNetPlugin.h"
#endif
#ifdef USE_SHOWNET
#include "plugins/shownet/ShowNetPlugin.h"
#endif
#ifdef USE_SPI
#include "plugins/spi/SPIPlugin.h"
#endif
#ifdef USE_STAGEPROFI
#include "plugins/stageprofi/StageProfiPlugin.h"
#endif
#ifdef USE_USBPRO
#include "plugins/usbpro/UsbSerialPlugin.h"
#endif
#ifdef USE_LIBUSB
#include "plugins/usbdmx/UsbDmxPlugin.h"
#endif
#ifdef USE_FTDI
#include "plugins/ftdidmx/FtdiDmxPlugin.h"
#endif
#ifdef USE_UART
#include "plugins/uartdmx/UartDmxPlugin.h"
#endif
#ifdef USE_DMX4LINUX
#include "plugins/dmx4linux/Dmx4LinuxPlugin.h"
#endif
namespace ola {
using std::vector;
DynamicPluginLoader::~DynamicPluginLoader() {
UnloadPlugins();
}
vector<AbstractPlugin*> DynamicPluginLoader::LoadPlugins() {
if (m_plugins.empty()) {
PopulatePlugins();
}
return m_plugins;
}
/*
* Setup the plugin list
*/
void DynamicPluginLoader::PopulatePlugins() {
#ifdef USE_DMX4LINUX
m_plugins.push_back(
new ola::plugin::dmx4linux::Dmx4LinuxPlugin(m_plugin_adaptor));
#endif
#ifdef USE_ARTNET
m_plugins.push_back(new ola::plugin::artnet::ArtNetPlugin(m_plugin_adaptor));
#endif
#ifdef USE_DUMMY
m_plugins.push_back(new ola::plugin::dummy::DummyPlugin(m_plugin_adaptor));
#endif
#ifdef USE_E131
m_plugins.push_back(new ola::plugin::e131::E131Plugin(m_plugin_adaptor));
#endif
#ifdef USE_ESPNET
m_plugins.push_back(new ola::plugin::espnet::EspNetPlugin(m_plugin_adaptor));
#endif
#ifdef USE_GPIO
m_plugins.push_back(new ola::plugin::gpio::GPIOPlugin(m_plugin_adaptor));
#endif
#ifdef USE_KARATE
m_plugins.push_back(
new ola::plugin::karate::KaratePlugin(m_plugin_adaptor));
#endif
#ifdef USE_KINET
m_plugins.push_back(new ola::plugin::kinet::KiNetPlugin(m_plugin_adaptor));
#endif
#ifdef USE_MILINST
m_plugins.push_back(
new ola::plugin::milinst::MilInstPlugin(m_plugin_adaptor));
#endif
#ifdef USE_OPENDMX
m_plugins.push_back(
new ola::plugin::opendmx::OpenDmxPlugin(m_plugin_adaptor));
#endif
#ifdef USE_OPENPIXELCONTROL
m_plugins.push_back(
new ola::plugin::openpixelcontrol::OPCPlugin(m_plugin_adaptor));
#endif
#ifdef USE_OSC
m_plugins.push_back(
new ola::plugin::osc::OSCPlugin(m_plugin_adaptor));
#endif
#ifdef USE_RENARD
m_plugins.push_back(
new ola::plugin::renard::RenardPlugin(m_plugin_adaptor));
#endif
#ifdef USE_SANDNET
m_plugins.push_back(
new ola::plugin::sandnet::SandNetPlugin(m_plugin_adaptor));
#endif
#ifdef USE_SHOWNET
m_plugins.push_back(
new ola::plugin::shownet::ShowNetPlugin(m_plugin_adaptor));
#endif
#ifdef USE_SPI
m_plugins.push_back(
new ola::plugin::spi::SPIPlugin(m_plugin_adaptor));
#endif
#ifdef USE_STAGEPROFI
m_plugins.push_back(
new ola::plugin::stageprofi::StageProfiPlugin(m_plugin_adaptor));
#endif
#ifdef USE_USBPRO
m_plugins.push_back(
new ola::plugin::usbpro::UsbSerialPlugin(m_plugin_adaptor));
#endif
#ifdef USE_LIBUSB
m_plugins.push_back(new ola::plugin::usbdmx::UsbDmxPlugin(m_plugin_adaptor));
#endif
#ifdef USE_PATHPORT
m_plugins.push_back(
new ola::plugin::pathport::PathportPlugin(m_plugin_adaptor));
#endif
#ifdef USE_FTDI
m_plugins.push_back(
new ola::plugin::ftdidmx::FtdiDmxPlugin(m_plugin_adaptor));
#endif
#ifdef USE_UART
m_plugins.push_back(
new ola::plugin::uartdmx::UartDmxPlugin(m_plugin_adaptor));
#endif
}
void DynamicPluginLoader::UnloadPlugins() {
STLDeleteElements(&m_plugins);
}
} // namespace ola