From 24d83f549a6fba7b23a0c048e1512d00ed704e0d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 15 Apr 2024 15:24:40 +0200 Subject: codec, io_codec: Fixed some type issues with functions and moved rpc to io_codec due to dependency issues --- modules/io_codec/c++/rpc.hpp | 109 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 86 insertions(+), 23 deletions(-) (limited to 'modules/io_codec/c++') diff --git a/modules/io_codec/c++/rpc.hpp b/modules/io_codec/c++/rpc.hpp index cdade00..3caa808 100644 --- a/modules/io_codec/c++/rpc.hpp +++ b/modules/io_codec/c++/rpc.hpp @@ -1,43 +1,106 @@ #pragma once -#include +#include +#include +#include + +#include namespace saw { -namespace rmt { -struct Network {}; -} -template<> -class remote { +/** + * Representing data on the remote + */ +template +class remote_data { private: - std::string addr_str_; + id id_; public: - remote(std::string addr_str); + remote_data(const id& id): + id_{id} + {} - template - conveyor> connect(); + /** + * Wait until data arrives + */ + error_or> wait(wait_scope& wait); - template - conveyor> listen(network& net){ + /** + * Asynchronously wait for a result + */ + conveyor> on_receive(); +}; - } +/** + * Client RPC reference structure + */ +template +class rpc_client { + /** + * request the data from the remote + */ + template + remote_data request_data(id data); + + /** @todo + * Determine type based on Name + */ + /* + template + error_or< + id< + typename schema_member_type::type + > + > call(data_or_id inp); + */ }; -template -class rpc_server { +/** + * Implementation of a remote server on the backend + */ +template +class rpc_server { private: + interface iface_; public: + rpc_server(interface iface): + iface_{std::move(iface)} + {} +}; + +/** + * Representation of a remote. + * Partially similar to a network address + */ +template +class remote_address { + static_assert(always_false, "Type of remote not supported"); + }; -template