Commit 7dd7ced5 authored by Dominik Charousset's avatar Dominik Charousset

Integrate review feedback

parent 886853d5
......@@ -166,7 +166,7 @@ int main(int argc, char** argv) {
<< " default:\n"
<< " return false;\n";
for (auto& val : enum_values)
out << " case " << case_label_prefix << val << ":\n";
out << " case " << case_label_prefix << val << ":\n";
out << " out = result;\n"
<< " return true;\n"
<< " };\n"
......
......@@ -112,7 +112,7 @@ public:
return detail::load(dref(), x);
}
/// Deerializes a primitive value with getter / setter access.
/// Deserializes a primitive value with getter / setter access.
template <class Get, class Set>
[[nodiscard]] bool apply(Get&& get, Set&& set) {
using value_type = std::decay_t<decltype(get())>;
......
......@@ -71,14 +71,14 @@ bool from_integer(std::underlying_type_t<exit_reason> in,
switch(result) {
default:
return false;
case exit_reason::normal:
case exit_reason::unhandled_exception:
case exit_reason::unknown:
case exit_reason::out_of_workers:
case exit_reason::user_shutdown:
case exit_reason::kill:
case exit_reason::remote_link_unreachable:
case exit_reason::unreachable:
case exit_reason::normal:
case exit_reason::unhandled_exception:
case exit_reason::unknown:
case exit_reason::out_of_workers:
case exit_reason::user_shutdown:
case exit_reason::kill:
case exit_reason::remote_link_unreachable:
case exit_reason::unreachable:
out = result;
return true;
};
......
......@@ -47,9 +47,9 @@ bool from_integer(std::underlying_type_t<inbox_result> in,
switch(result) {
default:
return false;
case inbox_result::success:
case inbox_result::unblocked_reader:
case inbox_result::queue_closed:
case inbox_result::success:
case inbox_result::unblocked_reader:
case inbox_result::queue_closed:
out = result;
return true;
};
......
......@@ -52,10 +52,10 @@ bool from_integer(std::underlying_type_t<task_result> in,
switch(result) {
default:
return false;
case task_result::resume:
case task_result::skip:
case task_result::stop:
case task_result::stop_all:
case task_result::resume:
case task_result::skip:
case task_result::stop:
case task_result::stop_all:
out = result;
return true;
};
......
......@@ -46,9 +46,9 @@ bool from_integer(std::underlying_type_t<invoke_message_result> in,
switch(result) {
default:
return false;
case invoke_message_result::consumed:
case invoke_message_result::skipped:
case invoke_message_result::dropped:
case invoke_message_result::consumed:
case invoke_message_result::skipped:
case invoke_message_result::dropped:
out = result;
return true;
};
......
......@@ -41,8 +41,8 @@ bool from_integer(std::underlying_type_t<message_priority> in,
switch(result) {
default:
return false;
case message_priority::high:
case message_priority::normal:
case message_priority::high:
case message_priority::normal:
out = result;
return true;
};
......
......@@ -146,29 +146,29 @@ bool from_integer(std::underlying_type_t<pec> in,
switch(result) {
default:
return false;
case pec::success:
case pec::trailing_character:
case pec::unexpected_eof:
case pec::unexpected_character:
case pec::timespan_overflow:
case pec::fractional_timespan:
case pec::too_many_characters:
case pec::invalid_escape_sequence:
case pec::unexpected_newline:
case pec::integer_overflow:
case pec::integer_underflow:
case pec::exponent_underflow:
case pec::exponent_overflow:
case pec::type_mismatch:
case pec::not_an_option:
case pec::invalid_argument:
case pec::missing_argument:
case pec::invalid_category:
case pec::invalid_field_name:
case pec::repeated_field_name:
case pec::missing_field:
case pec::invalid_range_expression:
case pec::invalid_state:
case pec::success:
case pec::trailing_character:
case pec::unexpected_eof:
case pec::unexpected_character:
case pec::timespan_overflow:
case pec::fractional_timespan:
case pec::too_many_characters:
case pec::invalid_escape_sequence:
case pec::unexpected_newline:
case pec::integer_overflow:
case pec::integer_underflow:
case pec::exponent_underflow:
case pec::exponent_overflow:
case pec::type_mismatch:
case pec::not_an_option:
case pec::invalid_argument:
case pec::missing_argument:
case pec::invalid_category:
case pec::invalid_field_name:
case pec::repeated_field_name:
case pec::missing_field:
case pec::invalid_range_expression:
case pec::invalid_state:
out = result;
return true;
};
......
......@@ -346,69 +346,69 @@ bool from_integer(std::underlying_type_t<sec> in,
switch(result) {
default:
return false;
case sec::none:
case sec::unexpected_message:
case sec::unexpected_response:
case sec::request_receiver_down:
case sec::request_timeout:
case sec::no_such_group_module:
case sec::no_actor_published_at_port:
case sec::unexpected_actor_messaging_interface:
case sec::state_not_serializable:
case sec::unsupported_sys_key:
case sec::unsupported_sys_message:
case sec::disconnect_during_handshake:
case sec::cannot_forward_to_invalid_actor:
case sec::no_route_to_receiving_node:
case sec::failed_to_assign_scribe_from_handle:
case sec::failed_to_assign_doorman_from_handle:
case sec::cannot_close_invalid_port:
case sec::cannot_connect_to_node:
case sec::cannot_open_port:
case sec::network_syscall_failed:
case sec::invalid_argument:
case sec::invalid_protocol_family:
case sec::cannot_publish_invalid_actor:
case sec::cannot_spawn_actor_from_arguments:
case sec::end_of_stream:
case sec::no_context:
case sec::unknown_type:
case sec::no_proxy_registry:
case sec::runtime_error:
case sec::remote_linking_failed:
case sec::cannot_add_upstream:
case sec::upstream_already_exists:
case sec::invalid_upstream:
case sec::cannot_add_downstream:
case sec::downstream_already_exists:
case sec::invalid_downstream:
case sec::no_downstream_stages_defined:
case sec::stream_init_failed:
case sec::invalid_stream_state:
case sec::unhandled_stream_error:
case sec::bad_function_call:
case sec::feature_disabled:
case sec::cannot_open_file:
case sec::socket_invalid:
case sec::socket_disconnected:
case sec::socket_operation_failed:
case sec::unavailable_or_would_block:
case sec::incompatible_versions:
case sec::incompatible_application_ids:
case sec::malformed_basp_message:
case sec::serializing_basp_payload_failed:
case sec::redundant_connection:
case sec::remote_lookup_failed:
case sec::no_tracing_context:
case sec::all_requests_failed:
case sec::field_invariant_check_failed:
case sec::field_value_synchronization_failed:
case sec::invalid_field_type:
case sec::unsafe_type:
case sec::save_callback_failed:
case sec::load_callback_failed:
case sec::conversion_failed:
case sec::connection_closed:
case sec::none:
case sec::unexpected_message:
case sec::unexpected_response:
case sec::request_receiver_down:
case sec::request_timeout:
case sec::no_such_group_module:
case sec::no_actor_published_at_port:
case sec::unexpected_actor_messaging_interface:
case sec::state_not_serializable:
case sec::unsupported_sys_key:
case sec::unsupported_sys_message:
case sec::disconnect_during_handshake:
case sec::cannot_forward_to_invalid_actor:
case sec::no_route_to_receiving_node:
case sec::failed_to_assign_scribe_from_handle:
case sec::failed_to_assign_doorman_from_handle:
case sec::cannot_close_invalid_port:
case sec::cannot_connect_to_node:
case sec::cannot_open_port:
case sec::network_syscall_failed:
case sec::invalid_argument:
case sec::invalid_protocol_family:
case sec::cannot_publish_invalid_actor:
case sec::cannot_spawn_actor_from_arguments:
case sec::end_of_stream:
case sec::no_context:
case sec::unknown_type:
case sec::no_proxy_registry:
case sec::runtime_error:
case sec::remote_linking_failed:
case sec::cannot_add_upstream:
case sec::upstream_already_exists:
case sec::invalid_upstream:
case sec::cannot_add_downstream:
case sec::downstream_already_exists:
case sec::invalid_downstream:
case sec::no_downstream_stages_defined:
case sec::stream_init_failed:
case sec::invalid_stream_state:
case sec::unhandled_stream_error:
case sec::bad_function_call:
case sec::feature_disabled:
case sec::cannot_open_file:
case sec::socket_invalid:
case sec::socket_disconnected:
case sec::socket_operation_failed:
case sec::unavailable_or_would_block:
case sec::incompatible_versions:
case sec::incompatible_application_ids:
case sec::malformed_basp_message:
case sec::serializing_basp_payload_failed:
case sec::redundant_connection:
case sec::remote_lookup_failed:
case sec::no_tracing_context:
case sec::all_requests_failed:
case sec::field_invariant_check_failed:
case sec::field_value_synchronization_failed:
case sec::invalid_field_type:
case sec::unsafe_type:
case sec::save_callback_failed:
case sec::load_callback_failed:
case sec::conversion_failed:
case sec::connection_closed:
out = result;
return true;
};
......
......@@ -56,11 +56,11 @@ bool from_integer(std::underlying_type_t<stream_priority> in,
switch(result) {
default:
return false;
case stream_priority::very_high:
case stream_priority::high:
case stream_priority::normal:
case stream_priority::low:
case stream_priority::very_low:
case stream_priority::very_high:
case stream_priority::high:
case stream_priority::normal:
case stream_priority::low:
case stream_priority::very_low:
out = result;
return true;
};
......
......@@ -68,13 +68,13 @@ bool from_integer(std::underlying_type_t<message_type> in,
switch(result) {
default:
return false;
case message_type::server_handshake:
case message_type::client_handshake:
case message_type::direct_message:
case message_type::routed_message:
case message_type::monitor_message:
case message_type::down_message:
case message_type::heartbeat:
case message_type::server_handshake:
case message_type::client_handshake:
case message_type::direct_message:
case message_type::routed_message:
case message_type::monitor_message:
case message_type::down_message:
case message_type::heartbeat:
out = result;
return true;
};
......
......@@ -48,9 +48,9 @@ bool from_integer(std::underlying_type_t<operation> in,
switch(result) {
default:
return false;
case operation::read:
case operation::write:
case operation::propagate_error:
case operation::read:
case operation::write:
case operation::propagate_error:
out = result;
return true;
};
......
......@@ -843,7 +843,7 @@ public:
caf::byte_buffer serialize(const Ts&... xs) {
caf::byte_buffer buf;
caf::binary_serializer sink{sys, buf};
if (!sink.apply(xs...))
if (!(sink.apply(xs) && ...))
CAF_FAIL("serialization failed: " << sink.get_error());
return buf;
}
......@@ -851,7 +851,7 @@ public:
template <class... Ts>
void deserialize(const caf::byte_buffer& buf, Ts&... xs) {
caf::binary_deserializer source{sys, buf};
if (!source.apply(xs...))
if (!(source.apply(xs) && ...))
CAF_FAIL("deserialization failed: " << source.get_error());
}
......
......@@ -6,8 +6,8 @@ Type Inspection
We designed CAF with distributed systems in mind. Hence, all message types must
be serializable. Using a message type that is not serializable causes a compiler
error unless explicitly listed as unsafe message type by the user (see
:ref:`unsafe-message-type`). Any unsafe message type may used only for messages
that remain local, i.e., never cross the wire.
:ref:`unsafe-message-type`). Any unsafe message type may be used only for
messages that remain local, i.e., never cross the wire.
.. _type-inspection-data-model:
......@@ -27,7 +27,7 @@ lists
tuples
Fixed-sized container types such as ``std::tuple`` or ``std::array`` as well
as builtin C array types.
as built-in C array types.
maps
Dynamically-sized container types with key/value pairs such as ``std::map``.
......@@ -191,8 +191,8 @@ For our ``id`` type, the ``inspect`` overload may instead look as follows:
return f.apply(x.value);
}
With this implementation instead of the previous one, inspectors simply read or
write strings whenever they encounter an ``id`` as value. This simplifies our
In contrast to the previous implementation, inspectors now simply read or write
the strings as values whenever they encounter an ``id``. This simplifies our
config file from before and thus gives a much cleaner interface to users:
.. code-block:: none
......@@ -442,8 +442,8 @@ gives the best performance. However, using the constant names results in a much
better user experience in all other cases.
The following code illustrates how to provide a string representation for
inspectors that operate on human-readable data representation and the underlying
type for an ``enum class`` otherwise.
inspectors that operate on human-readable data representations while operating
directly on the underlying type of the ``enum class`` otherwise.
.. code-block:: C++
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment