From 1595a39b2ece55a69f854ab1036ad033f231c426 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 11 Jun 2020 14:19:39 +0200 Subject: [PATCH] plugin: add Registry::dumpList() --- common/include/villas/plugin.hpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/common/include/villas/plugin.hpp b/common/include/villas/plugin.hpp index 5fb763f2a..0dbb98ecb 100644 --- a/common/include/villas/plugin.hpp +++ b/common/include/villas/plugin.hpp @@ -24,6 +24,7 @@ #pragma once +#include #include #include #include @@ -53,7 +54,8 @@ public: return logging.get("plugin:registry"); } - static void add(Plugin *p) + static void + add(Plugin *p) { if (plugins == nullptr) plugins = new List<>; @@ -61,7 +63,8 @@ public: plugins->push_back(p); } - static void remove(Plugin *p) + static void + remove(Plugin *p) { plugins->remove(p); } @@ -95,6 +98,10 @@ public: return list; } + + template + static void + dumpList(); }; class Loader { @@ -135,5 +142,16 @@ protected: } }; +template +void +Registry::dumpList() +{ + for (Plugin *p : *plugins) { + T *t = dynamic_cast(p); + if (t) + std::cout << " - " << p->getName() << ": " << p->getDescription() << std::endl; + } +} + } /* namespace plugin */ } /* namespace villas */