MySQL 9.1.0
Source Code Documentation
mysql::serialization::Write_archive_binary Class Reference

Binary, write only archive implementation based on vector of bytes. More...

#include <write_archive_binary.h>

Inheritance diagram for mysql::serialization::Write_archive_binary:
[legend]

Public Types

using Internal_type = unsigned char *
 

Public Member Functions

template<typename Field_type >
Write_archive_binaryoperator<< (Field_type &&arg)
 Ingests argument into this archive. More...
 
std::size_t get_size_written () const
 Returns archive size - size of data written to the archive. More...
 
void set_stream (unsigned char *stream, std::size_t stream_size)
 Set up internal stream, this implementation of Archive does not own memory, it just reads it. More...
 
Internal_typeget_raw_data ()
 Function for the API user to access data in the archive. More...
 
Field_id_type peek_type_field_id ()
 This method decodes field id, without moving stream positions. More...
 
- Public Member Functions inherited from mysql::serialization::Archive< Write_archive_binary >
Write_archive_binaryoperator<< (Type &&arg)
 Ingests argument into this archive. More...
 
Write_archive_binaryoperator>> (Type &&arg)
 Reads argument from this archive. More...
 
decltype(auto) get_raw_data ()
 Function for the API user to access data in the archive. More...
 
std::size_t get_size_written () const
 Returns archive size - size of data written to the archive. More...
 
virtual void put_field_separator ()
 This method needs to define field separator to be inserted after the field, note that some formats won't contain separators Used mainly for text formatters. More...
 
virtual void put_entry_separator ()
 This method needs to define field entry separator to be inserted after the field entry, note that some formats won't contain separators Used mainly for text formatters. More...
 
virtual void put_level_separator ()
 This method needs to define level separator to be inserted after the level, note that some formats won't contain separators Used mainly for text formatters. More...
 
virtual void process_field_separator ()
 This method needs to define how to process field separator during decoding. More...
 
virtual void process_entry_separator ()
 This method needs to define how to process field entry separator during decoding. More...
 
virtual void process_level_separator ()
 This method needs to define how to process level separator during decoding. More...
 

Static Public Member Functions

template<typename Field_type >
static std::size_t get_size (Field_type &&arg)
 Function returns size of serialized argument. More...
 
template<typename T , Field_size S>
static constexpr std::size_t get_max_size ()
 Function returns maximum size of the Type. More...
 
- Static Public Member Functions inherited from mysql::serialization::Archive< Write_archive_binary >
static std::size_t get_size (Type &&arg)
 Function returns size of serialized argument. More...
 
static constexpr std::size_t get_max_size ()
 Function returns maximum size of the Type. More...
 

Private Member Functions

bool can_write (size_t bytes) const
 Internal function used to check whether writing is possible. More...
 

Private Attributes

Internal_type m_stream
 Internal data stream. More...
 
std::size_t m_stream_size {0}
 Internal data stream size. More...
 
std::size_t m_write_pos {0}
 Write position. More...
 

Additional Inherited Members

- Protected Member Functions inherited from mysql::serialization::Archive< Write_archive_binary >
const Write_archive_binaryget_derived_const ()
 Casts this to derived type. More...
 
Write_archive_binaryget_derived ()
 Casts this to derived type. More...
 
Field_id_type peek_type_field_id ()
 This method decodes field id, without moving stream positions. More...
 
void peek (Field_type &&field)
 Peeks selected field wrapper (reads data without updating read stream position) More...
 
void seek_to (std::size_t num_pos)
 Moves the current read position to current position + size. More...
 
std::size_t get_read_pos () const
 Gets current read pos. More...
 
bool is_error () const
 
bool is_good () const
 
const Serialization_errorget_error ()
 
void clear_error ()
 
virtual ~Archive ()=default
 Destructor. More...
 
- Protected Attributes inherited from mysql::serialization::Archive< Write_archive_binary >
Serialization_error m_error
 Holds information about error. More...
 

Detailed Description

Binary, write only archive implementation based on vector of bytes.

Member Typedef Documentation

◆ Internal_type

Member Function Documentation

◆ can_write()

bool mysql::serialization::Write_archive_binary::can_write ( size_t  bytes) const
private

Internal function used to check whether writing is possible.

Parameters
bytesRequested number of bytes
Return values
trueWriting of requested number of bytes is possible
falseCannot write requested number of bytes

◆ get_max_size()

template<typename T , Field_size S>
static constexpr std::size_t mysql::serialization::Write_archive_binary::get_max_size ( )
inlinestaticconstexpr

Function returns maximum size of the Type.

Template Parameters
Typeserialized type
Returns
maximum size of the Type in the stream
Note
To be implemented in Archive_derived_type

◆ get_raw_data()

Write_archive_binary::Internal_type & mysql::serialization::Write_archive_binary::get_raw_data ( )

Function for the API user to access data in the archive.

Returns
Archive data, defined in the Archive (e.g. pointer to bytes ...)
Note
To be implemented in Archive_derived_type

◆ get_size()

template<typename Field_type >
static std::size_t mysql::serialization::Write_archive_binary::get_size ( Field_type &&  arg)
inlinestatic

Function returns size of serialized argument.

Template Parameters
Typetype of the argument
Parameters
[in]argserialized argument
Returns
size of serialized argument
Note
To be implemented in Archive_derived_type

◆ get_size_written()

std::size_t mysql::serialization::Write_archive_binary::get_size_written ( ) const

Returns archive size - size of data written to the archive.

Returns
archive size - size of data written to the archive
Note
To be implemented in Archive_derived_type

◆ operator<<()

template<typename Field_type >
Write_archive_binary & mysql::serialization::Write_archive_binary::operator<< ( Field_type &&  arg)

Ingests argument into this archive.

Template Parameters
Typetype of the argument
Parameters
[in]argArgument to read data from
Returns
This archive reference
Note
To be implemented in Archive_derived_type

◆ peek_type_field_id()

Field_id_type mysql::serialization::Write_archive_binary::peek_type_field_id ( )

This method decodes field id, without moving stream positions.

Returns
Serialized field id
Note
To be implemented in Archive_derived_type

◆ set_stream()

void mysql::serialization::Write_archive_binary::set_stream ( unsigned char *  stream,
std::size_t  stream_size 
)
inline

Set up internal stream, this implementation of Archive does not own memory, it just reads it.

Parameters
[in]streamCaptured stream
[in]stream_sizeSize of stream

Member Data Documentation

◆ m_stream

Internal_type mysql::serialization::Write_archive_binary::m_stream
private

Internal data stream.

◆ m_stream_size

std::size_t mysql::serialization::Write_archive_binary::m_stream_size {0}
private

Internal data stream size.

◆ m_write_pos

std::size_t mysql::serialization::Write_archive_binary::m_write_pos {0}
private

Write position.


The documentation for this class was generated from the following files: