29template <
class Derived_serializable_type>
30template <
typename Serializer_type>
32 std::size_t calculated_size = 0;
33 auto add_size_s = [&calculated_size](
const auto &field,
35 calculated_size += Serializer_type::get_size_serializable(
field_id, field);
37 auto add_size_f = [&calculated_size](
const auto &field,
39 calculated_size += Serializer_type::get_size_field_def(
field_id, field);
41 do_for_each_field(add_size_s, add_size_f);
42 return calculated_size;
45template <
class Derived_serializable_type>
46template <
class Serializable_functor_type,
class Field_functor_type>
48 Serializable_functor_type &&func_s, Field_functor_type &&func_f) {
50 decltype(std::declval<Derived_serializable_type>().define_fields());
52 std::forward<Serializable_functor_type>(func_s),
53 std::forward<Field_functor_type>(func_f),
54 static_cast<Derived_serializable_type *
>(
this)->define_fields(),
55 std::make_index_sequence<std::tuple_size_v<Tuple_type>>{});
58template <
class Derived_serializable_type>
59template <
class Serializable_functor_type,
class Field_functor_type>
61 Serializable_functor_type &&func_s, Field_functor_type &&func_f)
const {
63 decltype(std::declval<const Derived_serializable_type>().define_fields());
64 const auto *derived_ptr =
65 static_cast<const Derived_serializable_type *
>(
this);
66 do_for_each_field(std::forward<Serializable_functor_type>(func_s),
67 std::forward<Field_functor_type>(func_f),
68 (derived_ptr)->define_fields(),
69 std::make_index_sequence<std::tuple_size_v<Tuple_type>>{});
72template <
class Derived_serializable_type>
73template <
class Serializable_functor_type,
class Field_functor_type,
74 class Tuple_type, std::size_t... Is>
76 Serializable_functor_type &&func_s, Field_functor_type &&func_f,
77 Tuple_type &&tuple, std::index_sequence<Is...>) {
78 (do_for_one_field(std::forward<Serializable_functor_type>(func_s),
79 std::forward<Field_functor_type>(func_f),
80 std::get<Is>(tuple), Is),
84template <
class Derived_serializable_type>
85template <
class Serializable_functor_type,
class Field_functor_type,
88 Serializable_functor_type &&func_s, Field_functor_type &&func_f,
91 using Current_tag_type =
typename Current_field_type_bare::Tag;
92 do_for_one_field(std::forward<Serializable_functor_type>(func_s),
93 std::forward<Field_functor_type>(func_f), field,
field_id,
97template <
class Derived_serializable_type>
98template <
class Serializable_functor_type,
class Field_functor_type,
101 Serializable_functor_type &&func_s, Field_functor_type &&,
107template <
class Derived_serializable_type>
108template <
class Serializable_functor_type,
class Field_functor_type,
111 Serializable_functor_type &&, Field_functor_type &&func_f,
116template <
class Derived_serializable_type>
117template <
class Serializable_functor_type,
class Field_functor_type,
118 class Tuple_type, std::size_t... Is>
120 Serializable_functor_type &&func_s, Field_functor_type &&func_f,
121 Tuple_type &&tuple, std::index_sequence<Is...>)
const {
122 (do_for_one_field(std::forward<Serializable_functor_type>(func_s),
123 std::forward<Field_functor_type>(func_f),
124 std::get<Is>(tuple), Is),
128template <
class Derived_serializable_type>
129template <
class Serializable_functor_type,
class Field_functor_type,
132 Serializable_functor_type &&func_s, Field_functor_type &&func_f,
135 using Current_tag_type =
typename Current_field_type_bare::Tag;
136 do_for_one_field(std::forward<Serializable_functor_type>(func_s),
137 std::forward<Field_functor_type>(func_f), field,
field_id,
141template <
class Derived_serializable_type>
142template <
class Serializable_functor_type,
class Field_functor_type,
145 Serializable_functor_type &&func_s, Field_functor_type &&,
151template <
class Derived_serializable_type>
152template <
class Serializable_functor_type,
class Field_functor_type,
155 Serializable_functor_type &&, Field_functor_type &&func_f,
160template <
class Derived_serializable_type>
162 bool is_provided =
false;
163 auto func_is_provided_s = [&is_provided](
const auto &serializable,
164 const auto &) ->
void {
165 is_provided = serializable.is_any_field_provided();
167 auto func_is_provided_f = [&is_provided](
const auto &field,
168 const auto &) ->
void {
169 if (field.run_encode_predicate()) {
174 decltype(std::declval<Derived_serializable_type>().define_fields());
176 func_is_provided_s, func_is_provided_f,
177 static_cast<const Derived_serializable_type *
>(
this)->define_fields(),
178 std::make_index_sequence<std::tuple_size_v<Tuple_type>>{});
std::size_t get_size_internal() const
Returns serializable object fields size, internal function (without serializable metadata size)
Definition: serializable_impl.hpp:31
bool is_any_field_provided() const
Performs iteration over all of the serializable fields and checks whether any of the fields in this s...
Definition: serializable_impl.hpp:161
void do_for_one_field(Serializable_functor_type &&func_s, Field_functor_type &&func_f, Field_type &field, std::size_t field_id)
do_for_each_field helper
Definition: serializable_impl.hpp:87
void do_for_each_field(Serializable_functor_type &&func_s, Field_functor_type &&func_f)
calls functor for each field
Definition: serializable_impl.hpp:47
required string type
Definition: replication_group_member_actions.proto:34
static const LEX_CSTRING field_id
Definition: sql_show_processlist.cc:49
Definition: sql_resultset.h:36
Used to distinguish between Serializable and Field_definition types.
Definition: serializable_type_tags.h:43
Used to distinguish between Serializable and Field_definition types.
Definition: serializable_type_tags.h:40