Repository navigation
signal_connector
Dmitry Koplyarov edited this page May 17, 2016
·
6 revisions
A class that hides the signal implementation details. Very useful for public interfaces.
Here is the tutorial section.
Defined in wigwag/signal_connector.hpp
template < typename Signature_ >
class signal_connector
{
public:
template < typename HandlerFunc_ >
token connect(HandlerFunc_ handler, handler_attributes attributes = handler_attributes::none) const;
template < typename HandlerFunc_ >
token connect(std::shared_ptr<task_executor> worker, HandlerFunc_ handler, handler_attributes attributes = handler_attributes::none) const;
};(1)
template < typename HandlerFunc_ >
token connect(HandlerFunc_ handler, handler_attributes attributes = handler_attributes::none) const;
(2)
template < typename HandlerFunc_ >
token connect(std::shared_ptr<task_executor> worker, HandlerFunc_ handler, handler_attributes attributes = handler_attributes::none) const;(1) connects a synchronous handler to a signal.
(2) connects an asynchronous handler to a signal.
Thread safety: This is a thread-safe method as long as the threading policy of the corresponding signal assures that.
Arguments:
- worker - a task_executor that should be used to invoke the handler
- handler - an function object to be connected to a signal
- attributes - handler_attributes enum flags
Return value: a RAII token object that manages the connection to a signal.