 |
DAS
3.0
Das Analysis System
|
Go to the documentation of this file.
16 #include <type_traits>
20 #include <boost/exception/all.hpp>
38 std::filesystem::path
file;
39 std::vector<std::unique_ptr<IPlugin>>
plugins;
63 cout <<
"PluginLoader: Loading plugin from " <<
file << endl;
68 string what =
file.string() +
" could not be loaded"s;
69 const char * error = dlerror();
71 what +=
": "s + error;
72 BOOST_THROW_EXCEPTION( invalid_argument(what) );
75 typedef vector<unique_ptr<IPlugin>> * create_t();
78 string what =
"`CreatePlugin` could not be found"s;
79 const char * error = dlerror();
81 what +=
": "s + error;
82 BOOST_THROW_EXCEPTION( runtime_error(what) );
85 if (iplugins ==
nullptr)
86 BOOST_THROW_EXCEPTION( runtime_error(
"`CreatePlugin` returns a nullptr") );
90 catch (boost::exception& e) {
105 cout <<
"PluginLoader: Moving plugin from " <<
file << endl;
108 other.plugins.clear();
109 other.handle =
nullptr;
119 cout <<
"PluginLoader: Closing plugin from " <<
file << endl;
124 int code = dlclose(
handle);
127 <<
" closed with error " << code <<
def <<
'\n';
136 template<Plugin P>
auto Get ()
const
140 auto ptr =
dynamic_cast<P*
>(
plugin);
141 if (ptr ==
nullptr) {
142 string what =
"Invalid plugin type for ";
144 BOOST_THROW_EXCEPTION( logic_error(what) );
148 return plugins | views::transform(&unique_ptr<IPlugin>::get)
149 | views::transform(convert);
cerr
Definition: Ntupliser_cfg.py:105
Exception type to throw from plugins.
Definition: exceptions.h:132
static const char * def
Definition: Step.h:36
p
Definition: Ntupliser_cfg.py:178
P
Definition: Core-gitclone-lastrun.txt:6
PluginsVec * CreatePlugin()
Definition: BadPlugin.cc:9
Handling of exceptions.
Definition: darwin.h:37
static const char * orange
Definition: colours.h:6