From 85b5507882426f377da2da351b57844cf2d201db Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Thu, 3 Nov 2022 20:14:10 +0100 Subject: [PATCH] Added vector with instances for convenience --- plugin.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin.hpp b/plugin.hpp index 45275f6..6479009 100644 --- a/plugin.hpp +++ b/plugin.hpp @@ -31,6 +31,9 @@ namespace sc { } } } + for (const auto& elem : plugins) { + objects.emplace_back(elem.second()); + } throw_if_min1(closedir(plugins_dir)); } @@ -56,6 +59,7 @@ namespace sc { static size_t count() { return plugins.size(); } static const std::map>& all() { return plugins; } + static const std::vector& instances() { return objects; } plugin(const std::string& path) : _path {path} { _plugin = dlopen(path.c_str(), RTLD_LAZY); @@ -112,6 +116,7 @@ namespace sc { private: static std::map> plugins; + static std::vector objects; std::string _path; std::string _name; @@ -123,6 +128,8 @@ namespace sc { template std::map> plugin::plugins; + template + std::vector objects; } #endif // _plugin_H_