MySQL 8.4.0
Source Code Documentation
mysql::serialization Namespace Reference

Namespaces

namespace  detail
 

Classes

class  Archive
 Interface for archives (file archive, byte vector archive, string archive etc.), available only to instances implementing Serializable interface and Archive interface. More...
 
class  Archive_binary
 Binary archive implementation based on vector of bytes. More...
 
struct  Archive_binary_field_max_size_calculator
 helper structure created for partial specialization of get_max_size function of Archive_binary, default version More...
 
struct  Archive_binary_field_max_size_calculator< std::string, S >
 helper structure created for partial specialization of get_max_size function of Archive_binary, version for std::string fields More...
 
struct  Archive_binary_field_max_size_calculator< T, 0 >
 helper structure created for partial specialization of get_max_size function of Archive_binary, specialization for defined size equal to 0. More...
 
class  Archive_text
 Archive implementation based on stringstream. More...
 
struct  Byte_count_helper
 Structure that contains methods to count the number of bytes needed to encode a specific field. More...
 
struct  Byte_count_helper< 0 >
 Specialization of Byte_count_helper for 0 field_size. More...
 
class  Field_definition
 Field definition provided by classes implementing Serializable interface. More...
 
struct  Field_definition_tag
 Used to distinguish between Serializable and Field_definition types. More...
 
class  Field_wrapper
 Wrapper for fields to hold field reference and user-defined, compile-time field size. More...
 
class  Field_wrapper< const Field_type, defined_field_size >
 Wrapper for fields to hold field reference and defined by the user compile time size of the field. More...
 
struct  is_std_array
 
struct  is_std_array< std::array< T, N > >
 
struct  Primitive_type_codec
 This class is to provide functionality to encode/decode the primitive types into/out of defined stream, without boundary check. More...
 
class  Read_archive_binary
 Binary, read only archive implementation based on vector of bytes. More...
 
class  Serializable
 Interface for serializable data structures. More...
 
struct  Serializable_size_calculator
 
struct  Serializable_size_calculator< Serializer_type, std::tuple< Args... > >
 Helper struct used to determine Serializable tuple max declared size. More...
 
struct  Serializable_size_calculator_helper
 
struct  Serializable_size_calculator_helper< Serializer_type, Field_definition< T, S > >
 Helper struct used to determine Field_definition declared max size. More...
 
struct  Serializable_tag
 Used to distinguish between Serializable and Field_definition types. More...
 
class  Serialization_error
 Error used internally in serialization framework. More...
 
class  Serializer
 Interface for serializer. More...
 
struct  Serializer_array_tag
 Helper tag for array types to help compiler pick the correct method. More...
 
class  Serializer_default
 Basic serializer that is implementing Serializer interface. More...
 
struct  Serializer_enum_tag
 Helper tag for enum types to help compiler pick the correct method. More...
 
struct  Serializer_map_tag
 Helper tag for map types to help compiler pick the correct method. More...
 
struct  Serializer_serializable_tag
 Helper tag for serializable types to help compiler pick the correct method. More...
 
struct  Serializer_set_tag
 Helper tag for set types to help compiler pick the correct method. More...
 
struct  Serializer_vector_list_tag
 Helper tag for vector types to help compiler pick the correct method. More...
 
class  Write_archive_binary
 Binary, write only archive implementation based on vector of bytes. More...
 

Typedefs

using Field_decode_functor_type = std::function< void(void)>
 
using Field_encode_functor_type = std::function< bool(void)>
 
using Field_missing_functor = Field_decode_functor_type
 Type of the predicate telling serializer what to do in case field is not provided. More...
 
using Field_encode_predicate = Field_encode_functor_type
 Type of the predicate telling serializer whether field is provided or not. More...
 
using Level_type = std::size_t
 Type of the "level" used to indicate on which level of the nested message internal fields are defined. More...
 
using Field_id_type = uint64_t
 Type for field_id assigned to each field in the. More...
 
using Field_size = std::size_t
 

Enumerations

enum class  Serialization_error_type : uint64_t {
  archive_read_error , archive_write_error , corrupted_field , out_of_memory ,
  unknown_field , field_id_mismatch , data_integrity_error , last
}
 Possible error codes generated in serialization library. More...
 
enum class  Unknown_field_policy : uint8_t { ignore , error }
 Represents 'unknown field' policy - decision what needs to be done in case unknown field is encountered in deserialized data. More...
 

Functions

template<class Type >
constexpr std::size_t get_default_type_size ()
 
template<Field_size size, typename Field_type , typename... Args>
auto define_field_with_size (Field_type &arg, Args &&... args)
 
template<typename Field_type , typename... Args>
auto define_field (Field_type &arg, Args &&... args)
 
template<typename Field_type , typename... Args>
auto define_field (const Field_type &arg, Args &&... args)
 
template<class Serializable_derived >
auto define_compound_field (Serializable< Serializable_derived > &arg)
 
template<class Serializable_derived >
auto define_compound_field (const Serializable< Serializable_derived > &arg)
 
template<class Serializable_derived >
auto define_compound_field (const Serializable< Serializable_derived > &arg, const Unknown_field_policy &policy)
 
template<typename Field_type >
auto create_varlen_field_wrapper (Field_type &field_reference)
 
template<class T >
static constexpr bool is_enum_type ()
 This function checks whether given type is enum type. More...
 
template<class T >
static constexpr bool is_serializable_type ()
 This function checks whether given type is serializable. More...
 
template<class T >
static constexpr bool is_vector_list_type ()
 This function checks whether given type is STL list or vector. More...
 
template<class T >
static constexpr bool is_map_type ()
 This function checks whether given type is STL map or unordered map. More...
 
template<class T >
static constexpr bool is_array_type_v ()
 This function checks whether given type is STL array. More...
 
template<class T >
static constexpr bool is_set_type ()
 This function checks whether given type is STL set or unordered set. More...
 
template<typename T >
static constexpr bool is_simple_type ()
 This function checks whether given type is simple serializable type. More...
 
template<typename T >
static constexpr bool is_bounded_size_type ()
 This function checks whether given type (set) is bounded. More...
 
template<class T >
static constexpr bool is_string_type ()
 This function checks whether given type is std::string. More...
 
template<class T >
static constexpr bool is_integral_type ()
 This function checks whether given type is integer type. More...
 
template<class Serializable_type >
Field_id_type find_last_non_ignorable_field_id (const Serializable_type &serializable)
 

Variables

static constexpr uint8_t serialization_format_version = 1
 

Typedef Documentation

◆ Field_decode_functor_type

using mysql::serialization::Field_decode_functor_type = typedef std::function<void(void)>

◆ Field_encode_functor_type

using mysql::serialization::Field_encode_functor_type = typedef std::function<bool(void)>

◆ Field_encode_predicate

Type of the predicate telling serializer whether field is provided or not.

Applicable only to optional fields

◆ Field_id_type

using mysql::serialization::Field_id_type = typedef uint64_t

Type for field_id assigned to each field in the.

◆ Field_missing_functor

Type of the predicate telling serializer what to do in case field is not provided.

Applicable to optional and required fields

◆ Field_size

using mysql::serialization::Field_size = typedef std::size_t

◆ Level_type

using mysql::serialization::Level_type = typedef std::size_t

Type of the "level" used to indicate on which level of the nested message internal fields are defined.

Enumeration Type Documentation

◆ Serialization_error_type

enum class mysql::serialization::Serialization_error_type : uint64_t
strong

Possible error codes generated in serialization library.

Enumerator
archive_read_error 

Cannot read data from the stream.

archive_write_error 

Cannot write data to the stream.

corrupted_field 

cannot read field, corrupted stream

out_of_memory 

cannot allocate memory

unknown_field 

unknown field found in the data stream

field_id_mismatch 

field id read does not match expected field id

data_integrity_error 

corrupted data, unexpected value found

last 

◆ Unknown_field_policy

enum class mysql::serialization::Unknown_field_policy : uint8_t
strong

Represents 'unknown field' policy - decision what needs to be done in case unknown field is encountered in deserialized data.

Enumerator
ignore 

Ignore this field.

error 

Return error.

Function Documentation

◆ create_varlen_field_wrapper()

template<typename Field_type >
auto mysql::serialization::create_varlen_field_wrapper ( Field_type field_reference)

◆ define_compound_field() [1/3]

template<class Serializable_derived >
auto mysql::serialization::define_compound_field ( const Serializable< Serializable_derived > &  arg)

◆ define_compound_field() [2/3]

template<class Serializable_derived >
auto mysql::serialization::define_compound_field ( const Serializable< Serializable_derived > &  arg,
const Unknown_field_policy policy 
)

◆ define_compound_field() [3/3]

template<class Serializable_derived >
auto mysql::serialization::define_compound_field ( Serializable< Serializable_derived > &  arg)

◆ define_field() [1/2]

template<typename Field_type , typename... Args>
auto mysql::serialization::define_field ( const Field_type arg,
Args &&...  args 
)

◆ define_field() [2/2]

template<typename Field_type , typename... Args>
auto mysql::serialization::define_field ( Field_type arg,
Args &&...  args 
)

◆ define_field_with_size()

template<Field_size size, typename Field_type , typename... Args>
auto mysql::serialization::define_field_with_size ( Field_type arg,
Args &&...  args 
)

◆ find_last_non_ignorable_field_id()

template<class Serializable_type >
Field_id_type mysql::serialization::find_last_non_ignorable_field_id ( const Serializable_type &  serializable)

◆ get_default_type_size()

template<class Type >
constexpr std::size_t mysql::serialization::get_default_type_size ( )
constexpr

◆ is_array_type_v()

template<class T >
static constexpr bool mysql::serialization::is_array_type_v ( )
staticconstexpr

This function checks whether given type is STL array.

Template Parameters
Ttested type
Returns
Answer to question: is STL array ?

◆ is_bounded_size_type()

template<typename T >
static constexpr bool mysql::serialization::is_bounded_size_type ( )
staticconstexpr

This function checks whether given type (set) is bounded.

Template Parameters
Ttested type
Returns
Answer to question: is bounded size type?

◆ is_enum_type()

template<class T >
static constexpr bool mysql::serialization::is_enum_type ( )
staticconstexpr

This function checks whether given type is enum type.

Template Parameters
Ttested type
Returns
Answer to question: is enum type ?

◆ is_integral_type()

template<class T >
static constexpr bool mysql::serialization::is_integral_type ( )
staticconstexpr

This function checks whether given type is integer type.

Template Parameters
Ttested type
Returns
Answer to question: is integer type ?

◆ is_map_type()

template<class T >
static constexpr bool mysql::serialization::is_map_type ( )
staticconstexpr

This function checks whether given type is STL map or unordered map.

Template Parameters
Ttested type
Returns
Answer to question: is map or unordered_map ?

◆ is_serializable_type()

template<class T >
static constexpr bool mysql::serialization::is_serializable_type ( )
staticconstexpr

This function checks whether given type is serializable.

Template Parameters
Ttested type
Returns
Answer to question: is serializable ?

◆ is_set_type()

template<class T >
static constexpr bool mysql::serialization::is_set_type ( )
staticconstexpr

This function checks whether given type is STL set or unordered set.

Template Parameters
Ttested type
Returns
Answer to question: is set or unordered_set ?

◆ is_simple_type()

template<typename T >
static constexpr bool mysql::serialization::is_simple_type ( )
staticconstexpr

This function checks whether given type is simple serializable type.

Template Parameters
Ttested type
Returns
Answer to question: is simple serializable type?

◆ is_string_type()

template<class T >
static constexpr bool mysql::serialization::is_string_type ( )
staticconstexpr

This function checks whether given type is std::string.

Template Parameters
Ttested type
Returns
Answer to question: is std::string ?

◆ is_vector_list_type()

template<class T >
static constexpr bool mysql::serialization::is_vector_list_type ( )
staticconstexpr

This function checks whether given type is STL list or vector.

Template Parameters
Ttested type
Returns
Answer to question: is list or vector ?

Variable Documentation

◆ serialization_format_version

constexpr uint8_t mysql::serialization::serialization_format_version = 1
staticconstexpr