29template <
typename Field_type>
31 static constexpr auto value_size = Field_type::value_size;
36 size_t current_size =
m_stream.size();
38 value_type>::template count_write_bytes<value_size>(arg.get());
42 m_stream.data() + current_size, arg.get()) == 0) {
44 __FILE__, __LINE__,
"Unable to write data to the stream",
47 }
catch (std::bad_alloc &) {
49 "Got bad alloc, unable to insert field",
56template <
typename Field_type>
58 static constexpr auto value_size = Field_type::value_size;
66 if (bytes_read == 0) {
68 __FILE__, __LINE__,
"Unable to read data from the stream",
77template <
class Field_type>
80 this->
operator>>(std::forward<Field_type>(field));
Binary archive implementation based on vector of bytes.
Definition: archive_binary.h:44
std::size_t read_pos
Read position.
Definition: archive_binary.h:85
void peek(Field_type &&field)
Peeks selected field wrapper (reads data without updating read stream position)
Definition: archive_binary_impl.hpp:78
Archive_binary & operator>>(Field_type &&arg)
Reads argument from this archive.
Definition: archive_binary_impl.hpp:57
std::vector< unsigned char > m_stream
Internal data stream.
Definition: archive_binary.h:84
Archive_binary & operator<<(Field_type &&arg)
Ingests argument into this archive.
Definition: archive_binary_impl.hpp:30
bool is_good() const
Definition: archive.h:190
Serialization_error m_error
Holds information about error.
Definition: archive.h:197
Error used internally in serialization framework.
Definition: serialization_error.h:43
uint16_t value_type
Definition: vt100.h:184
@ out_of_memory
cannot allocate memory
@ archive_write_error
Cannot write data to the stream.
@ archive_read_error
Cannot read data from the stream.
Definition: sql_resultset.h:36
This class is to provide functionality to encode/decode the primitive types into/out of defined strea...
Definition: primitive_type_codec.h:113
static int read_bytes(connection_descriptor const *rfd, char *p, uint32_t n, server *s, int64_t *ret)
Reads n bytes from connection rfd without buffering reads.
Definition: xcom_transport.cc:1025