BinarySerializerContext Class Reference

CPP API: mio::BinarySerializerContext Class Reference
mio::BinarySerializerContext Class Reference

Serializes objects in binary format. More...

#include <binary_serializer.h>

Inheritance diagram for mio::BinarySerializerContext:
Collaboration diagram for mio::BinarySerializerContext:

Public Member Functions

 BinarySerializerContext (ByteStream &stream, std::shared_ptr< IOStatus > status, int flags)
 
BinarySerializerObject create_object (const std::string &type)
 Begin serialization of a new object. More...
 
BinarySerializerObject expect_object (const std::string &type)
 Begin deserialization of an object. More...
 
- Public Member Functions inherited from mio::SerializerBase
int flags () const
 Flags that determine the behavior of serialization. More...
 
 SerializerBase (std::shared_ptr< IOStatus > status, int flags)
 Constructor that sets status and flags. More...
 
void set_error (const IOStatus &status)
 Set the current status of serialization. More...
 
void set_flags (int f)
 Set flags that determine the behavior of serialization. More...
 
const IOStatusstatus () const
 The current status of serialization. More...
 

Private Attributes

ByteStreamm_stream
 Reference to a stream that stores the serialized bytes. More...
 

Friends

template<class T >
requires std::is_trivial_v< T > friend IOResult< T > deserialize_internal (BinarySerializerContext &ctxt, Tag< T > tag)
 Deserialize "naked" ints, etc. More...
 
template<class T >
requires std::is_trivial_v< T > friend void serialize_internal (BinarySerializerContext &ctxt, const T &t)
 Serialize "naked" ints, etc. More...
 

Additional Inherited Members

- Protected Attributes inherited from mio::SerializerBase
int m_flags
 
std::shared_ptr< IOStatusm_status
 

Detailed Description

Serializes objects in binary format.

See io.h for documentation of serialization.

Constructor & Destructor Documentation

◆ BinarySerializerContext()

mio::BinarySerializerContext::BinarySerializerContext ( ByteStream stream,
std::shared_ptr< IOStatus status,
int  flags 
)
inline

Member Function Documentation

◆ create_object()

BinarySerializerObject mio::BinarySerializerContext::create_object ( const std::string &  type)
inline

Begin serialization of a new object.

Parameters
typeName of the type of the object. Only used if flag IOF_IncludeTypeInfo is set.

◆ expect_object()

BinarySerializerObject mio::BinarySerializerContext::expect_object ( const std::string &  type)
inline

Begin deserialization of an object.

Parameters
typeName of the type of the object. Only used if flag IOF_IncludeTypeInfo is set.

Friends And Related Function Documentation

◆ deserialize_internal

template<class T >
requires std::is_trivial_v<T> friend IOResult<T> deserialize_internal ( BinarySerializerContext ctxt,
Tag< T >  tag 
)
friend

Deserialize "naked" ints, etc.

that are not contained in a complex object hierarchy.

Parameters
ctxtThe serialization context.
tagThe value to be serialized.
Returns
The deserialized value.

◆ serialize_internal

template<class T >
requires std::is_trivial_v<T> friend void serialize_internal ( BinarySerializerContext ctxt,
const T &  t 
)
friend

Serialize "naked" ints, etc.

that are not contained in a complex object hierarchy, because they don't have an object that they can be added to.

Parameters
ctxtThe serialization context.
tThe value to be serialized.

Member Data Documentation

◆ m_stream

ByteStream& mio::BinarySerializerContext::m_stream
private

Reference to a stream that stores the serialized bytes.