|
SObjectizer
5.8
|
A multi-producer/single-consumer mbox definition. More...
#include <mpsc_mbox.hpp>
Public Member Functions | |
| template<typename... Tracing_Args> | |
| mpsc_mbox_template_t (mbox_id_t id, environment_t &env, outliving_reference_t< agent_t > owner, Tracing_Args &&... tracing_args) | |
| mbox_id_t | id () const override |
| Unique ID of this mbox. | |
| void | subscribe_event_handler (const std::type_index &msg_type, abstract_message_sink_t &subscriber) override |
| Add the message handler. | |
| void | unsubscribe_event_handler (const std::type_index &msg_type, abstract_message_sink_t &subscriber) noexcept override |
| Remove all message handlers. | |
| std::string | query_name () const override |
| Get the mbox name. | |
| mbox_type_t | type () const override |
| Get the type of message box. | |
| void | do_deliver_message (message_delivery_mode_t delivery_mode, const std::type_index &msg_type, const message_ref_t &message, unsigned int redirection_deep) override |
| Deliver message for all subscribers with respect to message limits. | |
| void | set_delivery_filter (const std::type_index &msg_type, const delivery_filter_t &filter, abstract_message_sink_t &subscriber) override |
| Set a delivery filter for message type and subscriber. | |
| void | drop_delivery_filter (const std::type_index &msg_type, abstract_message_sink_t &) noexcept override |
| Removes delivery filter for message type and subscriber. | |
| environment_t & | environment () const noexcept override |
| SObjectizer Environment for which the mbox is created. | |
Protected Types | |
| using | subscription_info_t = local_mbox_details::subscription_info_with_sink_t |
| Information related to a subscribed message type. | |
| using | subscriptions_map_t |
| Type of dictionary for information about the current subscriptions. | |
Protected Member Functions | |
| template<typename Info_Maker , typename Info_Changer > | |
| void | insert_or_modify_subscription (const std::type_index &msg_type, Info_Maker maker, Info_Changer changer) |
| Helper for performing insertion or modification of subscription info. | |
| template<typename Info_Changer > | |
| void | modify_and_remove_subscription_if_needed (const std::type_index &msg_type, Info_Changer changer) |
| Helper for modification and deletion of subscription info. | |
| template<typename L > | |
| void | do_delivery (const std::type_index &msg_type, const message_ref_t &message, typename Tracing_Base::deliver_op_tracer const &tracer, L l) |
| Helper method to do delivery actions under locked object. | |
Protected Member Functions inherited from so_5::atomic_refcounted_t | |
| atomic_refcounted_t (const atomic_refcounted_t &)=delete | |
| atomic_refcounted_t & | operator= (const atomic_refcounted_t &)=delete |
| atomic_refcounted_t () noexcept | |
| Default constructor. | |
| ~atomic_refcounted_t () noexcept=default | |
| Destructor. | |
| void | inc_ref_count () noexcept |
| Increments reference count. | |
| unsigned long | dec_ref_count () noexcept |
| Decrement reference count. | |
Protected Attributes | |
| const mbox_id_t | m_id |
| ID of this mbox. | |
| environment_t & | m_env |
| Environment in that the mbox was created. | |
| default_rw_spinlock_t | m_lock |
| Protection of object from modification. | |
| subscriptions_map_t | m_subscriptions |
| Information about the current subscriptions. | |
A multi-producer/single-consumer mbox definition.
Definition at line 155 of file mpsc_mbox.hpp.
|
protected |
Information related to a subscribed message type.
Definition at line 329 of file mpsc_mbox.hpp.
|
protected |
Type of dictionary for information about the current subscriptions.
Definition at line 337 of file mpsc_mbox.hpp.
|
inline |
Definition at line 162 of file mpsc_mbox.hpp.
|
inlineoverridevirtual |
Deliver message for all subscribers with respect to message limits.
A message delivery from timer thread is somewhat different from an ordinary message delivery. Especially in the case when target mbox is a message chain. If that message chain is full and some kind of overflow reaction is specified (like waiting for some time or throwing an exception) then it can lead to undesired behaviour of the whole application. To take care about these cases a new method is introduced.
| delivery_mode | Can the delivery blocks the current thread? |
| msg_type | Type of the message to deliver. |
| message | A message instance to be delivered. |
| redirection_deep | Current deep of overlimit reaction recursion. |
Implements so_5::abstract_message_box_t.
Definition at line 244 of file mpsc_mbox.hpp.
|
inlineprotected |
Helper method to do delivery actions under locked object.
| L | lambda with actual delivery actions. |
| msg_type | Type of message/signal to be delivered. |
| message | Message object to be delivered. |
| tracer | Tracer object to log the case of abscense of subscriptions. |
| l | Lambda with actual delivery actions. |
Definition at line 433 of file mpsc_mbox.hpp.
|
inlineoverridevirtualnoexcept |
Removes delivery filter for message type and subscriber.
Implements so_5::abstract_message_box_t.
Definition at line 304 of file mpsc_mbox.hpp.
|
inlineoverridevirtualnoexcept |
SObjectizer Environment for which the mbox is created.
Implements so_5::abstract_message_box_t.
Definition at line 318 of file mpsc_mbox.hpp.
|
inlineoverridevirtual |
Unique ID of this mbox.
Implements so_5::abstract_message_box_t.
Definition at line 174 of file mpsc_mbox.hpp.
|
inlineprotected |
Helper for performing insertion or modification of subscription info.
Definition at line 384 of file mpsc_mbox.hpp.
|
inlineprotected |
Helper for modification and deletion of subscription info.
Definition at line 410 of file mpsc_mbox.hpp.
|
inlineoverridevirtual |
Get the mbox name.
Implements so_5::abstract_message_box_t.
Definition at line 229 of file mpsc_mbox.hpp.
|
inlineoverridevirtual |
Set a delivery filter for message type and subscriber.
| msg_type | Message type to be filtered. |
| filter | Filter to be set. A caller must guaranted the validity of this reference. |
| subscriber | A subscriber for the message. |
Implements so_5::abstract_message_box_t.
Definition at line 282 of file mpsc_mbox.hpp.
|
inlineoverridevirtual |
Add the message handler.
| type_index | Message type. |
| subscriber | Subscriber. |
Implements so_5::abstract_message_box_t.
Definition at line 180 of file mpsc_mbox.hpp.
|
inlineoverridevirtual |
Get the type of message box.
Implements so_5::abstract_message_box_t.
Definition at line 238 of file mpsc_mbox.hpp.
|
inlineoverridevirtualnoexcept |
Remove all message handlers.
| type_index | Message type. |
| subscriber | Subscriber. |
Implements so_5::abstract_message_box_t.
Definition at line 201 of file mpsc_mbox.hpp.
|
protected |
Environment in that the mbox was created.
Definition at line 360 of file mpsc_mbox.hpp.
|
protected |
ID of this mbox.
Definition at line 344 of file mpsc_mbox.hpp.
|
protected |
|
protected |
Information about the current subscriptions.
Definition at line 374 of file mpsc_mbox.hpp.