25 void appendRaw(
const uint8_t* data, std::size_t size)
29 const std::size_t offset =
buffer.size();
30 buffer.resize(offset + size);
31 std::memcpy(
buffer.data() + offset, data, size);
40 static_assert(std::is_trivially_copyable_v<T>,
"Component type must be trivially copyable for serialization");
42 appendRaw(
reinterpret_cast<const uint8_t*
>(&value),
sizeof(T));
61 static_assert(std::is_trivially_copyable_v<T>,
"Component type must be trivially copyable for deserialization");
64 throw std::runtime_error(
"InputArchive: out of data");
Archive that serializes trivially-copyable values into a byte buffer.
Definition RegistryArchive.hpp:20
void operator()(const T &value)
Append value to the internal buffer as raw bytes.
Definition RegistryArchive.hpp:38
void appendRaw(const uint8_t *data, std::size_t size)
Append a raw byte range with a single resize + memcpy.
Definition RegistryArchive.hpp:25
std::vector< uint8_t > buffer
Definition RegistryArchive.hpp:22