21 data =
new std::byte [nrBytes];
22 data_end = data + nrBytes;
35 data(rhs.data), data_end(rhs.data_end), first(rhs.first), last(rhs.last) {
40 [[nodiscard]] std::byte *begin() noexcept {
44 [[nodiscard]] std::byte *end() noexcept {
57 return data_end - last;
62 [[nodiscard]]
bool pushed() const noexcept {
77 tt_assume(last <= data_end);
85 tt_assume(first <= last);
A network message or stream buffer.
Definition Packet.hpp:10
void read(ssize_t nrBytes) noexcept
Consume a read.
Definition Packet.hpp:83
void push() noexcept
Mark this packet to be pushed to the network.
Definition Packet.hpp:68
void write(ssize_t nrBytes) noexcept
Commit a write.
Definition Packet.hpp:75
ssize_t writeSize() const noexcept
How many bytes can still be written to this buffer.
Definition Packet.hpp:56
bool pushed() const noexcept
Should this packet be pushed onto the network.
Definition Packet.hpp:62
Packet(ssize_t nrBytes) noexcept
Allocate an empty packet of a certain size.
Definition Packet.hpp:20
ssize_t readSize() const noexcept
How many bytes can be read from this buffer.
Definition Packet.hpp:50