SObjectizer-5 Extra
Namespaces | Classes | Typedefs | Functions
so_5::extra::mboxes::composite Namespace Reference

Namespaces

 errors
 
 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 = 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. More...
 

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. More...
 
type_not_found_reaction_t throw_if_not_found ()
 Helper function to set a reaction to unknown message type. More...
 
type_not_found_reaction_t drop_if_not_found ()
 Helper function to set a reaction to unknown message type. More...
 
mbox_builder_t builder (mbox_type_t mbox_type, type_not_found_reaction_t unknown_type_reaction)
 Factory function for making mbox_builder. More...
 
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. More...
 
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. More...
 

Typedef Documentation

◆ type_not_found_reaction_t

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

Since
v.1.5.2

Definition at line 143 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 
)
inline

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);
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 1159 of file composite.hpp.

◆ drop_if_not_found()

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

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);
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)
inline

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 1188 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)
inline

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)
inline

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);
Since
v.1.5.2
Examples:
mboxes/composite/simple/main.cpp.

Definition at line 1217 of file composite.hpp.

◆ throw_if_not_found()

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

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);
Since
v.1.5.2
Examples:
mboxes/composite/simple/main.cpp.

Definition at line 192 of file composite.hpp.