24 data =
new std::byte [nrBytes];
25 data_end = data + nrBytes;
38 data(rhs.data), data_end(rhs.data_end), first(rhs.first), last(rhs.last) {
43 [[nodiscard]] std::byte *begin() noexcept {
47 [[nodiscard]] std::byte *end() noexcept {
60 return data_end - last;
65 [[nodiscard]]
bool pushed() const noexcept {
80 tt_axiom(last <= data_end);
88 tt_axiom(first <= last);
A network message or stream buffer.
Definition packet.hpp:13
packet(ssize_t nrBytes) noexcept
Allocate an empty packet of a certain size.
Definition packet.hpp:23
ssize_t readSize() const noexcept
How many bytes can be read from this buffer.
Definition packet.hpp:53
void write(ssize_t nrBytes) noexcept
Commit a write.
Definition packet.hpp:78
void push() noexcept
Mark this packet to be pushed to the network.
Definition packet.hpp:71
void read(ssize_t nrBytes) noexcept
Consume a read.
Definition packet.hpp:86
bool pushed() const noexcept
Should this packet be pushed onto the network.
Definition packet.hpp:65
ssize_t writeSize() const noexcept
How many bytes can still be written to this buffer.
Definition packet.hpp:59