BCNP 3.2.1
Batched Command Network Protocol
Loading...
Searching...
No Matches
adapter.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5
6namespace bcnp {
7
12public:
13 virtual ~ByteWriter() = default;
14
21 virtual bool SendBytes(const uint8_t* data, std::size_t length) = 0;
22};
23
28public:
29 virtual ~ByteStream() = default;
30
37 virtual std::size_t ReceiveChunk(uint8_t* buffer, std::size_t maxLength) = 0;
38};
39
43class DuplexAdapter : public ByteWriter, public ByteStream {
44public:
45 ~DuplexAdapter() override = default;
46};
47
48} // namespace bcnp
Interface for receiving raw bytes from a transport.
Definition adapter.h:27
virtual ~ByteStream()=default
virtual std::size_t ReceiveChunk(uint8_t *buffer, std::size_t maxLength)=0
Receive available bytes from the transport (non-blocking).
Interface for sending raw bytes over a transport.
Definition adapter.h:11
virtual bool SendBytes(const uint8_t *data, std::size_t length)=0
Send bytes over the transport.
virtual ~ByteWriter()=default
Combined send/receive interface for bidirectional transports.
Definition adapter.h:43
~DuplexAdapter() override=default