diff options
author | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-07-15 15:29:12 +0200 |
---|---|---|
committer | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-07-15 15:29:12 +0200 |
commit | 816760c8480e8e76c7f4021a845161eb697e215c (patch) | |
tree | f18ef0578dab81e1f00798e9c897210236340b90 /modules/codec/c++/remote_loopback.hpp | |
parent | 5d92d62caa68473e67022debe45bf8038c6c3b60 (diff) |
Moving remote definitions from codec to remote module
Diffstat (limited to 'modules/codec/c++/remote_loopback.hpp')
-rw-r--r-- | modules/codec/c++/remote_loopback.hpp | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/modules/codec/c++/remote_loopback.hpp b/modules/codec/c++/remote_loopback.hpp deleted file mode 100644 index 2949243..0000000 --- a/modules/codec/c++/remote_loopback.hpp +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include <variant> - -#include "interface.hpp" -#include "remote.hpp" -#include "transfer_loopback.hpp" - -namespace saw { - -template<typename T, typename Encoding, typename Storage> -class remote_data<T, Encoding, Storage, rmt::Loopback> { -private: - id<T> id_; -public: - remote_data(const id<T>& id): - id_{id} - {} - - /** - * Wait until data arrives - */ - error_or<data<T, Encoding, Storage>> wait(wait_scope& wait); - - /** - * Asynchronously wait for a result - */ - conveyor<data<T, Encoding, Storage>> on_receive(); -}; - -/** - * Client RPC reference structure - */ -template<typename Iface, typename Encoding, typename Storage> -class rpc_client<Iface, Encoding, Storage, rmt::Loopback> { - /** - * request the data from the remote - */ - template<typename IdT> - remote_data<IdT, Encoding, Storage, rmt::Loopback> request_data(id<IdT> data); - - /** @todo - * Determine type based on Name - */ - /* - template<string_literal Name> - error_or< - id< - typename schema_member_type<Name, Iface>::type - > - > call(data_or_id<Input> inp); - */ -}; - -template<> -class remote_address<rmt::Loopback> { -}; - -template<typename Iface, typename Encode, typename Storage> -class rpc_server<Iface, Encode, Storage, rmt::Loopback> { -public: - using InterfaceT = interface<Iface, Encode, Storage>; -private: - const remote_address<rmt::Loopback>* addr_; - InterfaceT iface_; -public: - rpc_server(const remote_address<rmt::Loopback>& addr__, InterfaceT iface__): - addr_{&addr__}, - iface_{std::move(iface__)} - {} - - // error_or<id<>> -}; - -template<> -class remote<rmt::Loopback> { -public: - /** - * Resolves an address for the remote - */ - error_or<own<remote_address<rmt::Loopback>>> parse_address(){ - return heap<remote_address<rmt::Loopback>>(); - } - - /** - * Connect to a remote - */ - template<typename Iface, typename Encode, typename Storage> - conveyor<rpc_client<Iface, Encode, Storage, rmt::Loopback>> connect(const remote_address<rmt::Loopback>& addr); - - /** - * Start listening - */ - template<typename Iface, typename Encode, typename Storage> - rpc_server<Iface, Encode, Storage, rmt::Loopback> listen(const remote_address<rmt::Loopback>& addr, typename rpc_server<Iface,Encode,Storage,rmt::Loopback>::InterfaceT iface){ - return {addr, std::move(iface)}; - } -}; -} |