From 63a443527cda9d65552450f6dc4282e54664b05a Mon Sep 17 00:00:00 2001 From: daniel-k Date: Wed, 6 Dec 2017 17:30:24 +0100 Subject: [PATCH] plugin: treat empty name in lookup() as wildcard --- fpga/include/villas/plugin.hpp | 3 ++- fpga/lib/plugin.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fpga/include/villas/plugin.hpp b/fpga/include/villas/plugin.hpp index 54ad8d568..7ee980df8 100644 --- a/fpga/include/villas/plugin.hpp +++ b/fpga/include/villas/plugin.hpp @@ -56,7 +56,8 @@ public: static void dumpList(); - /** Find registered and loaded plugin with given name and type. */ + /// Find plugin by type and (optional if empty) by name. If more match, it + /// is not defined which one will be returned. static Plugin * lookup(Type type, std::string name); diff --git a/fpga/lib/plugin.cpp b/fpga/lib/plugin.cpp index 0c887ed48..b0e2cbd6a 100644 --- a/fpga/lib/plugin.cpp +++ b/fpga/lib/plugin.cpp @@ -133,7 +133,7 @@ Plugin* Plugin::lookup(Plugin::Type type, std::string name) { for(auto& p : pluginList) { - if(p->pluginType == type and p->name == name) + if(p->pluginType == type and (name.empty() or p->name == name)) return p; }