actor-framework
Public Types | Public Member Functions | Static Public Member Functions | List of all members
caf::binary_deserializer Class Reference

Deserializes C++ objects from sequence of bytes. More...

#include <binary_deserializer.hpp>

Inheritance diagram for caf::binary_deserializer:
Inheritance graph
[legend]
Collaboration diagram for caf::binary_deserializer:
Collaboration graph
[legend]

Public Types

using super = load_inspector_base< binary_deserializer >
 
- Public Types inherited from caf::load_inspector_base< binary_deserializer >
using super = load_inspector
 

Public Member Functions

template<class Container >
 binary_deserializer (const Container &input) noexcept
 
template<class Container >
 binary_deserializer (actor_system &sys, const Container &input) noexcept
 
template<class Container >
 binary_deserializer (std::nullptr_t, const Container &input) noexcept
 
 binary_deserializer (const void *buf, size_t size) noexcept
 
 binary_deserializer (std::nullptr_t, const void *buf, size_t size) noexcept
 
 binary_deserializer (actor_system &sys, const void *buf, size_t size) noexcept
 
size_t remaining () const noexcept
 Returns how many bytes are still available to read.
 
span< const std::byte > remainder () const noexcept
 Returns the remaining bytes.
 
actor_systemcontext () const noexcept
 Returns the current execution unit.
 
void skip (size_t num_bytes)
 Jumps num_bytes forward. More...
 
void reset (span< const std::byte > bytes) noexcept
 Assigns a new input.
 
const std::byte * current () const noexcept
 Returns the current read position.
 
const std::byte * end () const noexcept
 Returns the end of the assigned memory block.
 
bool fetch_next_object_type (type_id_t &type) noexcept
 
constexpr bool begin_object (type_id_t, std::string_view) noexcept
 
constexpr bool end_object () noexcept
 
constexpr bool begin_field (std::string_view) noexcept
 
bool begin_field (std::string_view name, bool &is_present) noexcept
 
bool begin_field (std::string_view name, span< const type_id_t > types, size_t &index) noexcept
 
bool begin_field (std::string_view name, bool &is_present, span< const type_id_t > types, size_t &index) noexcept
 
constexpr bool end_field ()
 
constexpr bool begin_tuple (size_t) noexcept
 
constexpr bool end_tuple () noexcept
 
constexpr bool begin_key_value_pair () noexcept
 
constexpr bool end_key_value_pair () noexcept
 
bool begin_sequence (size_t &list_size) noexcept
 
constexpr bool end_sequence () noexcept
 
bool begin_associative_array (size_t &size) noexcept
 
bool end_associative_array () noexcept
 
bool value (bool &x) noexcept
 
bool value (std::byte &x) noexcept
 
bool value (uint8_t &x) noexcept
 
bool value (int8_t &x) noexcept
 
bool value (int16_t &x) noexcept
 
bool value (uint16_t &x) noexcept
 
bool value (int32_t &x) noexcept
 
bool value (uint32_t &x) noexcept
 
bool value (int64_t &x) noexcept
 
bool value (uint64_t &x) noexcept
 
template<class T >
std::enable_if_t< std::is_integral_v< T >, bool > value (T &x) noexcept
 
bool value (float &x) noexcept
 
bool value (double &x) noexcept
 
bool value (long double &x)
 
bool value (std::string &x)
 
bool value (std::u16string &x)
 
bool value (std::u32string &x)
 
bool value (span< std::byte > x) noexcept
 
bool value (std::vector< bool > &x)
 
- Public Member Functions inherited from caf::load_inspector_base< binary_deserializer >
constexpr auto object (T &) noexcept
 
constexpr auto virtual_object (std::string_view type_name) noexcept
 
bool begin_object_t ()
 
bool list (T &xs)
 
bool map (T &xs)
 
bool tuple (T &xs, std::index_sequence< Is... >)
 
bool tuple (T &xs)
 
bool tuple (T(&xs)[N])
 
bool apply (T &x)
 
bool apply (Get &&get, Set &&set)
 Deserializes a primitive value with getter / setter access.
 
- Public Member Functions inherited from caf::load_inspector
void set_error (error stop_reason)
 
template<class... Ts>
void emplace_error (Ts &&... xs)
 
const errorget_error () const noexcept
 
error && move_error () noexcept
 
template<class... Ts>
void field_invariant_check_failed (std::string msg)
 
template<class... Ts>
void field_value_synchronization_failed (std::string msg)
 
template<class... Ts>
void invalid_field_type (std::string msg)
 

Static Public Member Functions

static constexpr bool has_human_readable_format () noexcept
 
- Static Public Member Functions inherited from caf::load_inspector
template<class T >
static auto field (std::string_view name, T &x)
 
template<class Get , class Set >
static auto field (std::string_view name, Get get, Set set)
 
template<class IsPresent , class Get , class Reset , class Set >
static auto field (std::string_view name, IsPresent &&, Get &&get, Reset reset, Set set)
 

Additional Inherited Members

- Static Public Attributes inherited from caf::load_inspector
static constexpr bool is_loading = true
 Enables dispatching on the inspector type.
 
- Protected Attributes inherited from caf::load_inspector
error err_
 

Detailed Description

Deserializes C++ objects from sequence of bytes.

Does not perform run-time type checks.

Member Function Documentation

◆ skip()

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

Jumps num_bytes forward.

Precondition
num_bytes <= remaining()

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