From d46ea9333432a0d760fbca30f8fc34a97a17a626 Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Fri, 29 Apr 2022 15:11:37 +0200 Subject: [PATCH 1/2] Attempt to create a generic rpc instantiation --- src/network/engine.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/network/engine.hpp b/src/network/engine.hpp index 1321ae38..25ed2994 100644 --- a/src/network/engine.hpp +++ b/src/network/engine.hpp @@ -38,6 +38,19 @@ namespace scord::network { namespace detail { +#define register_RPC(__mid, __m_rpc_names, __func_name, __in_t, __out_t, __handler, requires_response) \ +{ hg_id_t id = margo_provider_register_name(__mid, __func_name, \ + BOOST_PP_CAT(hg_proc_, __in_t), \ + BOOST_PP_CAT(hg_proc_, __out_t), \ + _handler_for_##__handler, \ + MARGO_DEFAULT_PROVIDER_ID, ABT_POOL_NULL); \ + __m_rpc_names.emplace(__func_name, id); \ + if(!requires_response) { \ + ::margo_registered_disable_response(__mid, id, HG_TRUE); \ + } \ +} + + struct margo_context { explicit margo_context(::margo_instance_id mid) : m_mid(mid) {} @@ -90,7 +103,8 @@ struct engine { register_rpcs() { // register RPCs manually for now - m_context->register_rpc("ping", false); + register_RPC(m_context->m_mid, m_context->m_rpc_names, "ping", void, void, ping, false); + } void -- GitLab From 5b4d8ee2fd7ed084ccc941c9beb5ea973f5d685e Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Wed, 4 May 2022 10:40:48 +0000 Subject: [PATCH 2/2] Changed Macro to CAPS --- src/network/engine.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/engine.hpp b/src/network/engine.hpp index 25ed2994..dbe024d9 100644 --- a/src/network/engine.hpp +++ b/src/network/engine.hpp @@ -38,7 +38,7 @@ namespace scord::network { namespace detail { -#define register_RPC(__mid, __m_rpc_names, __func_name, __in_t, __out_t, __handler, requires_response) \ +#define REGISTER_RPC(__mid, __m_rpc_names, __func_name, __in_t, __out_t, __handler, requires_response) \ { hg_id_t id = margo_provider_register_name(__mid, __func_name, \ BOOST_PP_CAT(hg_proc_, __in_t), \ BOOST_PP_CAT(hg_proc_, __out_t), \ @@ -103,7 +103,7 @@ struct engine { register_rpcs() { // register RPCs manually for now - register_RPC(m_context->m_mid, m_context->m_rpc_names, "ping", void, void, ping, false); + REGISTER_RPC(m_context->m_mid, m_context->m_rpc_names, "ping", void, void, ping, false); } -- GitLab