CAF  0.17.3
Public Types | Public Member Functions | Protected Attributes | List of all members
caf::serializer Class Referenceabstract

#include <serializer.hpp>

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

Public Types

using result_type = error
 

Public Member Functions

 serializer (actor_system &sys) noexcept
 
 serializer (execution_unit *ctx=nullptr) noexcept
 
auto context () const noexcept
 
virtual result_type begin_object (uint16_t typenr, string_view type_name)=0
 Begins processing of an object. More...
 
virtual result_type end_object ()=0
 Ends processing of an object.
 
virtual result_type begin_sequence (size_t num)=0
 Begins processing of a sequence. More...
 
virtual result_type end_sequence ()=0
 Ends processing of a sequence.
 
virtual result_type apply (bool x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (int8_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (uint8_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (int16_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (uint16_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (int32_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (uint32_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (int64_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (uint64_t x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (float x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (double x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (long double x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (string_view x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (const std::u16string &x)=0
 Adds the primitive type x to the output. More...
 
virtual result_type apply (const std::u32string &x)=0
 Adds the primitive type x to the output. More...
 
template<class Enum , class = std::enable_if_t<std::is_enum<Enum>::value>>
auto apply (Enum x)
 
virtual result_type apply (span< const byte > x)=0
 Adds x as raw byte block to the output. More...
 
virtual result_type apply (const std::vector< bool > &xs)
 Adds each boolean in xs to the output. More...
 
- Public Member Functions inherited from caf::read_inspector< serializer >
auto operator() (Ts &&... xs)
 

Protected Attributes

execution_unitcontext_
 Provides access to the ::proxy_registry and to the ::actor_system.
 

Additional Inherited Members

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

Detailed Description

Technology-independent serialization interface.

Member Function Documentation

◆ apply() [1/17]

virtual result_type caf::serializer::apply ( bool  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [2/17]

virtual result_type caf::serializer::apply ( const std::u16string &  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [3/17]

virtual result_type caf::serializer::apply ( const std::u32string &  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [4/17]

virtual result_type caf::serializer::apply ( const std::vector< bool > &  xs)
virtual

Adds each boolean in xs to the output.

Derived classes can override this member function to pack the booleans, for example to avoid using one byte for each value in a binary output format.

◆ apply() [5/17]

virtual result_type caf::serializer::apply ( double  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [6/17]

virtual result_type caf::serializer::apply ( float  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [7/17]

virtual result_type caf::serializer::apply ( int16_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [8/17]

virtual result_type caf::serializer::apply ( int32_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [9/17]

virtual result_type caf::serializer::apply ( int64_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [10/17]

virtual result_type caf::serializer::apply ( int8_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [11/17]

virtual result_type caf::serializer::apply ( long double  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [12/17]

virtual result_type caf::serializer::apply ( span< const byte x)
pure virtual

Adds x as raw byte block to the output.

Parameters
xThe byte sequence.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [13/17]

virtual result_type caf::serializer::apply ( string_view  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [14/17]

virtual result_type caf::serializer::apply ( uint16_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [15/17]

virtual result_type caf::serializer::apply ( uint32_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [16/17]

virtual result_type caf::serializer::apply ( uint64_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ apply() [17/17]

virtual result_type caf::serializer::apply ( uint8_t  x)
pure virtual

Adds the primitive type x to the output.

Parameters
xThe primitive value.
Returns
A non-zero error code on failure, sec::success otherwise.

◆ begin_object()

virtual result_type caf::serializer::begin_object ( uint16_t  typenr,
string_view  type_name 
)
pure virtual

Begins processing of an object.

Saves the type information to the underlying storage.

◆ begin_sequence()

virtual result_type caf::serializer::begin_sequence ( size_t  num)
pure virtual

Begins processing of a sequence.

Saves the size to the underlying storage when in saving mode, otherwise sets num accordingly.


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