OGLplus  (0.59.0) a C++ wrapper for rendering APIs

Serialization and deserialization

Classes

class  eagine::block_data_sink
 Serialization data sink backed by a pre-allocated memory block. More...
 
class  eagine::block_data_source
 Deserialization data source backed by a pre-allocated memory block. More...
 
struct  eagine::serializer_data_sink
 Abstract base class for serialization data sinks. More...
 
struct  eagine::deserializer_data_source
 Abstract base class for deserialization data sources. More...
 
class  eagine::istream_data_source
 Deserialization data source backed by an input stream. More...
 
class  eagine::ostream_data_sink
 Serialization data sink backed by an output stream. More...
 
class  eagine::packed_block_data_sink
 Packing serialization data sink backed by a pre-allocated memory block. More...
 
class  eagine::packed_block_data_source
 Unpacking deserialization data source backed by a pre-allocated memory block. More...
 
struct  eagine::deserializer_backend
 Interface for deserialization read backends. More...
 
class  eagine::common_deserializer_backend< Derived, Source >
 CRTP mixin implementing the common parts of deserializer backends. More...
 
class  eagine::string_serializer_backend
 Cross-platform implementation of serializer backend using ASCII-only strings. More...
 
class  eagine::string_deserializer_backend
 Cross-platform implementation of deserializer backend using ASCII-only strings. More...
 
struct  eagine::serializer_backend
 Interface for serialization write backends. More...
 
class  eagine::common_serializer_backend< Derived, Sink >
 CRTP mixin implementing the common parts of serializer backends. More...
 
class  eagine::serializer_backend_id< Base, Id >
 Base class partially implementing serializer and deserialized backends. More...
 

Typedefs

using eagine::serialization_errors = bitfield< serialization_error_code >
 Alias for serialization error bitfield. More...
 
using eagine::deserialization_errors = bitfield< deserialization_error_code >
 Alias for deserialization error bitfield. More...
 
template<typename T >
using eagine::serialization_result = valid_if_indicated< T, serialization_errors, bool, false >
 Alias for result type of serialization operations. More...
 
template<typename T >
using eagine::deserialization_result = valid_if_indicated< T, deserialization_errors, bool, false >
 Alias for result type of deserialization operations. More...
 

Enumerations

enum  eagine::serialization_error_code : std::uint8_t {
  eagine::serialization_error_code::not_supported, eagine::serialization_error_code::too_much_data, eagine::serialization_error_code::incomplete_write, eagine::serialization_error_code::data_sink_error,
  eagine::serialization_error_code::backend_error
}
 Serialization error code bits enumeration. More...
 
enum  eagine::deserialization_error_code : std::uint16_t {
  eagine::deserialization_error_code::not_supported, eagine::deserialization_error_code::not_enough_data, eagine::deserialization_error_code::unexpected_data, eagine::deserialization_error_code::incomplete_read,
  eagine::deserialization_error_code::missing_element, eagine::deserialization_error_code::excess_element, eagine::deserialization_error_code::missing_member, eagine::deserialization_error_code::excess_member,
  eagine::deserialization_error_code::invalid_format, eagine::deserialization_error_code::data_source_error, eagine::deserialization_error_code::backend_error
}
 Deserialization error code bits enumeration. More...
 

Functions

template<identifier_t SerializerId, typename T , typename Selector = default_selector_t>
constexpr auto eagine::serialize_buffer_for (const T &inst, Selector sel={})
 Returns a buffer large enough for the serialization of the specified instance.
 
template<typename T , typename Backend >
auto eagine::deserialize (T &value, Backend &backend) -> std::enable_if_t< std::is_base_of_v< deserializer_backend, Backend >, deserialization_errors >
 Deserializes a value with the specified serialization backend. More...
 
template<typename T >
static auto eagine::get_errors (const serialization_result< T > &result) noexcept -> serialization_errors
 Returns the error bitfield from a serialization result.
 
template<typename T >
static auto eagine::get_errors (const deserialization_result< T > &result) noexcept -> deserialization_errors
 Returns the error bitfield from a deserialization result.
 
static auto eagine::store_data_with_size (memory::const_block src, memory::block dst) noexcept -> memory::block
 Encodes the size of the source block into destination, copies data afterwards. More...
 
static auto eagine::skip_data_with_size (memory::const_block src) noexcept -> span_size_t
 In a block starting with sub-block with size returns the size of the sub-block. More...
 
static auto eagine::get_data_with_size (memory::block src) noexcept -> memory::block
 Extracts a sub-block from a larger mutable block with encoded sub-block size. More...
 
static auto eagine::get_data_with_size (memory::const_block src) noexcept -> memory::const_block
 Extracts a sub-block from a larger const block with encoded sub-block size. More...
 
template<typename Function >
static void eagine::for_each_data_with_size (memory::const_block src, Function function) noexcept
 In a larger block with sub-blocks with size, calls function on each sub-block. More...
 
template<typename T , typename Backend >
auto eagine::serialize (T &value, Backend &backend) -> std::enable_if_t< std::is_base_of_v< serializer_backend, Backend >, serialization_errors >
 Serializes a value with the specified serialization backend. More...
 

Detailed Description

Typedef Documentation

◆ deserialization_errors

Alias for deserialization error bitfield.

See also
deserialization_result
serialization_errors

◆ deserialization_result

template<typename T >
using eagine::deserialization_result = typedef valid_if_indicated<T, deserialization_errors, bool, false>

Alias for result type of deserialization operations.

See also
serialization_result
get_errors

◆ serialization_errors

Alias for serialization error bitfield.

See also
serialization_result
deserialization_errors

◆ serialization_result

template<typename T >
using eagine::serialization_result = typedef valid_if_indicated<T, serialization_errors, bool, false>

Alias for result type of serialization operations.

See also
deserialization_result
get_errors

Enumeration Type Documentation

◆ deserialization_error_code

enum eagine::deserialization_error_code : std::uint16_t
strong

Deserialization error code bits enumeration.

See also
deserialization_errors
deserializer_backend
deserializer_data_sink
Enumerator
not_supported 

Value type or format not supported.

not_enough_data 

Not enough data to deserialize the value.

unexpected_data 

Superfluous data in the deserialization source.

incomplete_read 

Incomplete read, remaining data should be read later.

missing_element 

Missing data for container element.

excess_element 

Superfluous data for container element.

missing_member 

Missing data for class data member.

excess_member 

Superfluous data for class data member.

invalid_format 

Invalid data format.

data_source_error 

Internal error in the deserialization data source.

backend_error 

Internal error in the deserialization backend.

◆ serialization_error_code

enum eagine::serialization_error_code : std::uint8_t
strong

Serialization error code bits enumeration.

See also
serialization_errors
serializer_backend
serializer_data_sink
Enumerator
not_supported 

Value type or format not supported.

too_much_data 

Too much data to fit into serialization data sink.

incomplete_write 

Incomplete write, remaining data should be written later.

data_sink_error 

Internal error in the serialization data sink.

backend_error 

Internal error in the serialization backend.

Function Documentation

◆ deserialize()

template<typename T , typename Backend >
auto eagine::deserialize ( T &  value,
Backend &  backend 
) -> std::enable_if_t< std::is_base_of_v<deserializer_backend, Backend>, deserialization_errors>

◆ for_each_data_with_size()

template<typename Function >
static void eagine::for_each_data_with_size ( memory::const_block  src,
Function  function 
)
inlinestaticnoexcept

In a larger block with sub-blocks with size, calls function on each sub-block.

See also
store_data_with_size
get_data_with_size

◆ get_data_with_size() [1/2]

static auto eagine::get_data_with_size ( memory::block  src) -> memory::block
inlinestaticnoexcept

Extracts a sub-block from a larger mutable block with encoded sub-block size.

See also
store_data_with_size

◆ get_data_with_size() [2/2]

static auto eagine::get_data_with_size ( memory::const_block  src) -> memory::const_block
inlinestaticnoexcept

Extracts a sub-block from a larger const block with encoded sub-block size.

See also
store_data_with_size

◆ serialize()

template<typename T , typename Backend >
auto eagine::serialize ( T &  value,
Backend &  backend 
) -> std::enable_if_t< std::is_base_of_v<serializer_backend, Backend>, serialization_errors>

◆ skip_data_with_size()

static auto eagine::skip_data_with_size ( memory::const_block  src) -> span_size_t
inlinestaticnoexcept

In a block starting with sub-block with size returns the size of the sub-block.

See also
store_data_with_size
get_data_with_size

Referenced by eagine::msgbus::stored_message::signature().

◆ store_data_with_size()

static auto eagine::store_data_with_size ( memory::const_block  src,
memory::block  dst 
) -> memory::block
inlinestaticnoexcept

Encodes the size of the source block into destination, copies data afterwards.

See also
get_data_with_size

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).