SObjectizer
5.7
|
Base class for representation of one case in multi chain select. More...
#include <mchain_select_ifaces.hpp>
Public Types | |
using | handling_result_t = std::variant< so_5::mchain_receive_result_t, so_5::mchain_send_result_t > |
The result of attempt of handling this case. More... | |
Public Member Functions | |
select_case_t (mchain_t chain) | |
Initialized constructor. More... | |
select_case_t (const select_case_t &)=delete | |
select_case_t (select_case_t &&)=delete | |
virtual | ~select_case_t () |
select_case_t * | query_next () const noexcept |
select_case_t * | giveout_next () noexcept |
void | set_next (select_case_t *next) noexcept |
Set the next item in the current queue to which select_case belongs. More... | |
void | notify () noexcept |
Notification for all waiting select_cases. More... | |
void | on_select_finish () noexcept |
Reaction to the end of select work. More... | |
virtual handling_result_t | try_handle (select_notificator_t ¬ificator)=0 |
An attempt to handle this case. More... | |
const mchain_t & | chain () const noexcept |
Get the underlying mchain. More... | |
Protected Member Functions | |
auto | extract (demand_t &demand) |
Helper method for calling extract method of the target mchain. More... | |
auto | push (const std::type_index &msg_type, const message_ref_t &message) |
Helper method for calling push method of the target mchain. More... | |
Protected Attributes | |
mchain_t | m_chain |
Message chain to receive message from. More... | |
select_notificator_t * | m_notificator = nullptr |
Notificator to be used for notify sleeping thread. More... | |
select_case_t * | m_next = nullptr |
Next select_case in queue. More... | |
Base class for representation of one case in multi chain select.
using so_5::mchain_props::select_case_t::handling_result_t = std::variant< so_5::mchain_receive_result_t, so_5::mchain_send_result_t > |
The result of attempt of handling this case.
|
inline |
Initialized constructor.
chain | Message chain for that this select_case is created. |
|
delete |
|
delete |
|
inlinevirtual |
|
inlinenoexcept |
Get the underlying mchain.
|
inlineprotected |
Helper method for calling extract method of the target mchain.
This method is intended to be called by a derived class. This helper is necessary because only select_case_t class is declared as friend for abstract_message_chain_t class. Classes that are derived from select_case_t are not friends for abstract_message_chain_t class and can't call protected/private methods of abstract_message_chain_t.
|
inlinenoexcept |
Get the next item in the current queue to which select_case belongs at this moment and drop this pointer to nullptr value.
This method must be used if select_case object must be extracted from the current queue.
|
inlinenoexcept |
Notification for all waiting select_cases.
This method is called by mchain if empty mchain becomes non-empty or if it is closed.
This method does notification for all members of select_case queue. It means that mchain calls notify() for the head of the queue and that head does notification for all other queue's members.
|
inlinenoexcept |
Reaction to the end of select work.
|
inlineprotected |
Helper method for calling push method of the target mchain.
This method is intended to be called by a derived class. This helper is necessary because only select_case_t class is declared as friend for abstract_message_chain_t class. Classes that are derived from select_case_t are not friends for abstract_message_chain_t class and can't call protected/private methods of abstract_message_chain_t.
msg_type | Type of message/signal to be pushed. |
message | Message/signal to be pushed. |
|
inlinenoexcept |
Simple access to next item in the current queue to which select_case object belongs at this moment.
|
inlinenoexcept |
Set the next item in the current queue to which select_case belongs.
|
pure virtual |
An attempt to handle this case.
Implemented in so_5::mchain_props::details::send_select_case_t, and so_5::mchain_props::details::receive_select_case_t.
|
protected |
Message chain to receive message from.
|
protected |
Next select_case in queue.
A select_case object can be included in one of two different queues:
|
protected |
Notificator to be used for notify sleeping thread.
Can be null. It means that select_case is not used in select queue for the mchain at that moment.
There are just two methods where m_notificator changes its value:
In the previous versions of SObjectizer m_notificator received nullptr value during notification of new messages arrival or closing of mchain. But this lead to data races and the behaviour was changed. Now m_notificator can hold an actual pointer even after notification was initiated.