24#ifndef MYSQL_SERIALIZATION_SERIALIZER_DEFAULT_H
25#define MYSQL_SERIALIZATION_SERIALIZER_DEFAULT_H
60template <
class Archive_concrete_type>
62 :
public Serializer<Serializer_default<Archive_concrete_type>,
63 Archive_concrete_type> {
81 template <
class Field_type, Field_size field_size_defined>
87 template <
class Field_type, Field_size field_size_defined>
90 std::size_t serializable_end_pos,
98 typename = std::enable_if_t<is_bounded_size_type<Field_type>() ==
true>>
100 return Archive_concrete_type::template get_max_size<uint64_t, 0>() +
102 field_size_defined>();
106 template <
class Serializable_concrete_type>
108 auto serializable_overhead_type =
109 Archive_concrete_type::template get_max_size<uint64_t, 0>();
110 auto serializable_overhead_size =
111 Archive_concrete_type::template get_max_size<uint64_t, 0>();
112 auto serializable_overhead_last_non_ignorable_field_id =
113 Archive_concrete_type::template get_max_size<uint64_t, 0>();
114 return serializable_overhead_type + serializable_overhead_size +
115 serializable_overhead_last_non_ignorable_field_id +
116 Serializable_concrete_type::template get_max_size_internal<
125 typename = std::enable_if_t<is_simple_type<Field_type>() ==
true>>
133 typename = std::enable_if_t<is_enum_type<Field_type>() ==
true>>
143 typename = std::enable_if_t<is_vector_list_type<Field_type>() ==
true>>
145 Serializer_vector_list_tag = {});
153 typename = std::enable_if_t<is_serializable_type<Field_type>() ==
true>>
155 Serializer_serializable_tag = {});
162 typename = std::enable_if_t<is_map_type<Field_type>() ==
true>>
164 Serializer_map_tag = {});
171 typename = std::enable_if_t<is_set_type<Field_type>() ==
true>>
173 Serializer_set_tag = {});
180 typename = std::enable_if_t<is_array_type_v<Field_type>() ==
true>>
182 Serializer_array_tag = {});
189 template <
class Field_type, Field_size field_size_defined>
192 const Field_definition<Field_type, field_size_defined> &field_definition);
200 template <
class Serializable_concrete_type>
203 bool skip_id =
false);
212 template <
class Serializable_type>
214 const Serializable_type &serializable,
225 template <
class Serializable_type>
228 Serializable_type &serializable,
244 template <
class Field_type, Field_size field_size_defined>
258 template <
class Field_type, Field_size field_size_defined>
268 typename = std::enable_if_t<is_simple_type<Field_type>() ==
true>>
276 typename = std::enable_if_t<is_simple_type<Field_type>() ==
true>>
284 typename = std::enable_if_t<is_enum_type<Field_type>() ==
true>>
292 typename = std::enable_if_t<is_enum_type<Field_type>() ==
true>>
301 typename = std::enable_if_t<is_vector_list_type<Field_type>() ==
true>>
310 typename = std::enable_if_t<is_vector_list_type<Field_type>() ==
true>>
319 typename = std::enable_if_t<is_serializable_type<Field_type>() ==
true>>
328 typename = std::enable_if_t<is_serializable_type<Field_type>() ==
true>>
336 typename = std::enable_if_t<is_map_type<Field_type>() ==
true>>
344 typename = std::enable_if_t<is_map_type<Field_type>() ==
true>>
352 typename = std::enable_if_t<is_set_type<Field_type>() ==
true>>
360 typename = std::enable_if_t<is_set_type<Field_type>() ==
true>>
368 typename = std::enable_if_t<is_array_type_v<Field_type>() ==
true>>
376 typename = std::enable_if_t<is_array_type_v<Field_type>() ==
true>>
Field definition provided by classes implementing Serializable interface.
Definition: field_definition.h:45
Basic serializer that is implementing Serializer interface.
Definition: serializer_default.h:63
static std::size_t get_size_field_def(Field_id_type field_id, const Field_definition< Field_type, field_size_defined > &field_definition)
Function returns size of serialized field_definition object.
Definition: serializer_default_impl.hpp:470
static constexpr std::size_t get_max_size()
Function returns maximum size of the field written to an archive, based on its type.
Definition: serializer_default.h:99
static std::size_t get_field_size(const Field_type &field)
Function used internally to calculate size of fields, version for basic types.
Definition: serializer_default_impl.hpp:234
virtual ~Serializer_default()=default
Destructor.
void encode(Level_type level, Field_id_type field_id, const Field_definition< Field_type, field_size_defined > &field_definition)
Function used to encode one field.
Definition: serializer_default_impl.hpp:361
bool encode_field_id(Level_type level, Field_id_type field_id, const Field_definition< Field_type, field_size_defined > &field_definition)
Function used internally to encode field_id and handle optional fields.
Definition: serializer_default_impl.hpp:317
bool decode_field_id(Level_type level, Field_id_type field_id, Field_definition< Field_type, field_size_defined > &field_definition)
Function used internally to decode field_id and handle optional fields.
Definition: serializer_default_impl.hpp:336
void decode_field(Field_type &field)
Function used internally to decode field_id and handle optional fields, version for basic types.
Definition: serializer_default_impl.hpp:41
static std::size_t get_size_serializable(Field_id_type field_id, const Serializable_concrete_type &serializable, bool skip_id=false)
Function returns size of serialized field_definition object.
Definition: serializer_default_impl.hpp:487
void decode(Level_type level, Field_id_type field_id, std::size_t serializable_end_pos, Field_definition< Field_type, field_size_defined > &field_definition)
Function used to decode one field.
Definition: serializer_default_impl.hpp:372
friend Archive_concrete_type
Definition: serializer_default.h:78
std::size_t decode_serializable_metadata(Level_type level, Field_id_type field_id, Serializable_type &serializable, bool skip_id)
This function loads serializable metadata.
Definition: serializer_default_impl.hpp:435
void encode_field(const Field_type &field)
Function used internally to encode field_id and handle optional fields, version for basic types.
Definition: serializer_default_impl.hpp:33
void encode_serializable_metadata(Level_type level, Field_id_type field_id, const Serializable_type &serializable, bool skip_id)
This function saves serializable metadata.
Definition: serializer_default_impl.hpp:411
friend Base_type
Definition: serializer_default.h:76
static constexpr std::size_t get_max_size()
Function returns maximum size of the field written to an archive, based on its type.
Definition: serializer_default.h:107
Interface for serializer.
Definition: serializer.h:62
Serialization_error m_error
Holds information about error.
Definition: serializer.h:251
Archive_concrete_type m_archive
Archive that stores the data.
Definition: serializer.h:250
std::size_t Level_type
Type of the "level" used to indicate on which level of the nested message internal fields are defined...
Definition: serialization_types.h:40
uint64_t Field_id_type
Type for field_id assigned to each field in the.
Definition: serialization_types.h:42
std::size_t Field_size
Definition: serialization_types.h:43
static const LEX_CSTRING field_id
Definition: sql_show_processlist.cc:49
Definition: sql_resultset.h:36
Helper tag for array types to help compiler pick the correct method.
Definition: serializer_default.h:49
Helper tag for enum types to help compiler pick the correct method.
Definition: serializer_default.h:45
Helper tag for map types to help compiler pick the correct method.
Definition: serializer_default.h:47
Helper tag for serializable types to help compiler pick the correct method.
Definition: serializer_default.h:54
Helper tag for set types to help compiler pick the correct method.
Definition: serializer_default.h:51
Helper tag for vector types to help compiler pick the correct method.
Definition: serializer_default.h:43
mysql::serialization::Field_size Field_size
Definition: tag.cpp:35