|
SObjectizer 5.8
|
Helper class for managing multiple sink bindings. More...
#include <multi_sink_binding.hpp>
Public Member Functions | |
| multi_sink_binding_t ()=default | |
| multi_sink_binding_t (const multi_sink_binding_t &)=delete | |
| multi_sink_binding_t & | operator= (const multi_sink_binding_t &)=delete |
| multi_sink_binding_t (multi_sink_binding_t &&)=delete | |
| multi_sink_binding_t & | operator= (multi_sink_binding_t &&)=delete |
| template<typename Msg > | |
| void | bind (const mbox_t &from, const msink_t &dest) |
| template<typename Msg > | |
| void | bind (const mbox_t &from, const msink_t &dest, delivery_filter_unique_ptr_t delivery_filter) |
| template<typename Msg , typename Lambda > | |
| void | bind (const mbox_t &from, const msink_t &dest, Lambda &&filter) |
| template<typename Msg > | |
| void | unbind (const mbox_t &from, const msink_t &dest) noexcept |
| void | unbind_all_for (const mbox_t &from, const msink_t &dest) noexcept |
| void | clear () noexcept |
Additional Inherited Members | |
Protected Member Functions inherited from so_5::details::actual_lock_holder_t< Lock_Type > | |
| template<typename Lambda > | |
| auto | lock_and_perform (Lambda &&l) const -> decltype(l()) |
| Do actual lock and perform necessary action. | |
Protected Member Functions inherited from so_5::multi_sink_binding_impl::actual_binding_handler_t | |
| template<typename Msg > | |
| void | do_bind (const mbox_t &from, const msink_t &dest) |
| template<typename Msg > | |
| void | do_bind (const mbox_t &from, const msink_t &dest, delivery_filter_unique_ptr_t delivery_filter) |
| template<typename Msg > | |
| void | do_unbind (const mbox_t &from, const msink_t &dest) noexcept |
| void | do_unbind_all_for (const mbox_t &from, const msink_t &dest) noexcept |
| void | do_clear () noexcept |
Helper class for managing multiple sink bindings.
An instance of multi_sink_binding_t drops all binding in the destructor. If it's necessary to drop all binding manually then clear() method can be used.
Usage examples:
The instance of multi_sink_binding_t is thread safe by the default (if the default value is used for template parameter Lock_Type). In single-threaded environments this can be unnecessary, so_5::null_mutex_t can be used in those cases:
| Lock_Type | Type to be used for thread-safety. It should be a std::mutex-like class. If thread-safety isn't needed then so_5::null_mutex_t can be used. |
Definition at line 401 of file multi_sink_binding.hpp.
|
default |
|
delete |
|
delete |
|
inline |
Create a binding for message/signal of type Msg from mbox from to the destination dest.
This binding won't use a delivery filter.
An exception will be thrown if such a binding already exists.
Usage example:
It it's required to make a binding for a mutable message then so_5::mutable_msg marker has to be used:
| from | The source mbox. |
| dest | The destination for messages. |
Definition at line 446 of file multi_sink_binding.hpp.
|
inline |
Create a binding for message of type Msg from mbox from to the destination dest.
This binding should use delivery filter delivery_filter.
An exception will be thrown if such a binding already exists.
| from | The source mbox. |
| dest | The destination for messages. |
| delivery_filter | Delivery filter to be used. It shouldn't be nullptr. |
Definition at line 472 of file multi_sink_binding.hpp.
|
inline |
Create a binding for message of type Msg from mbox from to the destination dest.
The lambda (or functor) filter will be used as delivery filter for messages.
An exception will be thrown if such a binding already exists.
Usage example:
It it's required to make a binding for a mutable message then so_5::mutable_msg marker has to be used, but note the type of delivery filter argument:
| from | The source mbox. |
| dest | The destination for messages. |
| filter | Delivery filter to be used. |
Definition at line 530 of file multi_sink_binding.hpp.
|
inlinenoexcept |
Remove all exising bindings.
Definition at line 643 of file multi_sink_binding.hpp.
|
delete |
|
delete |
|
inlinenoexcept |
Remove binding for message/signal of type Msg from mbox from to the destination dest.
It is safe to call this method if such a binding doesn't exist.
Usage example:
| from | The source mbox. |
| dest | The destination for messages. |
Definition at line 600 of file multi_sink_binding.hpp.
|
inlinenoexcept |
Remove binding for all message/signal types from mbox from to the destination dest.
It is safe to call this method if there is no any binding for (form, dest) pair.
Usage example:
| from | The source mbox. |
| dest | The destination for messages. |
Definition at line 628 of file multi_sink_binding.hpp.