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_