-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy pathDynamicPluginLoader.cpp
More file actions
270 lines (213 loc) · 6.56 KB
/
DynamicPluginLoader.cpp
File metadata and controls
270 lines (213 loc) · 6.56 KB
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
* 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 // HAVE_CONFIG_H
#include <vector>
#include "ola/stl/STLUtils.h"
#include "olad/DynamicPluginLoader.h"
#include "olad/Plugin.h"
#ifdef USE_ARTNET
#include "plugins/artnet/ArtNetPlugin.h"
#endif // USE_ARTNET
#ifdef USE_DUMMY
#include "plugins/dummy/DummyPlugin.h"
#endif // USE_DUMMY
#ifdef USE_E131
#include "plugins/e131/E131Plugin.h"
#endif // USE_E131
#ifdef USE_E133
#include "plugins/e133/E133Plugin.h"
#endif // USE_E133
#ifdef USE_ESPNET
#include "plugins/espnet/EspNetPlugin.h"
#endif // USE_ESPNET
#ifdef USE_GPIO
#include "plugins/gpio/GPIOPlugin.h"
#endif // USE_GPIO
#ifdef USE_KARATE
#include "plugins/karate/KaratePlugin.h"
#endif // USE_KARATE
#ifdef USE_KINET
#include "plugins/kinet/KiNetPlugin.h"
#endif // USE_KINET
#ifdef USE_MILINST
#include "plugins/milinst/MilInstPlugin.h"
#endif // USE_MILINST
#ifdef USE_NANOLEAF
#include "plugins/nanoleaf/NanoleafPlugin.h"
#endif // USE_NANOLEAF
#ifdef USE_OPENDMX
#include "plugins/opendmx/OpenDmxPlugin.h"
#endif // USE_OPENDMX
#ifdef USE_OPENPIXELCONTROL
#include "plugins/openpixelcontrol/OPCPlugin.h"
#endif // USE_OPENPIXELCONTROL
#ifdef USE_OSC
#include "plugins/osc/OSCPlugin.h"
#endif // USE_OSC
#ifdef USE_PATHPORT
#include "plugins/pathport/PathportPlugin.h"
#endif // USE_PATHPORT
#ifdef USE_RENARD
#include "plugins/renard/RenardPlugin.h"
#endif // USE_RENARD
#ifdef USE_SANDNET
#include "plugins/sandnet/SandNetPlugin.h"
#endif // USE_SANDNET
#ifdef USE_SHOWNET
#include "plugins/shownet/ShowNetPlugin.h"
#endif // USE_SHOWNET
#ifdef USE_SPI
#include "plugins/spi/SPIPlugin.h"
#endif // USE_SPI
#ifdef USE_SPIDMX
#include "plugins/spidmx/SPIDMXPlugin.h"
#endif // USE_SPIDMX
#ifdef USE_STAGEPROFI
#include "plugins/stageprofi/StageProfiPlugin.h"
#endif // USE_STAGEPROFI
#ifdef USE_USBPRO
#include "plugins/usbpro/UsbSerialPlugin.h"
#endif // USE_USBPRO
#ifdef USE_LIBUSB
#include "plugins/usbdmx/UsbDmxPlugin.h"
#endif // USE_LIBUSB
#ifdef USE_FTDI
#include "plugins/ftdidmx/FtdiDmxPlugin.h"
#endif // USE_FTDI
#ifdef USE_UART
#include "plugins/uartdmx/UartDmxPlugin.h"
#endif // USE_UART
#ifdef USE_DMX4LINUX
#include "plugins/dmx4linux/Dmx4LinuxPlugin.h"
#endif // USE_DMX4LINUX
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 // USE_DMX4LINUX
#ifdef USE_ARTNET
m_plugins.push_back(new ola::plugin::artnet::ArtNetPlugin(m_plugin_adaptor));
#endif // USE_ARTNET
#ifdef USE_DUMMY
m_plugins.push_back(new ola::plugin::dummy::DummyPlugin(m_plugin_adaptor));
#endif // USE_DUMMY
#ifdef USE_E131
m_plugins.push_back(new ola::plugin::e131::E131Plugin(m_plugin_adaptor));
#endif // USE_E131
#ifdef USE_E133
m_plugins.push_back(new ola::plugin::e133::E133Plugin(m_plugin_adaptor));
#endif // USE_E133
#ifdef USE_ESPNET
m_plugins.push_back(new ola::plugin::espnet::EspNetPlugin(m_plugin_adaptor));
#endif // USE_ESPNET
#ifdef USE_GPIO
m_plugins.push_back(new ola::plugin::gpio::GPIOPlugin(m_plugin_adaptor));
#endif // USE_GPIO
#ifdef USE_KARATE
m_plugins.push_back(
new ola::plugin::karate::KaratePlugin(m_plugin_adaptor));
#endif // USE_KARATE
#ifdef USE_KINET
m_plugins.push_back(new ola::plugin::kinet::KiNetPlugin(m_plugin_adaptor));
#endif // USE_KINET
#ifdef USE_MILINST
m_plugins.push_back(
new ola::plugin::milinst::MilInstPlugin(m_plugin_adaptor));
#endif // USE_MILINST
#ifdef USE_NANOLEAF
m_plugins.push_back(
new ola::plugin::nanoleaf::NanoleafPlugin(m_plugin_adaptor));
#endif // USE_NANOLEAF
#ifdef USE_OPENDMX
m_plugins.push_back(
new ola::plugin::opendmx::OpenDmxPlugin(m_plugin_adaptor));
#endif // USE_OPENDMX
#ifdef USE_OPENPIXELCONTROL
m_plugins.push_back(
new ola::plugin::openpixelcontrol::OPCPlugin(m_plugin_adaptor));
#endif // USE_OPENPIXELCONTROL
#ifdef USE_OSC
m_plugins.push_back(
new ola::plugin::osc::OSCPlugin(m_plugin_adaptor));
#endif // USE_OSC
#ifdef USE_RENARD
m_plugins.push_back(
new ola::plugin::renard::RenardPlugin(m_plugin_adaptor));
#endif // USE_RENARD
#ifdef USE_SANDNET
m_plugins.push_back(
new ola::plugin::sandnet::SandNetPlugin(m_plugin_adaptor));
#endif // USE_SANDNET
#ifdef USE_SHOWNET
m_plugins.push_back(
new ola::plugin::shownet::ShowNetPlugin(m_plugin_adaptor));
#endif // USE_SHOWNET
#ifdef USE_SPI
m_plugins.push_back(
new ola::plugin::spi::SPIPlugin(m_plugin_adaptor));
#endif // USE_SPI
#ifdef USE_SPIDMX
m_plugins.push_back(
new ola::plugin::spidmx::SPIDMXPlugin(m_plugin_adaptor));
#endif // USE_SPIDMX
#ifdef USE_STAGEPROFI
m_plugins.push_back(
new ola::plugin::stageprofi::StageProfiPlugin(m_plugin_adaptor));
#endif // USE_STAGEPROFI
#ifdef USE_USBPRO
m_plugins.push_back(
new ola::plugin::usbpro::UsbSerialPlugin(m_plugin_adaptor));
#endif // USE_USBPRO
#ifdef USE_LIBUSB
m_plugins.push_back(new ola::plugin::usbdmx::UsbDmxPlugin(m_plugin_adaptor));
#endif // USE_LIBUSB
#ifdef USE_PATHPORT
m_plugins.push_back(
new ola::plugin::pathport::PathportPlugin(m_plugin_adaptor));
#endif // USE_PATHPORT
#ifdef USE_FTDI
m_plugins.push_back(
new ola::plugin::ftdidmx::FtdiDmxPlugin(m_plugin_adaptor));
#endif // USE_FTDI
#ifdef USE_UART
m_plugins.push_back(
new ola::plugin::uartdmx::UartDmxPlugin(m_plugin_adaptor));
#endif // USE_UART
}
void DynamicPluginLoader::UnloadPlugins() {
STLDeleteElements(&m_plugins);
}
} // namespace ola