raisin::tcp_viewer::BufferWriter
struct · #include <rayrai/TcpProtocolReader.hpp>
Lightweight writer for binary message buffers.
Appends values in native byte order, matching what BufferReader reads.
Public member functions
write
cpp
template <typename T>
void write(const T &val)Append a trivially copyable value to the buffer.
Template parameters
| Parameter | Description |
|---|---|
T | Value type. |
Parameters
| Parameter | Description |
|---|---|
val | Value to write. |
writeBool
cpp
void writeBool(bool v)Append a boolean value.
Parameters
| Parameter | Description |
|---|---|
v | Boolean value. |
writeString
cpp
void writeString(const std::string &s)Append a length-prefixed string (int32 length).
Parameters
| Parameter | Description |
|---|---|
s | String to write. |
writeStringU64
cpp
void writeStringU64(const std::string &s)Append a length-prefixed string (uint64 length).
Not used by the current viewer protocol, whose strings all carry int32 lengths (see writeString()).
Parameters
| Parameter | Description |
|---|---|
s | String to write. |
writeBytes
cpp
void writeBytes(const void *ptr, size_t count)Append raw bytes.
Parameters
| Parameter | Description |
|---|---|
ptr | Source pointer. |
count | Number of bytes to append. |
Public attributes
data
cpp
std::vector<char> dataBytes written so far.