SObjectizer-5 Extra
Loading...
Searching...
No Matches
so_5::extra::mboxes::composite Namespace Reference

Namespaces

namespace  errors
 
namespace  impl
 

Classes

struct  drop_if_not_found_case_t
 Description of a case when a message of unknown type has to be dropped. More...
 
class  mbox_builder_t
 Factory class for building an instance of composite mbox. More...
 
class  redirect_to_if_not_found_case_t
 Description of a case when messages of unknown type have to be redirected to another mbox. More...
 
struct  throw_if_not_found_case_t
 Description of a case when an exception has to be thrown if the type of a message is unknown. More...
 

Typedefs

using type_not_found_reaction_t
 Type that describes the reaction to a message of unknown type.
 

Functions

type_not_found_reaction_t redirect_to_if_not_found (const mbox_t &dest_mbox)
 Helper function to set a reaction to unknown message type.
 
type_not_found_reaction_t throw_if_not_found ()
 Helper function to set a reaction to unknown message type.
 
type_not_found_reaction_t drop_if_not_found ()
 Helper function to set a reaction to unknown message type.
 
mbox_builder_t builder (mbox_type_t mbox_type, type_not_found_reaction_t unknown_type_reaction)
 Factory function for making mbox_builder.
 
mbox_builder_t multi_consumer_builder (type_not_found_reaction_t unknown_type_reaction)
 Factory function for making mbox_builder that produces MPMC composite mbox.
 
mbox_builder_t single_consumer_builder (type_not_found_reaction_t unknown_type_reaction)
 Factory function for making mbox_builder that produces MPSC composite mbox.
 

Typedef Documentation

◆ type_not_found_reaction_t

Initial value:
std::variant<
redirect_to_if_not_found_case_t,
throw_if_not_found_case_t,
drop_if_not_found_case_t
>

Type that describes the reaction to a message of unknown type.

Since
v.1.5.2

Definition at line 139 of file composite.hpp.

Function Documentation

◆ builder()

mbox_builder_t so_5::extra::mboxes::composite::builder ( mbox_type_t mbox_type,
type_not_found_reaction_t unknown_type_reaction )
inlinenodiscard

Factory function for making mbox_builder.

Usage example:

auto result_mbox = builder(
so_5::mbox_type_t::multi_producer_multi_consumer,
redirect_to_if_not_found(default_mbox))
.add<msg_first>(first_mbox)
.add<msg_second>(second_mbox)
.add<msg_third>(third_mbox)
.make(env);
mbox_builder_t & add(mbox_t dest_mbox) &
Add destination mbox for a message type.
mbox_builder_t builder(mbox_type_t mbox_type, type_not_found_reaction_t unknown_type_reaction)
Factory function for making mbox_builder.
type_not_found_reaction_t redirect_to_if_not_found(const mbox_t &dest_mbox)
Helper function to set a reaction to unknown message type.
Since
v.1.5.2
Parameters
mbox_typeType of new mbox: MPMC or MPSC.
unknown_type_reactionWhat to do if message type is unknown.

Definition at line 1164 of file composite.hpp.

◆ drop_if_not_found()

type_not_found_reaction_t so_5::extra::mboxes::composite::drop_if_not_found ( )
inlinenodiscard

Helper function to set a reaction to unknown message type.

Attempt to use unknown message type (e.g. sending of a message, subscription or settting delivery filter) should be silently ignored.

Usage example:

auto mbox = multi_consumer_builder(drop_if_not_found(default_mbox))
.add<first_message>(first_mbox)
.add<second_message>(second_mbox)
.make(env);
mbox_t make(environment_t &env)
Make a composite mbox.
type_not_found_reaction_t drop_if_not_found()
Helper function to set a reaction to unknown message type.
mbox_builder_t multi_consumer_builder(type_not_found_reaction_t unknown_type_reaction)
Factory function for making mbox_builder that produces MPMC composite mbox.
Since
v.1.5.2

Definition at line 217 of file composite.hpp.

◆ multi_consumer_builder()

mbox_builder_t so_5::extra::mboxes::composite::multi_consumer_builder ( type_not_found_reaction_t unknown_type_reaction)
inlinenodiscard

Factory function for making mbox_builder that produces MPMC composite mbox.

Usage example:

auto result_mbox = multi_consumer_builder(
redirect_to_if_not_found(default_mbox))
.add<msg_first>(first_mbox)
.add<msg_second>(second_mbox)
.add<msg_third>(third_mbox)
.make(env);
Since
v.1.5.2
Parameters
unknown_type_reactionWhat to do if message type is unknown.

Definition at line 1193 of file composite.hpp.

◆ redirect_to_if_not_found()

type_not_found_reaction_t so_5::extra::mboxes::composite::redirect_to_if_not_found ( const mbox_t & dest_mbox)
inlinenodiscard

Helper function to set a reaction to unknown message type.

Message of unknown type has to be redirected to specified mbox. Subscriptions and delivery filters for unknown type have also be handled by dest_mbox.

Usage example:

.add<first_message>(first_mbox)
.add<second_message>(second_mbox)
.make(env);
Since
v.1.5.2

Definition at line 166 of file composite.hpp.

◆ single_consumer_builder()

mbox_builder_t so_5::extra::mboxes::composite::single_consumer_builder ( type_not_found_reaction_t unknown_type_reaction)
inlinenodiscard

Factory function for making mbox_builder that produces MPSC composite mbox.

Usage example:

auto result_mbox = single_consumer_builder(
redirect_to_if_not_found(default_mbox))
.add<msg_first>(first_mbox)
.add< so_5::mutable_msg<msg_second> >(second_mbox)
.add<msg_third>(third_mbox)
.make(env);
mbox_builder_t single_consumer_builder(type_not_found_reaction_t unknown_type_reaction)
Factory function for making mbox_builder that produces MPSC composite mbox.
Since
v.1.5.2

Definition at line 1222 of file composite.hpp.

◆ throw_if_not_found()

type_not_found_reaction_t so_5::extra::mboxes::composite::throw_if_not_found ( )
inlinenodiscard

Helper function to set a reaction to unknown message type.

Attempt to use unknown message type (e.g. sending of a message, subscription or settting delivery filter) should lead to raising an exception (an instance of so_5::exception_t will be thrown).

Usage example:

auto mbox = multi_consumer_builder(throw_if_not_found(default_mbox))
.add<first_message>(first_mbox)
.add<second_message>(second_mbox)
.make(env);
type_not_found_reaction_t throw_if_not_found()
Helper function to set a reaction to unknown message type.
Since
v.1.5.2

Definition at line 192 of file composite.hpp.