2021-06-18 00:17:18 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "async.h"
|
2022-03-11 21:24:05 +01:00
|
|
|
#include "message.h"
|
2021-06-18 00:17:18 +02:00
|
|
|
#include "io.h"
|
|
|
|
|
2021-12-29 19:26:22 +01:00
|
|
|
namespace saw {
|
2021-06-29 22:39:27 +02:00
|
|
|
|
2022-03-11 21:24:05 +01:00
|
|
|
template <typename Codec, typename Incoming, typename Outgoing, class InContainer = MessageContainer<Incoming>, class OutContainer = MessageContainer<Outgoing>>
|
2021-06-18 00:17:18 +02:00
|
|
|
class StreamingIoPeer {
|
|
|
|
private:
|
|
|
|
Codec codec;
|
2021-06-29 22:39:27 +02:00
|
|
|
|
|
|
|
Own<AsyncIoStream> io_stream;
|
|
|
|
|
2022-03-11 21:24:05 +01:00
|
|
|
Own<ConveyorFeeder<HeapMessageRoot<Incoming, InContainer>>> incoming_feeder = nullptr;
|
2021-06-18 00:17:18 +02:00
|
|
|
public:
|
2021-06-29 22:39:27 +02:00
|
|
|
StreamingIoPeer(Own<AsyncIoStream> stream);
|
|
|
|
|
2022-03-11 21:24:05 +01:00
|
|
|
void send(HeapMessageRoot<Outgoing, OutContainer> builder);
|
2021-06-18 00:17:18 +02:00
|
|
|
|
2022-03-11 21:24:05 +01:00
|
|
|
Conveyor<HeapMessageRootIncoming> startReadPump();
|
2021-06-18 00:17:18 +02:00
|
|
|
};
|
2021-06-29 22:39:27 +02:00
|
|
|
|
2022-03-11 21:24:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace saw
|