24#ifndef MYSQL_SERIALIZATION_SERIALIZABLE_SIZE_CALCULATOR_H
25#define MYSQL_SERIALIZATION_SERIALIZABLE_SIZE_CALCULATOR_H
28#include <unordered_set>
40template <
typename Serializable_derived>
43template <
typename Serializer_type,
typename Serializable_type>
48 return Serializer_type::template get_max_size<Serializable_type>();
53template <
typename Serializer_type,
class T, Field_size S>
59 return Serializer_type::template get_max_size<T, S>();
63template <
typename Serializer_type,
typename... Args>
64struct Serializable_size_calculator;
67template <
typename Serializer_type,
typename... Args>
75 return get_max_size_helper(
76 std::make_index_sequence<std::tuple_size_v<value_type>>{});
84 template <
typename T, std::
size_t N>
86 return i <
N ? (a[i] + internal_sum_size(a, i + 1U)) : T{};
92 template <
size_t... Is>
95 Serializer_type, std::decay_t<decltype(std::get<Is>(
96 std::declval<value_type>()))>>::get_max_size()...};
97 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:85
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:93
std::tuple< Args... > value_type
Definition: serializable_size_calculator.h:70
static constexpr std::size_t get_max_size()
returns tuple max declared size
Definition: serializable_size_calculator.h:74
static constexpr std::size_t get_max_size()
returns max size for Field_definition object
Definition: serializable_size_calculator.h:58
Definition: serializable_size_calculator.h:44
static constexpr std::size_t get_max_size()
returns max size for nested Serializable class
Definition: serializable_size_calculator.h:47
Definition: serializable.h:48