19 _buffer >> messageSize;
28 std::vector<unsigned char> result;
30 result.reserve(totalSize);
32 result.insert(result.end(),
33 reinterpret_cast<const unsigned char*
>(&_type),
34 reinterpret_cast<const unsigned char*
>(&_type) +
sizeof(
Message::Type));
36 size_t bufferSize = _buffer.
size();
37 result.insert(result.end(),
38 reinterpret_cast<const unsigned char*
>(&bufferSize),
39 reinterpret_cast<const unsigned char*
>(&bufferSize) +
sizeof(size_t));
42 auto bufData = _buffer.
data();
43 result.insert(result.end(), bufData.begin(), bufData.end());
A simple LIFO data buffer for serialization and deserialization for simple data types and std::string...
void reset() const
Reset the read/write cursor to the beginning of the buffer.
void increaseCursor(size_t amount) const
Increase the read/write cursor by a specified amount.
const std::vector< unsigned char > data() const
void decreaseCursor(size_t amount) const
Decrease the read/write cursor by a specified amount.
void append(const unsigned char *data, size_t len)
void setType(Message::Type type)
std::vector< unsigned char > getSerializedData() const
void decr_cursor(size_t len) const
void setMessageFd(int fd)
Message::Type type() const
void appendBytes(const unsigned char *data, size_t len)
void incr_cursor(size_t len) const
const int & getFd() const