Base class for data consumers. More...
#include <sink.h>
Classes | |
class | ReentryProtector |
Public Types | |
using | Input = IO< Inputs... > |
Grouped input types. More... | |
Public Member Functions | |
Connection | connect_to_source (Source< Inputs... > &src) noexcept |
Connect this sink to a source. More... | |
virtual void | disconnect () noexcept override |
Disconnect from all connected sources. More... | |
void | disconnect_from_all_sources () noexcept |
Disconnect from all connected sources. More... | |
virtual | ~Sink () |
Static Public Attributes | |
static constexpr std::size_t | NUM_INPUTS = sizeof...(Inputs) |
Number of input arguments. More... | |
Protected Member Functions | |
virtual void | receive (const Inputs &... in)=0 |
Process incoming data. More... | |
Private Member Functions | |
void | receive_cb (const Connection &, const Inputs &... in) |
Private Attributes | |
std::vector< boost::signals2::scoped_connection > | conn_ |
std::mutex | mutex_ |
std::set< std::thread::id > | running_ |
Friends | |
template<typename... > | |
class | Source |
Base class for data consumers.
In the message filter library, all data flows from sources to sinks. The sinks are data consumers, which process all data they receive from a source.
Derived classes must override the receive() method to actually process data. The receive() method takes the same number and types of arguments as specified in the template instantiation.
using fkie_message_filters::Sink< Inputs >::Input = IO<Inputs...> |
|
inlinevirtual |
|
noexcept |
Connect this sink to a source.
Can be called multiple times to connect multiple sources; in that case, the sink receives data from all connected sources. This function does basically the same thing as Source::connect_to_sink(), only from the opposite point of view.
src
the source that is to be connectedDefinition at line 72 of file sink_impl.h.
|
overridevirtualnoexcept |
Disconnect from all connected sources.
The sink implementation calls disconnect_from_all_sources().
\nothrow
Implements fkie_message_filters::FilterBase.
Reimplemented in fkie_message_filters::Divider< Inputs >, fkie_message_filters::Divider< Inputs... >, fkie_message_filters::Filter< In, Out >, fkie_message_filters::Filter< IO< Inputs... >, IO< Outputs... > >, fkie_message_filters::Filter< IO< Inputs... >, IO< Inputs... >::template Select< Is... > >, and fkie_message_filters::Filter< IO< Inputs... >, IO< Inputs... > >.
Definition at line 88 of file sink_impl.h.
|
noexcept |
Disconnect from all connected sources.
Severs the connection to all sources. The receive() method will not be called any more.
\nothrow
Definition at line 81 of file sink_impl.h.
|
protectedpure virtual |
Process incoming data.
Derived classes need to override this method to handle all data that is to be consumed by the sink.
\abstractthrow
Implemented in fkie_message_filters::Buffer< Inputs >, fkie_message_filters::Buffer< Inputs... >, fkie_message_filters::TfFilter< Inputs >, fkie_message_filters::TfFilter< Inputs... >, fkie_message_filters::Combiner< PolicyTmpl, IOs >::CombinerSink< Inputs >, fkie_message_filters::Divider< Inputs >, fkie_message_filters::Divider< Inputs... >, fkie_message_filters::UserFilter< IO< Inputs... >, IO< Outputs... > >, fkie_message_filters::Sequencer< Inputs >, fkie_message_filters::Sequencer< Inputs... >, fkie_message_filters::SimpleUserFilter< Inputs >, fkie_message_filters::SimpleUserFilter< Inputs... >, and fkie_message_filters::Selector< IO< Inputs... >, Is... >.
|
private |
Definition at line 94 of file sink_impl.h.
|
private |
|
private |
|
staticconstexpr |
|
private |