summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMax Christian Pohle2016-08-23 02:46:27 +0200
committerMax Christian Pohle2016-08-23 02:46:27 +0200
commit0f595e076f03c02b366901e8d3c5cc0c50681108 (patch)
tree4c3e241e1b66d027f95d03d846c37f01c030fa8b /plugins
downloadpluginmanager-master.tar.bz2
pluginmanager-master.zip
generic plugin manager example, fully workingHEADmaster
Diffstat (limited to 'plugins')
-rw-r--r--plugins/plugin.hpp39
-rw-r--r--plugins/plugin_test1.cpp35
-rw-r--r--plugins/plugin_test1.hpp33
-rw-r--r--plugins/plugin_test2.cpp24
-rw-r--r--plugins/plugin_test2.hpp34
-rw-r--r--plugins/plugin_test3.cpp24
-rw-r--r--plugins/plugin_test3.hpp34
7 files changed, 223 insertions, 0 deletions
diff --git a/plugins/plugin.hpp b/plugins/plugin.hpp
new file mode 100644
index 0000000..9a354c2
--- /dev/null
+++ b/plugins/plugin.hpp
@@ -0,0 +1,39 @@
1/*
2 * plugin.hpp <PLUGINMANAGER>
3 *
4 * Copyright 2009 Max Christian Pohle <coderz@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#ifndef PLUGIN_HPP
23#define PLUGIN_HPP
24 #include <string>
25 #include <sstream>
26 #include <dlfcn.h>
27 #include <iostream>
28
29 using namespace std;
30 class Plugin
31 {
32 private:
33 int version;
34 public:
35 //Plugin() : version(0)
36 virtual const int get_version() = 0;
37 virtual void dosomething() = 0;
38 };
39#endif
diff --git a/plugins/plugin_test1.cpp b/plugins/plugin_test1.cpp
new file mode 100644
index 0000000..e02612c
--- /dev/null
+++ b/plugins/plugin_test1.cpp
@@ -0,0 +1,35 @@
1/*
2 * plugin_test1.hpp <PLUGINMANAGER>
3 *
4 * Copyright 2009 Max Christian Pohle <coderz@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21#include "plugin_test1.hpp"
22
23plugin_test::plugin_test()
24{ std::cout << "constructor of plugin I.\n"; }
25
26void plugin_test::dosomething()
27{ std::cout << "teste dosomething in plugin I.\n"; }
28
29const int plugin_test::get_version()
30{ return VERSION; }
31
32// the class factories
33extern "C" plugin_test* create()
34{ return new plugin_test; }
35
diff --git a/plugins/plugin_test1.hpp b/plugins/plugin_test1.hpp
new file mode 100644
index 0000000..ec7597d
--- /dev/null
+++ b/plugins/plugin_test1.hpp
@@ -0,0 +1,33 @@
1/*
2 * plugin_test1.hpp <PLUGINMANAGER>
3 *
4 * Copyright 2009 Max Christian Pohle <coderz@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21#ifndef PLUGIN_TEST1_HPP
22#define PLUGIN_TEST1_HPP
23
24#include "plugin.hpp"
25#define VERSION 3
26class plugin_test : public Plugin
27{
28 public:
29 plugin_test();
30 const int get_version();
31 virtual void dosomething();
32};
33#endif
diff --git a/plugins/plugin_test2.cpp b/plugins/plugin_test2.cpp
new file mode 100644
index 0000000..1dbbf7b
--- /dev/null
+++ b/plugins/plugin_test2.cpp
@@ -0,0 +1,24 @@
1/*
2 * plugin_test2.cpp <PLUGINMANAGER>
3 *
4 * Copyright 2009 Max Christian Pohle <coderz@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21#include "plugin_test2.hpp"
22
23void plugin_test::dosomething()
24{ std::cout << "teste dosomething in plugin II.\n"; }
diff --git a/plugins/plugin_test2.hpp b/plugins/plugin_test2.hpp
new file mode 100644
index 0000000..1291b18
--- /dev/null
+++ b/plugins/plugin_test2.hpp
@@ -0,0 +1,34 @@
1/*
2 * plugin_test2.hpp <PLUGINMANAGER>
3 *
4 * Copyright 2009 Max Christian Pohle <coderz@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21#include "plugin.hpp"
22#define VERSION 2
23class plugin_test : public Plugin
24{
25 public:
26 plugin_test()
27 { std::cout << "Das ist plugin nummer II.\n"; }
28 const int get_version()
29 { return VERSION; }
30 void dosomething();
31};
32
33extern "C" Plugin* create()
34{ return new plugin_test(); }
diff --git a/plugins/plugin_test3.cpp b/plugins/plugin_test3.cpp
new file mode 100644
index 0000000..39c4988
--- /dev/null
+++ b/plugins/plugin_test3.cpp
@@ -0,0 +1,24 @@
1/*
2 * plugin_test3.cpp <PLUGINMANAGER>
3 *
4 * Copyright 2009 Max Christian Pohle <coderz@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21#include "plugin_test3.hpp"
22
23void plugin_test::dosomething()
24{ std::cout << "teste dosomething in plugin III.\n"; }
diff --git a/plugins/plugin_test3.hpp b/plugins/plugin_test3.hpp
new file mode 100644
index 0000000..a057d8f
--- /dev/null
+++ b/plugins/plugin_test3.hpp
@@ -0,0 +1,34 @@
1/*
2 * plugin_test3.hpp <PLUGINMANAGER>
3 *
4 * Copyright 2009 Max Christian Pohle <coderz@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21#include "plugin.hpp"
22#define VERSION 1
23class plugin_test : public Plugin
24{
25 public:
26 plugin_test()
27 { std::cout << "Das ist plugin nummer III.\n"; }
28 const int get_version()
29 { return VERSION; }
30 void dosomething();
31};
32
33extern "C" Plugin* create()
34{ return new plugin_test(); }
..