4#include "Internal/SerializationBinaryTypeErasedReadVersioned.h"
5#include "Internal/SerializationBinaryTypeErasedReadWriteExact.h"
26 [[nodiscard]]
static bool write(
const T&
object,
Buffer& 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();
66 SerializationBinaryTypeErasedReadVersioned loader;
68 SerializationSchema serializationSchema(schema);
69 serializationSchema.options = options;
70 SerializationBinaryBufferReader readerBuffer(buffer);
71 if (not loader.loadVersioned(
object, readerBuffer, serializationSchema))
74 *numberOfReads = readerBuffer.numberOfOperations;
75 return readerBuffer.positionIsAtEnd();
An heap allocated byte buffer that can optionally use an inline buffer.
Definition: Buffer.h:28
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, Buffer &buffer, size_t *numberOfWrites=nullptr)
Writes object T to a buffer.
Definition: SerializationBinaryTypeErased.h:26
static bool loadExact(T &object, Span< const char > buffer, size_t *numberOfReads=nullptr)
Reads object T from a buffer, assuming no versioning changes.
Definition: SerializationBinaryTypeErased.h:44
static bool loadVersioned(T &object, Span< const char > 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
View over a contiguous sequence of items (pointer + size in elements).
Definition: Span.h:32