Skip to content

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

ParameterDescription
TValue type.

Parameters

ParameterDescription
valValue to write.

writeBool ​

cpp
void writeBool(bool v)

Append a boolean value.

Parameters

ParameterDescription
vBoolean value.

writeString ​

cpp
void writeString(const std::string &s)

Append a length-prefixed string (int32 length).

Parameters

ParameterDescription
sString 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

ParameterDescription
sString to write.

writeBytes ​

cpp
void writeBytes(const void *ptr, size_t count)

Append raw bytes.

Parameters

ParameterDescription
ptrSource pointer.
countNumber of bytes to append.

Public attributes ​

data ​

cpp
std::vector<char> data

Bytes written so far.

RaiSim — physics for robotics and AI.