SourceXtractorPlusPlus
0.19
SourceXtractor++, the next generation SExtractor
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SEFramework
SEFramework
Plugin
PluginManager.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2019-2022 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
3
*
4
* This library is free software; you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License as published by the Free
6
* Software Foundation; either version 3.0 of the License, or (at your option)
7
* any later version.
8
*
9
* This library is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12
* details.
13
*
14
* You should have received a copy of the GNU Lesser General Public License
15
* along with this library; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
/*
19
* PluginManager.h
20
*
21
* Created on: Jul 27, 2016
22
* Author: mschefer
23
*/
24
25
#ifndef _SEFRAMEWORK_PLUGIN_PLUGINMANAGER_H_
26
#define _SEFRAMEWORK_PLUGIN_PLUGINMANAGER_H_
27
28
#include <boost/version.hpp>
29
#define USE_BOOST_DLL BOOST_VERSION >= 105500
30
31
#if USE_BOOST_DLL
32
#include <boost/dll/shared_library.hpp>
33
#endif
34
#include <boost/filesystem/path.hpp>
35
36
#include <memory>
37
#include <vector>
38
39
#include "
SEFramework/Configuration/Configurable.h
"
40
#include "
SEFramework/Task/TaskFactoryRegistry.h
"
41
#include "
SEFramework/Plugin/PluginAPI.h
"
42
43
namespace
SourceXtractor {
44
45
class
Plugin;
46
54
class
PluginManager
:
public
PluginAPI
{
55
public
:
56
57
~PluginManager
()
override
=
default
;
58
59
PluginManager
(
std::shared_ptr<TaskFactoryRegistry>
task_factory_registry,
60
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
(std::
move
(plugin_list)),
65
m_task_factory_registry
(std::
move
(task_factory_registry)),
66
m_output_registry
(std::
move
(output_registry)) {}
67
69
void
loadPlugins
();
70
71
// PluginAPI implementation
72
TaskFactoryRegistry
&
getTaskFactoryRegistry
()
const override
{
73
return
*
m_task_factory_registry
;
74
}
75
76
OutputRegistry
&
getOutputRegistry
()
const override
{
77
return
*
m_output_registry
;
78
}
79
81
template
<
typename
T>
82
static
void
registerStaticPlugin
() {
83
s_static_plugins
.emplace_back(
new
T);
84
}
85
86
private
:
87
boost::filesystem::path
m_plugin_path
;
88
std::vector<std::string>
m_plugin_list
;
89
90
std::shared_ptr<TaskFactoryRegistry>
m_task_factory_registry
;
91
std::shared_ptr<OutputRegistry>
m_output_registry
;
92
93
#if USE_BOOST_DLL
94
static
std::vector<boost::dll::shared_library>
s_loaded_plugins;
103
#endif
104
static
std::vector<std::unique_ptr<Plugin>
>
s_static_plugins
;
105
};
106
107
}
108
109
#endif
/* _SEFRAMEWORK_PLUGIN_PLUGINMANAGER_H_ */
std::shared_ptr< TaskFactoryRegistry >
PluginAPI.h
SourceXtractor::PluginManager::loadPlugins
void loadPlugins()
loads all the available plugins. Both those linked at compile-time and those loaded at run-time ...
Definition:
PluginManager.cpp:51
SourceXtractor::PluginManager::m_output_registry
std::shared_ptr< OutputRegistry > m_output_registry
Definition:
PluginManager.h:91
SourceXtractor::OutputRegistry
Definition:
OutputRegistry.h:36
SourceXtractor::PluginManager::m_task_factory_registry
std::shared_ptr< TaskFactoryRegistry > m_task_factory_registry
Definition:
PluginManager.h:90
SourceXtractor::PluginManager::PluginManager
PluginManager(std::shared_ptr< TaskFactoryRegistry > task_factory_registry, std::shared_ptr< OutputRegistry > output_registry, std::string plugin_path, std::vector< std::string > plugin_list)
Definition:
PluginManager.h:59
SourceXtractor::PluginManager::~PluginManager
~PluginManager() override=default
SourceXtractor::PluginManager::m_plugin_list
std::vector< std::string > m_plugin_list
Definition:
PluginManager.h:88
std::string
STL class.
SourceXtractor::PluginManager::m_plugin_path
boost::filesystem::path m_plugin_path
Definition:
PluginManager.h:87
SourceXtractor::PluginManager::getTaskFactoryRegistry
TaskFactoryRegistry & getTaskFactoryRegistry() const override
Definition:
PluginManager.h:72
SourceXtractor::PluginAPI
This interface is given to the plugin to let it access object instances from the framework.
Definition:
PluginAPI.h:40
std::move
T move(T...args)
SourceXtractor::PluginManager::registerStaticPlugin
static void registerStaticPlugin()
registers a plugin, this is used to register plugins linked at compile-time
Definition:
PluginManager.h:82
SourceXtractor::TaskFactoryRegistry
Definition:
TaskFactoryRegistry.h:39
std::vector< std::string >
SourceXtractor::PluginManager::getOutputRegistry
OutputRegistry & getOutputRegistry() const override
Definition:
PluginManager.h:76
SourceXtractor::PluginManager::s_static_plugins
static std::vector< std::unique_ptr< Plugin > > s_static_plugins
Definition:
PluginManager.h:104
SourceXtractor::PluginManager
PluginManager handles the loading of plugins and calls their registration function, providing them with with a PluginAPI implementation.
Definition:
PluginManager.h:54
Configurable.h
TaskFactoryRegistry.h
Generated by
1.8.5