From e2a7609028346c3b776a424c9be848e49d3a0e2e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 12 Jun 2024 17:15:34 +0200 Subject: Working on reference types in std::function deduction --- modules/io_codec/c++/rpc.hpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'modules/io_codec') diff --git a/modules/io_codec/c++/rpc.hpp b/modules/io_codec/c++/rpc.hpp index 04293cd..f01ebd5 100644 --- a/modules/io_codec/c++/rpc.hpp +++ b/modules/io_codec/c++/rpc.hpp @@ -13,13 +13,13 @@ namespace saw { /** * This class acts as a helper for rpc calls and representing data on the remote. */ -template +template class data_or_id { private: /** * Variant representing the either id or data class. */ - std::variant, data> doi_; + std::variant, data> doi_; public: /** * Constructor for instantiating. @@ -31,7 +31,7 @@ public: /** * Constructor for instantiating. */ - data_or_id(data val): + data_or_id(data val): doi_{std::move(val)} {} @@ -46,7 +46,7 @@ public: * Check if this class holds data. */ bool is_data() const { - return std::holds_alternative>(doi_); + return std::holds_alternative>(doi_); } /** @@ -59,22 +59,22 @@ public: /** * Return a data reference. */ - data& get_data(){ - return std::get>(doi_); + data& get_data(){ + return std::get>(doi_); } /** * Return a data reference. */ - const data& get_data() const { - return std::get>(doi_); + const data& get_data() const { + return std::get>(doi_); } }; /** * Representing data on the remote */ -template +template class remote_data { private: id id_; @@ -86,24 +86,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 @@ -157,8 +157,8 @@ class remote { /** * Connect to a remote */ - template - conveyor> connect(const remote_address& addr); + template + conveyor> connect(const remote_address& addr); /** * Start listening -- cgit v1.2.3