31template <
class Serializer_derived_type,
class Archive_type>
32template <
class Field_type, Field_size field_size_defined>
36 get_derived()->encode(level,
field_id, field_definition);
39template <
class Serializer_derived_type,
class Archive_type>
40template <
class Field_type, Field_size field_size_defined>
44 get_derived()->decode(level,
field_id, serializable_end_pos,
48template <
class Serializer_derived_type,
class Archive_type>
49template <
class Field_type, Field_size field_size_defined>
54 return Serializer_derived_type::template get_size_field_def(
field_id,
58template <
class Serializer_derived_type,
class Archive_type>
59template <
class Serializable_concrete_type>
64 return Serializer_derived_type::template get_size_serializable(
68template <
class Serializer_derived_type,
class Archive_type>
72 return get_size_serializable(0, arg,
false);
75template <
class Serializer_derived_type,
class Archive_type>
80 encode_serializable(m_level,
field_id, arg,
false);
84template <
class Serializer_derived_type,
class Archive_type>
86Serializer<Serializer_derived_type, Archive_type>
90 decode_serializable(m_level,
field_id, 0, arg,
false);
94template <
class Serializer_derived_type,
class Archive_type>
99template <
class Serializer_derived_type,
class Archive_type>
100template <
class Serializable_type>
104 auto process_serializable =
105 [
this, level ](
const auto &field,
auto field_id) ->
auto{
106 this->encode_serializable(level,
field_id, field,
false);
109 [
this, level ](
const auto &field,
auto field_id) ->
auto{
110 this->encode_field(level,
field_id, field);
113 serializable.do_for_each_field(process_serializable, process_field);
116template <
class Serializer_derived_type,
class Archive_type>
117template <
class Serializable_type>
120 const Serializable_type &serializable,
bool skip_id) {
122 get_derived()->encode_serializable_metadata(level,
field_id, serializable,
132 encode_serializable_fields(serializable, level + 1);
136template <
class Serializer_derived_type,
class Archive_type>
137template <
class Serializable_type>
141 std::size_t serializable_end_pos) {
142 auto process_serializable =
143 [
this, level, serializable_end_pos ](
auto &field,
auto field_id) ->
auto{
144 this->decode_serializable(level,
field_id, serializable_end_pos, field,
148 [
this, level, serializable_end_pos ](
auto &field,
auto field_id) ->
auto{
149 this->decode_field(level,
field_id, serializable_end_pos, field);
153 serializable.do_for_each_field(process_serializable, process_field);
156template <
class Serializer_derived_type,
class Archive_type>
157template <
class Serializable_type>
160 Serializable_type &serializable,
bool skip_id) {
164 if (skip_id ==
false && serializable_end_pos != 0 &&
165 m_archive.get_read_pos() == serializable_end_pos) {
168 auto run_field_missing_functor = [](
auto &field,
auto) {
169 field.run_field_missing();
171 auto serializable_field_missing_functor = [](
auto &,
auto) {};
172 serializable.do_for_each_field(serializable_field_missing_functor,
173 run_field_missing_functor);
178 auto curr_pos = m_archive.get_read_pos();
179 auto encoded_size_read = get_derived()->decode_serializable_metadata(
180 level,
field_id, serializable, skip_id);
189 decode_serializable_fields(serializable, level + 1,
190 curr_pos + encoded_size_read);
192 auto next_pos = m_archive.get_read_pos();
193 auto expected_pos = curr_pos + encoded_size_read;
194 if (expected_pos > next_pos && is_good()) {
195 m_archive.seek_to(expected_pos - next_pos);
Field definition provided by classes implementing Serializable interface.
Definition: field_definition.h:45
Interface for serializer.
Definition: serializer.h:62
void encode_serializable(Level_type level, Field_id_type field_id, const Serializable_type &serializable, bool skip_id)
Function used to encode serializable field, this function saves serializable metadata and calls seria...
Definition: serializer_impl.hpp:118
void encode_field(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_impl.hpp:33
void encode_serializable_fields(const Serializable_type &serializable, Level_type level)
Function used to encode fields of specializations of Serializable class, iterates over constant field...
Definition: serializer_impl.hpp:102
static std::size_t get_size(const T &arg)
Definition: serializer_impl.hpp:70
void decode_serializable(Level_type level, Field_id_type field_id, std::size_t serializable_end_pos, Serializable_type &serializable, bool skip_id)
Function used to decode serializable field, this function loads serializable metadata and calls seria...
Definition: serializer_impl.hpp:158
void decode_field(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_impl.hpp:41
void decode_serializable_fields(Serializable_type &serializable, Level_type level, std::size_t serializable_end_pos)
Function used to decode fields of specializations of Serializable class, iterates over non constant f...
Definition: serializer_impl.hpp:139
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 serializable object written to an archive.
Definition: serializer_impl.hpp:61
Serializer_current_type & operator>>(T &arg)
Function for the API user to serialize data.
Serializer_current_type & operator<<(const T &arg)
Function for the API user to serialize data.
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 field object written to an archive.
Definition: serializer_impl.hpp:51
Archive_type & get_archive()
Function for the API user to access reference of the archive.
Definition: serializer_impl.hpp:95
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
static constexpr uint8_t serialization_format_version
Definition: serialization_format_version.h:35
static const LEX_CSTRING field_id
Definition: sql_show_processlist.cc:49