24#ifndef MYSQL_SERIALIZATION_SERIALIZER_H
25#define MYSQL_SERIALIZATION_SERIALIZER_H
61template <
class Serializer_derived_type,
class Archive_type>
97 static std::size_t
get_size(
const T &arg);
100 template <
typename Serializable_derived_current_type>
102 template <
typename Serializer_type,
typename Type>
109 return static_cast<Serializer_derived_type *
>(
this);
120 template <
class Field_type, Field_size field_size_defined>
134 template <
class Field_type, Field_size field_size_defined>
137 std::size_t serializable_end_pos,
149 template <
class Serializable_type>
151 const Serializable_type &serializable,
bool skip_id);
162 template <
class Serializable_type>
178 template <
class Serializable_type>
180 std::size_t serializable_end_pos,
181 Serializable_type &serializable,
bool skip_id);
192 template <
class Serializable_type>
195 std::size_t serializable_end_pos);
204 template <
class Field_type, Field_size field_size_defined>
217 template <
class Serializable_concrete_type>
220 bool skip_id =
false);
226 template <
class Field_type, Field_size field_size_defined>
229 field_size_defined>();
235 template <
class Serializable_concrete_type>
238 Serializable_concrete_type>();
Field definition provided by classes implementing Serializable interface.
Definition: field_definition.h:45
Interface for serializable data structures.
Definition: serializable.h:86
Error used internally in serialization framework.
Definition: serialization_error.h:43
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
bool is_error() const
Definition: serializer.h:67
virtual ~Serializer()=default
Destructor.
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
Serialization_error m_error
Holds information about error.
Definition: serializer.h:251
Serializer_derived_type * get_derived()
Casts this to derived type.
Definition: serializer.h:108
static std::size_t get_size(const T &arg)
Definition: serializer_impl.hpp:70
Level_type m_level
Level of the serializable tree.
Definition: serializer.h:249
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
Archive_type m_archive
Archive that stores the data.
Definition: serializer.h:250
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
void clear_error()
Definition: serializer.h:241
const Serialization_error & get_error()
Definition: serializer.h:71
bool is_good() const
Definition: serializer.h:68
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
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.h:227
Archive_type & get_archive()
Function for the API user to access reference of the archive.
Definition: serializer_impl.hpp:95
static constexpr std::size_t get_max_size()
Function returns maximum size of the Serializable_concrete_type class object data written to an archi...
Definition: serializer.h:236
bool is_error() const
Function that indicates whether error occurred.
Definition: error.h:76
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 const LEX_CSTRING field_id
Definition: sql_show_processlist.cc:49
Definition: sql_resultset.h:36
Definition: serializable_size_calculator.h:44