24#ifndef MYSQL_SERIALIZATION_ARCHIVE_H
25#define MYSQL_SERIALIZATION_ARCHIVE_H
49template <
class Archive_derived_type>
57 template <
typename Type>
59 return get_derived()->operator<<(std::forward<Type>(arg));
67 template <
typename Type>
69 return get_derived()->operator>>(std::forward<Type>(arg));
82 template <
typename Type>
84 return Archive_derived_type::template
get_size(std::forward<Type>(arg));
98 template <
typename Type>
100 return Archive_derived_type::template get_max_size<Type>();
105 template <
class Serializer_derived_current_type,
class Archive_current_type>
152 return static_cast<const Archive_derived_type *
>(
this);
159 return static_cast<Archive_derived_type *
>(
this);
172 template <
class Field_type>
174 return get_derived()->peek(std::forward<Field_type>(field));
Interface for archives (file archive, byte vector archive, string archive etc.), available only to in...
Definition: archive.h:50
virtual void put_field_separator()
This method needs to define field separator to be inserted after the field, note that some formats wo...
Definition: archive.h:115
const Archive_derived_type * get_derived_const()
Casts this to derived type.
Definition: archive.h:151
std::size_t get_size_written() const
Returns archive size - size of data written to the archive.
Definition: archive.h:90
virtual void process_level_separator()
This method needs to define how to process level separator during decoding.
Definition: archive.h:145
virtual ~Archive()=default
Destructor.
bool is_good() const
Definition: archive.h:190
decltype(auto) get_raw_data()
Function for the API user to access data in the archive.
Definition: archive.h:75
const Serialization_error & get_error()
Definition: archive.h:191
void seek_to(std::size_t num_pos)
Moves the current read position to current position + size.
Definition: archive.h:180
Serialization_error m_error
Holds information about error.
Definition: archive.h:197
Archive_derived_type & operator>>(Type &&arg)
Reads argument from this archive.
Definition: archive.h:68
virtual void put_entry_separator()
This method needs to define field entry separator to be inserted after the field entry,...
Definition: archive.h:121
static constexpr std::size_t get_max_size()
Function returns maximum size of the Type.
Definition: archive.h:99
Archive_derived_type & operator<<(Type &&arg)
Ingests argument into this archive.
Definition: archive.h:58
void peek(Field_type &&field)
Peeks selected field wrapper (reads data without updating read stream position)
Definition: archive.h:173
Archive_derived_type * get_derived()
Casts this to derived type.
Definition: archive.h:158
static std::size_t get_size(Type &&arg)
Function returns size of serialized argument.
Definition: archive.h:83
virtual void process_entry_separator()
This method needs to define how to process field entry separator during decoding.
Definition: archive.h:139
bool is_error() const
Definition: archive.h:189
virtual void put_level_separator()
This method needs to define level separator to be inserted after the level, note that some formats wo...
Definition: archive.h:128
std::size_t get_read_pos() const
Gets current read pos.
Definition: archive.h:185
Field_id_type peek_type_field_id()
This method decodes field id, without moving stream positions.
Definition: archive.h:165
void clear_error()
Definition: archive.h:192
virtual void process_field_separator()
This method needs to define how to process field separator during decoding.
Definition: archive.h:134
Error used internally in serialization framework.
Definition: serialization_error.h:46
Interface for serializer.
Definition: serializer.h:62
bool is_error() const
Function that indicates whether error occurred.
Definition: error.h:76
uint64_t Field_id_type
Type for field_id assigned to each field in the.
Definition: serialization_types.h:42
Type
Definition: resource_group_basic_types.h:33
Definition: sql_resultset.h:36