SObjectizer  5.8
Loading...
Searching...
No Matches
so_5::abstract_message_sink_t Class Referenceabstract

Interface for message sink. More...

#include <message_sink.hpp>

Inheritance diagram for so_5::abstract_message_sink_t:
so_5::as_msink_impl::mbox_as_sink_t so_5::impl::message_sink_for_agent_t so_5::msinks::transform_then_redirect_impl::basic_transform_then_redirect_sink_t< Transformer > so_5::impl::message_sink_with_message_limit_t so_5::impl::message_sink_without_message_limit_t so_5::msinks::transform_then_redirect_impl::msg_transform_then_redirect_sink_t< Expected_Msg, Transformer > so_5::msinks::transform_then_redirect_impl::signal_transform_then_redirect_sink_t< Signal, Transformer >

Public Member Functions

 abstract_message_sink_t ()=default
 
virtual ~abstract_message_sink_t () noexcept=default
 
 abstract_message_sink_t (const abstract_message_sink_t &)=default
 
abstract_message_sink_toperator= (const abstract_message_sink_t &)=default
 
 abstract_message_sink_t (abstract_message_sink_t &&) noexcept=default
 
abstract_message_sink_toperator= (abstract_message_sink_t &&) noexcept=default
 
virtual environment_tenvironment () const noexcept=0
 
virtual priority_t sink_priority () const noexcept=0
 Get the priority for the message sink.
 
virtual void push_event (mbox_id_t mbox_id, message_delivery_mode_t delivery_mode, const std::type_index &msg_type, const message_ref_t &message, unsigned int redirection_deep, const message_limit::impl::action_msg_tracer_t *tracer)=0
 Get a message and push it to the appropriate destination.
 

Static Public Member Functions

static bool special_sink_ptr_compare (const abstract_message_sink_t *a, const abstract_message_sink_t *b) noexcept
 

Detailed Description

Interface for message sink.

This class is the base for all message sinks.

The purpose of message sink is to be a subscriber for an mbox. An mbox holds a list of subscribers and delivers a message to appropriate subscribers (message sinks). When an mbox receives a message it calls push_event() method for all message sinks that are subscribed to this message (and delivery filters permit the delivery to those sinks).

Note
A message sink in SO-5.8 plays the same role as agent_t in previous versions, in the sense that message sinks act as a receiver of messages sent to message boxes. Since an agent_t has priority and this priority is taken into account during subscriptions and message delivery, the message sink should also have priority. Because of that there is sink_priority() method. For cases where a message sink is created for an agent, the sink_priority() should return the agent's priority.
Since
v.5.8.0
Examples
so_5/custom_direct_mbox/main.cpp.

Definition at line 69 of file message_sink.hpp.

Constructor & Destructor Documentation

◆ abstract_message_sink_t() [1/3]

so_5::abstract_message_sink_t::abstract_message_sink_t ( )
default

◆ ~abstract_message_sink_t()

virtual so_5::abstract_message_sink_t::~abstract_message_sink_t ( )
virtualdefaultnoexcept

◆ abstract_message_sink_t() [2/3]

so_5::abstract_message_sink_t::abstract_message_sink_t ( const abstract_message_sink_t & )
default

◆ abstract_message_sink_t() [3/3]

so_5::abstract_message_sink_t::abstract_message_sink_t ( abstract_message_sink_t && )
defaultnoexcept

Member Function Documentation

◆ environment()

virtual environment_t & so_5::abstract_message_sink_t::environment ( ) const
nodiscardpure virtualnoexcept

◆ operator=() [1/2]

abstract_message_sink_t & so_5::abstract_message_sink_t::operator= ( abstract_message_sink_t && )
defaultnoexcept

◆ operator=() [2/2]

abstract_message_sink_t & so_5::abstract_message_sink_t::operator= ( const abstract_message_sink_t & )
default

◆ push_event()

virtual void so_5::abstract_message_sink_t::push_event ( mbox_id_t mbox_id,
message_delivery_mode_t delivery_mode,
const std::type_index & msg_type,
const message_ref_t & message,
unsigned int redirection_deep,
const message_limit::impl::action_msg_tracer_t * tracer )
pure virtual

Get a message and push it to the appropriate destination.

This is key method for message sink. Its logic depends of message sink type. For example, ordinary message sink for an agent just pushes the message to the agent's event_queue.

Attention
Implementations of message sinks should control the value of redirection_deep. If that value exceeds so_5::max_redirection_deep then the delivery procedure has to be cancelled and the message (signal) should be dropped (ignored). If an implementation redirects message to another mbox/msink then the value of redirection_deep has to be incremented.
The tracer can be nullptr. Moreover, it will be nullptr in most of the cases when message delivery tracing is off.
Parameters
mbox_idID of mbox from that the message is received.
delivery_modeDelivery mode for this delivery attempt.
msg_typeType of message to be delivered.
messageReference to the message to be delivered. NOTE: it can be empty (nullptr) reference in the case of a signal.
redirection_deepThe current deep of message redirection between mboxes and msinks.
tracerMessage delivery tracer to be used inside overlimit reaction. NOTE: it will be nullptr when message delivery tracing if off.

Implemented in so_5::as_msink_impl::mbox_as_sink_t, so_5::impl::message_sink_with_message_limit_t, so_5::impl::message_sink_without_message_limit_t, and so_5::msinks::transform_then_redirect_impl::basic_transform_then_redirect_sink_t< Transformer >.

◆ sink_priority()

virtual priority_t so_5::abstract_message_sink_t::sink_priority ( ) const
nodiscardpure virtualnoexcept

◆ special_sink_ptr_compare()

static bool so_5::abstract_message_sink_t::special_sink_ptr_compare ( const abstract_message_sink_t * a,
const abstract_message_sink_t * b )
inlinestaticnodiscardnoexcept

Definition at line 139 of file message_sink.hpp.


The documentation for this class was generated from the following file: