4#include "Internal/SerializationBinaryTypeErasedReadVersioned.h"
5#include "Internal/SerializationBinaryTypeErasedReadWriteExact.h"
26 [[nodiscard]]
static bool write(
const T&
object,
Vector<uint8_t>& buffer,
size_t* numberOfWrites =
nullptr)
28 SerializationBinaryBufferWriter binaryBuffer(buffer);
29 SerializationBinaryTypeErasedWriteExact writer;
30 if (not writer.write(
object, binaryBuffer))
33 *numberOfWrites = binaryBuffer.numberOfOperations;
46 SerializationBinaryBufferReader bufferReader(buffer);
47 SerializationBinaryTypeErasedReadExact reader;
48 if (not reader.loadExact(
object, bufferReader))
51 *numberOfReads = bufferReader.numberOfOperations;
52 return bufferReader.positionIsAtEnd();
67 SerializationBinaryTypeErasedReadVersioned loader;
69 SerializationSchema serializationSchema(schema);
70 serializationSchema.options = options;
71 SerializationBinaryBufferReader readerBuffer(buffer);
72 if (not loader.loadVersioned(
object, readerBuffer, serializationSchema))
75 *numberOfReads = readerBuffer.numberOfOperations;
76 return readerBuffer.positionIsAtEnd();
Conversion options for the binary versioned deserializer.
Definition: SerializationBinaryOptions.h:12
Loads or writes binary data with its associated reflection schema from or into a C++ object.
Definition: SerializationBinaryTypeErased.h:18
static bool write(const T &object, Vector< uint8_t > &buffer, size_t *numberOfWrites=nullptr)
Writes object T to a buffer.
Definition: SerializationBinaryTypeErased.h:26
static bool loadVersioned(T &object, Span< const uint8_t > buffer, Span< const Reflection::TypeInfo > schema, SerializationBinaryOptions options={}, size_t *numberOfReads=nullptr)
Deserialize object T from a Binary buffer with a reflection schema not matching T schema.
Definition: SerializationBinaryTypeErased.h:63
static bool loadExact(T &object, Span< const uint8_t > buffer, size_t *numberOfReads=nullptr)
Reads object T from a buffer, assuming no versioning changes.
Definition: SerializationBinaryTypeErased.h:44
View over a contiguous sequence of items (pointer + size in elements).
Definition: Span.h:24
A contiguous sequence of heap allocated elements.
Definition: Vector.h:51