7namespace hi::inline
v1 {
23 data =
new std::byte[nrBytes];
24 data_end = data + nrBytes;
34 packet(packet
const &rhs)
noexcept =
delete;
35 packet operator=(packet
const &rhs)
noexcept =
delete;
37 packet(packet &&rhs) noexcept : data(rhs.data), data_end(rhs.data_end), first(rhs.first), last(rhs.last)
42 [[nodiscard]] std::byte *
begin() noexcept
47 [[nodiscard]] std::byte *
end() noexcept
54 [[nodiscard]] ssize_t
readSize() const noexcept
63 return data_end - last;
68 [[nodiscard]]
bool pushed() const noexcept
83 void write(ssize_t nrBytes)
noexcept
92 void read(ssize_t nrBytes)
noexcept
#define hi_assert(expression)
Assert if expression is true.
Definition assert.hpp:86
DOXYGEN BUG.
Definition algorithm.hpp:15
A network message or stream buffer.
Definition packet.hpp:11
packet(ssize_t nrBytes) noexcept
Allocate an empty packet of a certain size.
Definition packet.hpp:21
void read(ssize_t nrBytes) noexcept
Consume a read.
Definition packet.hpp:92
ssize_t readSize() const noexcept
How many bytes can be read from this buffer.
Definition packet.hpp:54
void write(ssize_t nrBytes) noexcept
Commit a write.
Definition packet.hpp:83
bool pushed() const noexcept
Should this packet be pushed onto the network.
Definition packet.hpp:68
void push() noexcept
Mark this packet to be pushed to the network.
Definition packet.hpp:75
ssize_t writeSize() const noexcept
How many bytes can still be written to this buffer.
Definition packet.hpp:61