36#ifndef _UTILS_BYTEBUFFER_HXX_
37#define _UTILS_BYTEBUFFER_HXX_
112 size_ = data->size();
113 data_ = (uint8_t *)data->data();
124 data_ = (uint8_t *)data;
134 size_t append(
const void *data,
size_t len)
139 size_t max_len = max_end - end;
144 memcpy(end, data, len);
180 size_t max_len = max_end - end;
AutoReleaseBuffer< T > BufferPtr
Smart pointer for buffers.
BufferPtr< RawData > RawBufferPtr
Holds a raw buffer.
Pool * rawBufferPool
Use this BufferPool to allocate raw buffers.
static constexpr unsigned RAWBUFFER_SIZE
This is how many bytes we have in each raw buffer allocation.
BufferPtr< ByteChunk > ByteBufferPtr
Buffer pointer type for references.
Base class for all QMember types that hold data in an expandable format.
Abstract class for message recipients.
Pool of previously allocated, but currently unused, items.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
Holds a reference to a raw buffer, with the start and size information.
void append_complete(size_t len)
Notifies that a certain number of bytes have been appended, i.e., written into append_ptr().
size_t append(const void *data, size_t len)
Adds more data to the end of the buffer.
size_t size_
How many bytes from data_ does this chunk represent.
void set_from(RawBufferPtr buf, size_t len, size_t ofs=0)
Overwrites this chunk from a raw buffer.
void set_from(const void *data, size_t len)
Overwrites this chunk from an externally owned memory area.
void advance(size_t num_bytes)
Moves forward the data beginning pointer by a given number of bytes.
uint8_t * data_
Points to the first byte of the useful data.
RawBufferPtr ownedData_
Owns a ref for a RawData buffer.
void set_from(const string *data)
Overwrites this chunk from a string.
Container for holding an arbitrary untyped data stream.
static constexpr size_t MAX_SIZE
Maximum length that can be stored in a single RawBuffer.