Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::SerializationBinaryTypeErased Struct Reference

Loads or writes binary data with its associated reflection schema from or into a C++ object. More...

#include <SerializationBinaryTypeErased.h>

Static Public Member Functions

template<typename T >
static bool write (const T &object, Buffer &buffer, size_t *numberOfWrites=nullptr)
 Writes object T to a buffer.
 
template<typename T >
static bool loadExact (T &object, Span< const char > buffer, size_t *numberOfReads=nullptr)
 Reads object T from a buffer, assuming no versioning changes.
 
template<typename T >
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.
 

Detailed Description

Loads or writes binary data with its associated reflection schema from or into a C++ object.

Member Function Documentation

◆ loadExact()

template<typename T >
static bool SC::SerializationBinaryTypeErased::loadExact ( T & object,
Span< const char > buffer,
size_t * numberOfReads = nullptr )
inlinestaticnodiscard

Reads object T from a buffer, assuming no versioning changes.

Template Parameters
TType of object to be deserialized
Parameters
objectThe object to be deserialized
bufferThe buffer providing bytes for deserialization
numberOfReadsIf provided, will return the number deserialization operations
Returns
true if the operation succeeded

◆ loadVersioned()

template<typename T >
static bool SC::SerializationBinaryTypeErased::loadVersioned ( T & object,
Span< const char > buffer,
Span< const Reflection::TypeInfo > schema,
SerializationBinaryOptions options = {},
size_t * numberOfReads = nullptr )
inlinestaticnodiscard

Deserialize object T from a Binary buffer with a reflection schema not matching T schema.

Template Parameters
TType of object to be deserialized
Parameters
objectThe object to deserialize
bufferThe buffer holding the bytes to be used for deserialization
schemaThe schema used to serialize data in the buffer
optionsOptions for data conversion (allow dropping fields, array items etc)
numberOfReadsIf provided, will return the number deserialization operations
Returns
true if deserialization succeeded

◆ write()

template<typename T >
static bool SC::SerializationBinaryTypeErased::write ( const T & object,
Buffer & buffer,
size_t * numberOfWrites = nullptr )
inlinestaticnodiscard

Writes object T to a buffer.

Template Parameters
TType of object to be serialized
Parameters
objectThe object to be serialized
bufferThe buffer receiving serialized bytes
numberOfWritesIf provided, will return the number of serialization operations
Returns
true if the operation succeeded

The documentation for this struct was generated from the following file: