SourceXtractorPlusPlus 0.18
SourceXtractor++, the next generation SExtractor
PluginManager.h
Go to the documentation of this file.
1
17/*
18 * PluginManager.h
19 *
20 * Created on: Jul 27, 2016
21 * Author: mschefer
22 */
23
24#ifndef _SEFRAMEWORK_PLUGIN_PLUGINMANAGER_H_
25#define _SEFRAMEWORK_PLUGIN_PLUGINMANAGER_H_
26
27#include <boost/version.hpp>
28#define USE_BOOST_DLL BOOST_VERSION >= 105500
29
30#if USE_BOOST_DLL
31#include <boost/dll/shared_library.hpp>
32#endif
33#include <boost/filesystem/path.hpp>
34
35#include <memory>
36#include <vector>
37
41
42namespace SourceXtractor {
43
44class Plugin;
45
53class PluginManager : public PluginAPI {
54public:
55
56 virtual ~PluginManager() = default;
57
59 std::shared_ptr<OutputRegistry> output_registry,
61 std::string plugin_path,
62 std::vector<std::string> plugin_list) :
63 m_plugin_path(plugin_path),
64 m_plugin_list(plugin_list),
65 m_task_factory_registry(task_factory_registry),
66 m_output_registry(output_registry),
68
70 void loadPlugins();
71
72 // PluginAPI implementation
75 }
76
78 return *m_output_registry;
79 }
80
83 }
84
86 template<typename T>
87 static void registerStaticPlugin() {
88 s_static_plugins.emplace_back(new T);
89 }
90
91private:
92 boost::filesystem::path m_plugin_path;
94
98
99#if USE_BOOST_DLL
108 static std::vector<boost::dll::shared_library> s_loaded_plugins;
109#endif
111};
112
113}
114
115#endif /* _SEFRAMEWORK_PLUGIN_PLUGINMANAGER_H_ */
static long config_manager_id
static ConfigManager & getInstance(long id)
This interface is given to the plugin to let it access object instances from the framework.
Definition: PluginAPI.h:39
PluginManager handles the loading of plugins and calls their registration function,...
Definition: PluginManager.h:53
TaskFactoryRegistry & getTaskFactoryRegistry() const override
Definition: PluginManager.h:73
Euclid::Configuration::ConfigManager & getConfigManager() const override
Definition: PluginManager.h:81
std::vector< std::string > m_plugin_list
Definition: PluginManager.h:93
OutputRegistry & getOutputRegistry() const override
Definition: PluginManager.h:77
std::shared_ptr< OutputRegistry > m_output_registry
Definition: PluginManager.h:96
virtual ~PluginManager()=default
static std::vector< std::unique_ptr< Plugin > > s_static_plugins
boost::filesystem::path m_plugin_path
Definition: PluginManager.h:92
void loadPlugins()
loads all the available plugins. Both those linked at compile-time and those loaded at run-time
static void registerStaticPlugin()
registers a plugin, this is used to register plugins linked at compile-time
Definition: PluginManager.h:87
std::shared_ptr< TaskFactoryRegistry > m_task_factory_registry
Definition: PluginManager.h:95
PluginManager(std::shared_ptr< TaskFactoryRegistry > task_factory_registry, std::shared_ptr< OutputRegistry > output_registry, long config_manager_id, std::string plugin_path, std::vector< std::string > plugin_list)
Definition: PluginManager.h:58