24#ifndef MYSQL_SERIALIZATION_SERIALIZABLE_SIZE_CALCULATOR_H
25#define MYSQL_SERIALIZATION_SERIALIZABLE_SIZE_CALCULATOR_H
28#include <unordered_set>
41template <
typename Serializable_derived>
44template <
typename Serializer_type,
typename Serializable_type>
49 return Serializer_type::template get_max_size<Serializable_type>();
54template <
typename Serializer_type,
class T, Field_size S>
60 return Serializer_type::template get_max_size<T, S>();
64template <
typename Serializer_type,
typename... Args>
65struct Serializable_size_calculator;
68template <
typename Serializer_type,
typename... Args>
76 return get_max_size_helper(
77 std::make_index_sequence<std::tuple_size_v<value_type>>{});
85 template <
typename T, std::
size_t N>
87 return i <
N ? (a[i] + internal_sum_size(a, i + 1U)) : T{};
93 template <
size_t... Is>
96 Serializer_type, std::decay_t<decltype(std::get<Is>(
97 std::declval<value_type>()))>>::get_max_size()...};
98 return internal_sum_size(arr);
Field definition provided by classes implementing Serializable interface.
Definition: field_definition.h:45
std::atomic< Type > N
Definition: ut0counter.h:225
Definition: gcs_xcom_synode.h:64
static constexpr T internal_sum_size(T const (&a)[N], std::size_t i=0U)
Helper function used to sum compile time array of sizes.
Definition: serializable_size_calculator.h:86
static constexpr std::size_t get_max_size_helper(std::index_sequence< Is... >)
Additional level of get_max_size_helper, here we get one type from the tuple.
Definition: serializable_size_calculator.h:94
std::tuple< Args... > value_type
Definition: serializable_size_calculator.h:71
static constexpr std::size_t get_max_size()
returns tuple max declared size
Definition: serializable_size_calculator.h:75
static constexpr std::size_t get_max_size()
returns max size for Field_definition object
Definition: serializable_size_calculator.h:59
Definition: serializable_size_calculator.h:45
static constexpr std::size_t get_max_size()
returns max size for nested Serializable class
Definition: serializable_size_calculator.h:48
Definition: serializable.h:48