diff options
author | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-07-24 11:09:55 +0200 |
---|---|---|
committer | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-07-24 11:09:55 +0200 |
commit | ea306799624d0390074f6afa5d38644cce076c9f (patch) | |
tree | 81563442aa083b8293f382017cf8d78984e527eb /modules/io_codec/c++/io_peer.hpp | |
parent | 977ac8bce989285eaabc76c4ed8571ce5fd6793a (diff) |
wip
Diffstat (limited to 'modules/io_codec/c++/io_peer.hpp')
-rw-r--r-- | modules/io_codec/c++/io_peer.hpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/modules/io_codec/c++/io_peer.hpp b/modules/io_codec/c++/io_peer.hpp index f576cbe..613f60e 100644 --- a/modules/io_codec/c++/io_peer.hpp +++ b/modules/io_codec/c++/io_peer.hpp @@ -11,19 +11,21 @@ template <typename Incoming, typename Outgoing, typename TransportEncoding, typename ContentEncoding, typename BufferT = ring_buffer> class streaming_io_peer { +private: + static_assert(not std::is_same_v<ContentEncoding, encode::Native>, "The native encoding by definition is not fit for transport."); public: /** * Constructor with the option to provide a custom codec, in and out buffer */ streaming_io_peer( - own<conveyor_feeder<data<Incoming, Encoding>>> feed, - own<async_io_stream> stream, codec<Incoming, Encoding> in_codec, codec<Outgoing, Encoding> out_codec, BufferT in, BufferT out); + own<conveyor_feeder<data<Incoming, ContentEncoding>>> feed, + own<async_io_stream> stream, codec<Incoming, TransportEncoding> in_codec, codec<Outgoing, TransportEncoding> out_codec, BufferT in, BufferT out); /** * Constructor with mostly default assignements */ streaming_io_peer( - own<conveyor_feeder<data<Incoming, Encoding>>> feed, + own<conveyor_feeder<data<Incoming, ContentEncoding>>> feed, own<async_io_stream> stream); /** @@ -35,25 +37,25 @@ public: /** * Send a message to the remote peer */ - error_or<void> send(data<Outgoing> builder); + error_or<void> send(data<Outgoing, ContentEncoding> builder); /** * A phantom conveyor feeder. Meant for interfacing with other components */ - conveyor_feeder<data<Outgoing, Encoding>> &feeder(); + conveyor_feeder<data<Outgoing, ContentEncoding>> &feeder(); conveyor<void> on_read_disconnected(); private: /// @unimplemented class peer_conveyor_feeder final - : public conveyor_feeder<data<Outgoing, Encoding>> { + : public conveyor_feeder<data<Outgoing, ContentEncoding>> { public: peer_conveyor_feeder( streaming_io_peer<Incoming, Outgoing, TransportEncoding, ContentEncoding, BufferT> &peer_) : peer_{peer_} {} - void feed(data<Outgoing, Encoding> &&data_) override { + void feed(data<Outgoing, ContentEncoding> &&data_) override { (void)data_; } @@ -63,14 +65,14 @@ private: size_t queued() const override { return 0; } - error_or<void> swap(conveyor<data<Outgoing, Encoding>> &&conveyor) noexcept override { return make_error<err::not_implemented>();} + error_or<void> swap(conveyor<data<Outgoing, ContentEncoding>> &&) noexcept override { return make_error<err::not_implemented>();} private: streaming_io_peer<Incoming, Outgoing, TransportEncoding, ContentEncoding, BufferT> &peer_; }; private: - own<conveyor_feeder<data<Incoming, Encoding>>> + own<conveyor_feeder<data<Incoming, ContentEncoding>>> incoming_feeder_ = nullptr; own<async_io_stream> io_stream_; @@ -95,7 +97,7 @@ template <typename Incoming, typename Outgoing, typename TransportEncoding, typename ContentEncoding, typename BufferT = ring_buffer> std::pair<own<streaming_io_peer<Incoming, Outgoing, TransportEncoding, ContentEncoding, BufferT>>, - conveyor<data<Incoming, Encoding>>> + conveyor<data<Incoming, ContentEncoding>>> new_streaming_io_peer(own<async_io_stream> stream); } // namespace saw |