CAF  0.17.3
Public Types | Public Member Functions | List of all members
caf::binary_serializer Class Reference

Serializes objects into a sequence of bytes. More...

#include <binary_serializer.hpp>

Inheritance diagram for caf::binary_serializer:
caf::read_inspector< binary_serializer >

Public Types

using result_type = error_code< sec >
 
using container_type = byte_buffer
 
using value_type = byte
 

Public Member Functions

 binary_serializer (actor_system &sys, byte_buffer &buf) noexcept
 
 binary_serializer (execution_unit *ctx, byte_buffer &buf) noexcept
 
 binary_serializer (const binary_serializer &)=delete
 
binary_serializeroperator= (const binary_serializer &)=delete
 
execution_unitcontext () const noexcept
 Returns the current execution unit.
 
byte_bufferbuf () noexcept
 
const byte_bufferbuf () const noexcept
 
size_t write_pos () const noexcept
 
void seek (size_t offset) noexcept
 Sets the write position to offset. More...
 
void skip (size_t num_bytes)
 Jumps num_bytes forward. More...
 
error_code< secbegin_object (uint16_t nr, string_view name)
 
error_code< secend_object ()
 
error_code< secbegin_sequence (size_t list_size)
 
error_code< secend_sequence ()
 
void apply (byte x)
 
void apply (uint8_t x)
 
void apply (uint16_t x)
 
void apply (uint32_t x)
 
void apply (uint64_t x)
 
void apply (float x)
 
void apply (double x)
 
void apply (long double x)
 
void apply (string_view x)
 
void apply (const std::u16string &x)
 
void apply (const std::u32string &x)
 
void apply (span< const byte > x)
 
template<class T >
std::enable_if_t< std::is_integral< T >::value &&std::is_signed< T >::value > apply (T x)
 
template<class Enum >
std::enable_if_t< std::is_enum< Enum >::value > apply (Enum x)
 
void apply (const std::vector< bool > &x)
 
- Public Member Functions inherited from caf::read_inspector< binary_serializer >
auto operator() (Ts &&... xs)
 

Additional Inherited Members

- Static Public Attributes inherited from caf::read_inspector< binary_serializer >
static constexpr bool reads_state
 
static constexpr bool writes_state
 

Detailed Description

Serializes objects into a sequence of bytes.

Member Function Documentation

◆ seek()

void caf::binary_serializer::seek ( size_t  offset)
noexcept

Sets the write position to offset.

Precondition
offset <= buf.size()

◆ skip()

void caf::binary_serializer::skip ( size_t  num_bytes)

Jumps num_bytes forward.

Resizes the buffer (filling it with zeros) when skipping past the end.


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