10 #include <so_5_extra/error_ranges.hpp> 12 #include <so_5/impl/msg_tracing_helpers.hpp> 14 #include <so_5/environment.hpp> 15 #include <so_5/mbox.hpp> 93 errors::rc_null_as_default_destination_mbox,
94 "nullptr can't be used as the default destination mbox" );
108 dest()
const noexcept {
return m_dest; }
168 return { redirect_to_if_not_found_case_t{ dest_mbox } };
194 return { throw_if_not_found_case_t{} };
219 return { drop_if_not_found_case_t{} };
243 sink_t( std::type_index msg_type, mbox_t dest )
262 [](
const sink_t & sink,
const std::type_index & msg_type ) ->
bool {
263 return sink.m_msg_type < msg_type;
283 const std::type_index & msg_type,
284 const so_5::message_limit::control_block_t * limit,
285 agent_t & subscriber )
294 c.dest()->subscribe_event_handler(
303 SO_5_THROW_EXCEPTION(
304 errors::rc_no_sink_for_message_type,
305 "no destination for this message type, " 306 "msg_type=" + std::string(m_msg_type.name()) );
329 const std::type_index & msg_type,
330 agent_t & subscriber )
338 c.dest()->unsubscribe_event_handlers(
362 template<
typename Tracer >
373 const std::type_index & msg_type,
374 const message_ref_t & msg,
375 unsigned int overlimit_deep )
388 "redirect_to_default_destination",
401 "no_destination.throw_exception" );
404 "no destination for this message type, " 412 "no_destination.drop_message" );
430 const std::type_index & msg_type,
431 const delivery_filter_t & filter,
432 agent_t & subscriber )
441 c.dest()->set_delivery_filter(
450 SO_5_THROW_EXCEPTION(
451 errors::rc_no_sink_for_message_type,
452 "no destination for this message type, " 453 "msg_type=" + std::string(m_msg_type.name()) );
476 const std::type_index & msg_type,
477 agent_t & subscriber )
noexcept 485 c.dest()->drop_delivery_filter(
530 mbox_type_t mbox_type,
531 type_not_found_reaction_t unknown_type_reaction,
532 sink_container_t sinks )
550 template<
typename Tracing_Base >
553 ,
private Tracing_Base
563 template<
typename... Tracing_Args >
567 Tracing_Args &&... tracing_args )
583 const std::type_index & msg_type,
584 const so_5::message_limit::control_block_t * limit,
585 agent_t & subscriber )
override 608 const std::type_index & msg_type,
609 agent_t & subscriber )
override 632 s <<
"<mbox:type=COMPOSITE";
658 const std::type_index & msg_type,
659 const message_ref_t & message,
660 unsigned int overlimit_reaction_deep )
override 676 "redirect_to_destination",
701 const std::type_index & msg_type,
702 const delivery_filter_t & filter,
703 agent_t & subscriber )
override 726 const std::type_index & msg_type,
727 agent_t & subscriber )
noexcept override 785 const std::type_index & msg_type,
786 const message_ref_t & what )
const 794 "an attempt to deliver mutable message via MPMC mbox" 869 mbox_type_t mbox_type,
870 type_not_found_reaction_t unknown_type_reaction );
875 mbox_type_t mbox_type,
877 type_not_found_reaction_t unknown_type_reaction )
937 template<
typename Msg_Type >
949 "mutable message can't handled with MPMC composite, " 962 "MPMC mbox can't be added as a sink to MPSC " 963 "composite and mutable message, " 974 "message type already has a destination mbox, " 1030 template<
typename Msg_Type >
1065 return env.make_custom_mbox(
1066 [
this](
const mbox_creation_data_t & data )
1068 impl::mbox_data_t mbox_data{
1072 std::move(m_unknown_type_reaction),
1077 if( data.m_tracer.get().is_msg_tracing_enabled() )
1079 using ::so_5::impl::msg_tracing_helpers::
1080 tracing_enabled_base;
1081 using T = impl::actual_mbox_t< tracing_enabled_base >;
1083 result = mbox_t{
new T{
1084 std::move(mbox_data),
1090 using ::so_5::impl::msg_tracing_helpers::
1091 tracing_disabled_base;
1092 using T = impl::actual_mbox_t< tracing_disabled_base >;
1094 result = mbox_t{
new T{ std::move(mbox_data) } };
1128 impl::sink_container_t result;
1129 result.reserve( m_sinks.size() );
1132 for(
const auto & [k, v] : m_sinks )
1133 result.emplace_back( k, v );
1161 mbox_type_t mbox_type,
1163 type_not_found_reaction_t unknown_type_reaction )
1165 return { mbox_type, std::move(unknown_type_reaction) };
1190 type_not_found_reaction_t unknown_type_reaction )
1193 mbox_type_t::multi_producer_multi_consumer,
1194 std::move(unknown_type_reaction) );
1218 type_not_found_reaction_t unknown_type_reaction )
1221 mbox_type_t::multi_producer_single_consumer,
1222 std::move(unknown_type_reaction) );
const delivery_filter_t & m_filter
Function object to be used with std::visit.
Function object to be used with std::visit.
subscribe_event_t(const std::type_index &msg_type, const so_5::message_limit::control_block_t *limit, agent_t &subscriber)
void operator()(const throw_if_not_found_case_t &) const
void operator()(const drop_if_not_found_case_t &) const
void operator()(const drop_if_not_found_case_t &) const
unsigned int m_overlimit_deep
void operator()(const throw_if_not_found_case_t &) const
const std::type_index & m_msg_type
const std::type_index & m_msg_type
Ranges for error codes of each submodules.
void operator()(const throw_if_not_found_case_t &) const
Function object to be used with std::visit.
set_delivery_filter_t(const std::type_index &msg_type, const delivery_filter_t &filter, agent_t &subscriber)
void operator()(const redirect_to_if_not_found_case_t &c) const
Function object to be used with std::visit.
void operator()(const redirect_to_if_not_found_case_t &c) const
void operator()(const drop_if_not_found_case_t &) const
const std::type_index & m_msg_type
void operator()(const throw_if_not_found_case_t &) const
drop_delivery_filter_t(const std::type_index &msg_type, agent_t &subscriber) noexcept
const std::type_index & m_msg_type
void operator()(const redirect_to_if_not_found_case_t &c) const noexcept
void operator()(const drop_if_not_found_case_t &) const
Function object to be used with std::visit.
void operator()(const throw_if_not_found_case_t &) const noexcept
void operator()(const redirect_to_if_not_found_case_t &c) const
const so_5::message_limit::control_block_t * m_limit
void operator()(const redirect_to_if_not_found_case_t &c) const
void operator()(const drop_if_not_found_case_t &) const noexcept
const std::type_index & m_msg_type
deliver_message_t(Tracer &tracer, const std::type_index &msg_type, const message_ref_t &msg, unsigned int overlimit_deep)
const message_ref_t & m_msg
unsubscribe_event_t(const std::type_index &msg_type, agent_t &subscriber)