From 7479b39379bcf79dfa73a61643538832c2571c49 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 17 May 2024 18:14:41 +0200 Subject: Trying to get rpc interaction with iface working --- modules/io_codec/c++/rpc.hpp | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'modules/io_codec') diff --git a/modules/io_codec/c++/rpc.hpp b/modules/io_codec/c++/rpc.hpp index 547eea3..66b7c41 100644 --- a/modules/io_codec/c++/rpc.hpp +++ b/modules/io_codec/c++/rpc.hpp @@ -6,12 +6,39 @@ #include +#include + namespace saw { +/** + * + */ +template +class data_or_id { +private: + std::variant, data> doi_; +public: + data_or_id(const id& val): + doi_{val} + {} + + data_or_id(data val): + doi_{std::move(val)} + {} + + bool is_id() const { + return false; + } + + bool is_data() const { + return false; + } +}; + /** * Representing data on the remote */ -template +template class remote_data { private: id id_; @@ -23,24 +50,24 @@ public: /** * Wait until data arrives */ - error_or> wait(wait_scope& wait); + error_or> wait(wait_scope& wait); /** * Asynchronously wait for a result */ - conveyor> on_receive(); + conveyor> on_receive(); }; /** * Client RPC reference structure */ -template +template class rpc_client { /** * request the data from the remote */ template - remote_data request_data(id data); + remote_data request_data(id data); /** @todo * Determine type based on Name @@ -58,12 +85,12 @@ class rpc_client { /** * Implementation of a remote server on the backend */ -template +template class rpc_server { private: - interface iface_; + interface iface_; public: - rpc_server(interface iface): + rpc_server(interface iface): iface_{std::move(iface)} {} }; -- cgit v1.2.3