From b402048082abc34372364fb4284b8581ce41b165 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 25 Feb 2022 09:55:43 -0500 Subject: [PATCH] add support for plugin sub-registries --- common | 2 +- fpga | 2 +- lib/api/request.cpp | 2 +- lib/api/requests/node_file.cpp | 2 +- lib/capabilities.cpp | 8 ++++---- lib/format.cpp | 2 +- lib/hook_list.cpp | 4 ++-- lib/node.cpp | 2 +- lib/nodes/fpga.cpp | 2 +- src/villas-hook.cpp | 6 +++--- src/villas-node.cpp | 8 ++++---- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/common b/common index 444d48d5b..fc69b4c4e 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 444d48d5bd1e3c45c521a80e377b68c4b7614b42 +Subproject commit fc69b4c4e8377e36ae536d6697276a1a2b528a4e diff --git a/fpga b/fpga index 47a7c0f30..1202b4edb 160000 --- a/fpga +++ b/fpga @@ -1 +1 @@ -Subproject commit 47a7c0f30ffb6e21422e3a45fd81d86a33716e9f +Subproject commit 1202b4edb1d47c77d06488ffd741e88dac4fab1f diff --git a/lib/api/request.cpp b/lib/api/request.cpp index a8625182d..c2c975385 100644 --- a/lib/api/request.cpp +++ b/lib/api/request.cpp @@ -44,7 +44,7 @@ Request * RequestFactory::create(Session *s, const std::string &uri, Session::Me { s->logger->info("Lookup request handler for: uri={}", uri); - for (auto *rf : plugin::Registry::lookup()) { + for (auto *rf : plugin::registry->lookup()) { std::smatch mr; if (not rf->match(uri, mr)) continue; diff --git a/lib/api/requests/node_file.cpp b/lib/api/requests/node_file.cpp index 4bc0e4480..c6fb6d9d0 100644 --- a/lib/api/requests/node_file.cpp +++ b/lib/api/requests/node_file.cpp @@ -46,7 +46,7 @@ public: if (body != nullptr) throw BadRequest("File endpoint does not accept any body data"); - NodeFactory *nf = plugin::Registry::lookup("file"); + NodeFactory *nf = plugin::registry->lookup("file"); if (node->getFactory() != nf) throw BadRequest("This node is not a file node", "{ s: s }", diff --git a/lib/capabilities.cpp b/lib/capabilities.cpp index 09561bb21..8a7d24b9b 100644 --- a/lib/capabilities.cpp +++ b/lib/capabilities.cpp @@ -38,25 +38,25 @@ json_t * villas::node::getCapabilities() json_t *json_formats = json_array(); json_t *json_name; - for (auto p : plugin::Registry::lookup()) { + for (auto p : plugin::registry->lookup()) { json_name = json_string(p->getName().c_str()); json_array_append_new(json_apis, json_name); } - for (auto p : plugin::Registry::lookup()) { + for (auto p : plugin::registry->lookup()) { json_name = json_string(p->getName().c_str()); json_array_append_new(json_hooks, json_name); } - for (auto p : plugin::Registry::lookup()) { + for (auto p : plugin::registry->lookup()) { json_name = json_string(p->getName().c_str()); json_array_append_new(json_formats, json_name); } - for (auto f : plugin::Registry::lookup()) { + for (auto f : plugin::registry->lookup()) { if (f->isInternal()) continue; diff --git a/lib/format.cpp b/lib/format.cpp index 62631c653..9b0a8d9a5 100644 --- a/lib/format.cpp +++ b/lib/format.cpp @@ -64,7 +64,7 @@ Format * FormatFactory::make(json_t *json) Format * FormatFactory::make(const std::string &format) { - FormatFactory *ff = plugin::Registry::lookup(format); + FormatFactory *ff = plugin::registry->lookup(format); if (!ff) throw RuntimeError("Unknown format: {}", format); diff --git a/lib/hook_list.cpp b/lib/hook_list.cpp index cc140af11..3f089ddfa 100644 --- a/lib/hook_list.cpp +++ b/lib/hook_list.cpp @@ -61,7 +61,7 @@ void HookList::parse(json_t *json, int mask, Path *o, Node *n) throw ConfigError(json_hook, "node-config-hook", "Hook must be configured by simple string or object"); } - auto hf = plugin::Registry::lookup(type); + auto hf = plugin::registry->lookup(type); if (!hf) throw ConfigError(json_hook, "node-config-hook", "Unknown hook type '{}'", type); @@ -87,7 +87,7 @@ void HookList::prepare(SignalList::Ptr signals, int m, Path *p, Node *n) goto skip_add; /* Add internal hooks if they are not already in the list */ - for (auto f : plugin::Registry::lookup()) { + for (auto f : plugin::registry->lookup()) { if ((f->getFlags() & m) == m) { auto h = f->make(p, n); push_back(h); diff --git a/lib/node.cpp b/lib/node.cpp index cdd4c92b5..61068e632 100644 --- a/lib/node.cpp +++ b/lib/node.cpp @@ -542,7 +542,7 @@ Node * NodeFactory::make(json_t *json, uuid_t uuid) Node * NodeFactory::make(const std::string &type) { - NodeFactory *nf = plugin::Registry::lookup(type); + NodeFactory *nf = plugin::registry->lookup(type); if (!nf) throw RuntimeError("Unknown node-type: {}", type); diff --git a/lib/nodes/fpga.cpp b/lib/nodes/fpga.cpp index e721ebb82..9f1023b65 100644 --- a/lib/nodes/fpga.cpp +++ b/lib/nodes/fpga.cpp @@ -62,7 +62,7 @@ int villas::node::fpga_type_start(SuperNode *sn) pciDevices = std::make_shared(); // get the FPGA card plugin - auto pcieCardPlugin = plugin::Registry::lookup("pcie"); + auto pcieCardPlugin = plugin::registry->lookup("pcie"); if (!pcieCardPlugin) throw RuntimeError("No FPGA PCIe plugin found"); diff --git a/src/villas-hook.cpp b/src/villas-hook.cpp index d44ead363..9e155b193 100644 --- a/src/villas-hook.cpp +++ b/src/villas-hook.cpp @@ -116,12 +116,12 @@ protected: << " -V show the version of the tool" << std::endl << std::endl; std::cout << "Supported hooks:" << std::endl; - for (Plugin *p : Registry::lookup()) + for (Plugin *p : registry->lookup()) std::cout << " - " << *p << ": " << p->getDescription() << std::endl; std::cout << std::endl; std::cout << "Supported IO formats:" << std::endl; - for (Plugin *p : Registry::lookup()) + for (Plugin *p : registry->lookup()) std::cout << " - " << *p << ": " << p->getDescription() << std::endl; std::cout << std::endl; @@ -248,7 +248,7 @@ check: if (optarg == endptr) } /* Initialize hook */ - auto hf = plugin::Registry::lookup(hook); + auto hf = plugin::registry->lookup(hook); if (!hf) throw RuntimeError("Unknown hook function '{}'", hook); diff --git a/src/villas-node.cpp b/src/villas-node.cpp index 49becce67..83474eb86 100644 --- a/src/villas-node.cpp +++ b/src/villas-node.cpp @@ -106,27 +106,27 @@ protected: #endif /* WITH_NODE_OPAL */ << "Supported node-types:" << std::endl; - for (auto p : Registry::lookup()) { + for (auto p : registry->lookup()) { if (!p->isInternal()) std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl; } std::cout << std::endl; std::cout << "Supported IO formats:" << std::endl; - for (auto p : Registry::lookup()) + for (auto p : registry->lookup()) std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl; std::cout << std::endl; #ifdef WITH_HOOKS std::cout << "Supported hooks:" << std::endl; - for (auto p : Registry::lookup()) + for (auto p : registry->lookup()) std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl; std::cout << std::endl; #endif /* WITH_HOOKS */ #ifdef WITH_API std::cout << "Supported API commands:" << std::endl; - for (auto p : Registry::lookup()) + for (auto p : registry->lookup()) std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl; std::cout << std::endl; #endif /* WITH_API */