From e51d2b1c0493dfd30d1622c8a0628ecf98c92f1c Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 2 Jul 2024 13:38:27 +0200 Subject: Moving back from io_codec to codec. Has nothing to do with IO --- modules/io_codec/c++/rpc.hpp | 169 -------------------------------------- modules/io_codec/c++/transfer.hpp | 9 -- 2 files changed, 178 deletions(-) delete mode 100644 modules/io_codec/c++/rpc.hpp delete mode 100644 modules/io_codec/c++/transfer.hpp (limited to 'modules/io_codec/c++') diff --git a/modules/io_codec/c++/rpc.hpp b/modules/io_codec/c++/rpc.hpp deleted file mode 100644 index 2c97d6b..0000000 --- a/modules/io_codec/c++/rpc.hpp +++ /dev/null @@ -1,169 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include - -namespace saw { - -/** - * This class acts as a helper for rpc calls and representing data on the remote. - */ -template -class data_or_id { -private: - /** - * Variant representing the either id or data class. - */ - std::variant, data> doi_; -public: - /** - * Constructor for instantiating. - */ - data_or_id(const id& val): - doi_{val} - {} - - /** - * Constructor for instantiating. - */ - data_or_id(data val): - doi_{std::move(val)} - {} - - /** - * Check if this class holds an id. - */ - bool is_id() const { - return std::holds_alternative>(doi_); - } - - /** - * Check if this class holds data. - */ - bool is_data() const { - return std::holds_alternative>(doi_); - } - - /** - * Returns the id. - */ - id get_id() const { - return std::get>(doi_); - } - - /** - * Return a data reference. - */ - data& get_data(){ - return std::get>(doi_); - } - - /** - * Return a data reference. - */ - const data& get_data() const { - return std::get>(doi_); - } -}; - -/** - * Representing data on the remote - */ -template -class remote_data { -private: - id id_; -public: - remote_data(const id& id): - id_{id} - {} - - /** - * Wait until data arrives - */ - error_or> wait(wait_scope& wait); - - /** - * 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); - */ -}; - -/** - * 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"); - - -}; - -/** - * Reference Backend structure - */ -template -class remote { - static_assert(always_false, "Type of backend not supported"); - - /** - * Resolves an address for the remote - */ - conveyor> resolve_address(); - - /** - * Connect to a remote - */ - template - conveyor> connect(const remote_address& addr); - - /** - * Start listening - */ - template - rpc_server listen(); -}; -} diff --git a/modules/io_codec/c++/transfer.hpp b/modules/io_codec/c++/transfer.hpp deleted file mode 100644 index b6aa977..0000000 --- a/modules/io_codec/c++/transfer.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -namespace saw { -template -class data_client; - -template -class data_server; -} -- cgit v1.2.3