Combine multiple sources into a single one. More...
#include <combiner.h>
Classes | |
class | CombinerSink |
Public Types | |
using | Connections = std::array< Connection, NUM_SINKS > |
Array of connection objects. More... | |
using | Policy = PolicyTmpl< IOs... > |
Class type of the policy that applies to the combiner. More... | |
template<std::size_t N> | |
using | SinkType = helpers::io_rewrap_t< helpers::select_nth< N, IOs... >, Sink > |
Base class for the Nth sink. More... | |
Public Member Functions | |
Combiner (const Policy &policy=Policy()) noexcept | |
Constructor. More... | |
Connections | connect_to_sources (helpers::io_rewrap_t< IOs, Source > &... sources) noexcept |
Convenience function to connect all sinks at once. More... | |
void | disconnect () noexcept override |
Disconnect from all connected sources and sinks. More... | |
void | disconnect_from_all_sources () noexcept |
Disconnect the sinks from their sources. More... | |
const Policy & | policy () const noexcept |
Access combiner policy. More... | |
void | reset () noexcept override |
Reset filter. More... | |
void | set_policy (const Policy &policy) noexcept |
Set combiner policy. More... | |
template<std::size_t N> | |
const Combiner< PolicyTmpl, IOs... >::template SinkType< N > & | sink () const noexcept |
template<std::size_t N> | |
const SinkType< N > & | sink () const noexcept |
Access the sink for the Nth input. More... | |
template<std::size_t N> | |
Combiner< PolicyTmpl, IOs... >::template SinkType< N > & | sink () noexcept |
template<std::size_t N> | |
SinkType< N > & | sink () noexcept |
Access the sink for the Nth input. More... | |
Static Public Attributes | |
static constexpr std::size_t | NUM_SINKS = sizeof...(IOs) |
Number of sinks. More... | |
Private Types | |
using | IncomingTuples = std::tuple< typename helpers::io_tuple_t< IOs >... > |
using | OutgoingTuple = helpers::io_tuple_t< helpers::io_concat_t< IOs... > > |
Private Member Functions | |
void | connect_policy () noexcept |
template<std::size_t N> | |
void | connect_to_sources_impl (Connections &conn) noexcept |
template<std::size_t N, typename ThisSource , typename... OtherSources> | |
void | connect_to_sources_impl (Connections &conn, ThisSource &src, OtherSources &... sources) noexcept |
Private Attributes | |
std::mutex | combiner_mutex_ |
Policy | policy_ |
std::tuple< typename IOs::template Rewrap< CombinerSink >... > | sinks_ |
Combine multiple sources into a single one.
Sometimes, a filter pipeline will receive corresponding inputs from different sources, which must be processed together. The combiner provides a policy-driven way to aggregate data from multiple sources into a single sink. Policies can be anything from a simple FIFO to an elaborate approximate time stamp synchronization.
The output arity of the filter is the sum of all input arities. For example, given two binary input filters (M1,M2) and (M3,M4), the combiner will create a quaternary output (M1,M2,M3,M4). Furthermore, policies which examine data generally look at the first argument of each input. In this example, the timing policies would match the inputs based on M1 and M3. You can prepend a Selector filter to swap the argument order if you need a different element examined, or the Divider filter to match all arguments independently.
Definition at line 90 of file combiner.h.
using fkie_message_filters::Combiner< PolicyTmpl, IOs >::Connections = std::array<Connection, NUM_SINKS> |
Array of connection objects.
Definition at line 100 of file combiner.h.
|
private |
Definition at line 150 of file combiner.h.
|
private |
Definition at line 151 of file combiner.h.
using fkie_message_filters::Combiner< PolicyTmpl, IOs >::Policy = PolicyTmpl<IOs...> |
Class type of the policy that applies to the combiner.
Definition at line 105 of file combiner.h.
using fkie_message_filters::Combiner< PolicyTmpl, IOs >::SinkType = helpers::io_rewrap_t<helpers::select_nth<N, IOs...>, Sink> |
Base class for the Nth sink.
Definition at line 103 of file combiner.h.
|
explicitnoexcept |
Constructor.
policy
Instance of the policy class that applies to the combiner.\nothrow
Definition at line 48 of file combiner_impl.h.
|
privatenoexcept |
Definition at line 61 of file combiner_impl.h.
|
noexcept |
Convenience function to connect all sinks at once.
\nothrow
Definition at line 155 of file combiner_impl.h.
|
privatenoexcept |
Definition at line 142 of file combiner_impl.h.
|
privatenoexcept |
Definition at line 148 of file combiner_impl.h.
|
overridenoexcept |
Disconnect from all connected sources and sinks.
\nothrow
Definition at line 134 of file combiner_impl.h.
|
noexcept |
|
noexcept |
Access combiner policy.
Definition at line 117 of file combiner_impl.h.
|
overridenoexcept |
Reset filter.
This will reset the internal state by calling the PolicyTmpl::reset() method
\nothrow
Definition at line 96 of file combiner_impl.h.
|
noexcept |
Set combiner policy.
Any previous policy is superseded. Implies a call to reset().
\nothrow
Definition at line 88 of file combiner_impl.h.
|
noexcept |
Definition at line 111 of file combiner_impl.h.
|
noexcept |
Access the sink for the Nth input.
|
noexcept |
Definition at line 104 of file combiner_impl.h.
|
noexcept |
Access the sink for the Nth input.
|
private |
Definition at line 166 of file combiner.h.
|
staticconstexpr |
Number of sinks.
Definition at line 98 of file combiner.h.
|
private |
Definition at line 167 of file combiner.h.
|
private |
Definition at line 168 of file combiner.h.