C++ Actor Framework  0.18
Public Types | Public Member Functions | List of all members
caf::config_value_writer Class Referencefinal

Serializes an objects into a config_value. More...

#include <config_value_writer.hpp>

Inheritance diagram for caf::config_value_writer:
Inheritance graph
Collaboration diagram for caf::config_value_writer:
Collaboration graph

Public Types

using super = serializer
 
using value_type = variant< config_value *, settings *, absent_field, present_field, std::vector< config_value > * >
 
using stack_type = std::stack< value_type, std::vector< value_type > >
 
- Public Types inherited from caf::serializer
using super = save_inspector_base< serializer >
 

Public Member Functions

 config_value_writer (config_value *dst, actor_system &sys)
 
 config_value_writer (config_value *dst, execution_unit *ctx)
 
 config_value_writer (config_value *destination)
 
bool begin_object (type_id_t type, string_view name) override
 Begins processing of an object. More...
 
bool end_object () override
 Ends processing of an object.
 
bool begin_field (string_view) override
 
bool begin_field (string_view name, bool is_present) override
 
bool begin_field (string_view name, span< const type_id_t > types, size_t index) override
 
bool begin_field (string_view name, bool is_present, span< const type_id_t > types, size_t index) override
 
bool end_field () override
 
bool begin_tuple (size_t size) override
 Begins processing of a tuple.
 
bool end_tuple () override
 Ends processing of a tuple.
 
bool begin_key_value_pair () override
 Begins processing of a tuple with two elements, whereas the first element represents the key in an associative array. More...
 
bool end_key_value_pair () override
 Ends processing of a key-value pair after both values were written. More...
 
bool begin_sequence (size_t size) override
 Begins processing of a sequence. Saves the size to the underlying storage.
 
bool end_sequence () override
 Ends processing of a sequence.
 
bool begin_associative_array (size_t size) override
 Begins processing of an associative array (map). More...
 
bool end_associative_array () override
 Ends processing of an associative array (map). More...
 
bool value (byte x) override
 Adds x to the output. More...
 
bool value (bool x) override
 Adds x to the output. More...
 
bool value (int8_t x) override
 Adds x to the output. More...
 
bool value (uint8_t x) override
 Adds x to the output. More...
 
bool value (int16_t x) override
 Adds x to the output. More...
 
bool value (uint16_t x) override
 Adds x to the output. More...
 
bool value (int32_t x) override
 Adds x to the output. More...
 
bool value (uint32_t x) override
 Adds x to the output. More...
 
bool value (int64_t x) override
 Adds x to the output. More...
 
bool value (uint64_t x) override
 Adds x to the output. More...
 
bool value (float x) override
 Adds x to the output. More...
 
bool value (double x) override
 Adds x to the output. More...
 
bool value (long double x) override
 Adds x to the output. More...
 
bool value (string_view x) override
 Adds x to the output. More...
 
bool value (const std::u16string &x) override
 Adds x to the output. More...
 
bool value (const std::u32string &x) override
 Adds x to the output. More...
 
bool value (span< const byte > x) override
 Adds x as raw byte block to the output. More...
 
- Public Member Functions inherited from caf::serializer
 serializer (actor_system &sys) noexcept
 
 serializer (execution_unit *ctx=nullptr) noexcept
 
auto context () const noexcept
 
bool has_human_readable_format () const noexcept
 
template<class T >
std::enable_if_t< std::is_integral< T >::value, bool > value (T x)
 Adds x to the output. More...
 
virtual bool list (const std::vector< bool > &xs)
 Adds each boolean in xs to the output. More...
 

Additional Inherited Members

- Protected Attributes inherited from caf::serializer
execution_unitcontext_
 Provides access to the ::proxy_registry and to the ::actor_system.
 
bool has_human_readable_format_ = false
 Configures whether client code should assume human-readable output.
 

Detailed Description

Serializes an objects into a config_value.

Member Function Documentation

◆ begin_associative_array()

bool caf::config_value_writer::begin_associative_array ( size_t  size)
overridevirtual

Begins processing of an associative array (map).

Note
the default implementation calls begin_sequence(size).

Reimplemented from caf::serializer.

◆ begin_key_value_pair()

bool caf::config_value_writer::begin_key_value_pair ( )
overridevirtual

Begins processing of a tuple with two elements, whereas the first element represents the key in an associative array.

Note
the default implementation calls begin_tuple(2).

Reimplemented from caf::serializer.

◆ begin_object()

bool caf::config_value_writer::begin_object ( type_id_t  type,
string_view  name 
)
overridevirtual

Begins processing of an object.

May save the type information to the underlying storage to allow a deserializer to retrieve and check the type information for data formats that provide deserialization.

Implements caf::serializer.

◆ end_associative_array()

bool caf::config_value_writer::end_associative_array ( )
overridevirtual

Ends processing of an associative array (map).

Note
the default implementation calls end_sequence().

Reimplemented from caf::serializer.

◆ end_key_value_pair()

bool caf::config_value_writer::end_key_value_pair ( )
overridevirtual

Ends processing of a key-value pair after both values were written.

Note
the default implementation calls end_tuple().

Reimplemented from caf::serializer.

◆ value() [1/17]

bool caf::config_value_writer::value ( byte  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [2/17]

bool caf::config_value_writer::value ( bool  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [3/17]

bool caf::config_value_writer::value ( int8_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [4/17]

bool caf::config_value_writer::value ( uint8_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [5/17]

bool caf::config_value_writer::value ( int16_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [6/17]

bool caf::config_value_writer::value ( uint16_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [7/17]

bool caf::config_value_writer::value ( int32_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [8/17]

bool caf::config_value_writer::value ( uint32_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [9/17]

bool caf::config_value_writer::value ( int64_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [10/17]

bool caf::config_value_writer::value ( uint64_t  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [11/17]

bool caf::config_value_writer::value ( float  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [12/17]

bool caf::config_value_writer::value ( double  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [13/17]

bool caf::config_value_writer::value ( long double  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [14/17]

bool caf::config_value_writer::value ( string_view  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [15/17]

bool caf::config_value_writer::value ( const std::u16string &  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [16/17]

bool caf::config_value_writer::value ( const std::u32string &  x)
overridevirtual

Adds x to the output.

Parameters
xA value for a builtin type.
Returns
true on success, false otherwise.

Implements caf::serializer.

◆ value() [17/17]

bool caf::config_value_writer::value ( span< const byte x)
overridevirtual

Adds x as raw byte block to the output.

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

Implements caf::serializer.


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