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> | |
Combiner< PolicyTmpl, IOs... >::template SinkType< N > & | sink () noexcept |
template<std::size_t N> | |
const Combiner< PolicyTmpl, IOs... >::template SinkType< N > & | sink () const noexcept |
template<std::size_t N> | |
SinkType< N > & | sink () noexcept |
Access the sink for the Nth input. More... | |
template<std::size_t N> | |
const SinkType< N > & | sink () const 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, typename ThisSource , typename... OtherSources> | |
void | connect_to_sources_impl (Connections &conn, ThisSource &src, OtherSources &... sources) noexcept |
template<std::size_t N> | |
void | connect_to_sources_impl (Connections &conn) 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 72 of file combiner.h.
using fkie_message_filters::Combiner< PolicyTmpl, IOs >::Connections = std::array<Connection, NUM_SINKS> |
Array of connection objects.
Definition at line 82 of file combiner.h.
|
private |
Definition at line 132 of file combiner.h.
|
private |
Definition at line 133 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 87 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 85 of file combiner.h.
|
explicitnoexcept |
Constructor.
policy
Instance of the policy class that applies to the combiner.Definition at line 30 of file combiner_impl.h.
|
privatenoexcept |
Definition at line 43 of file combiner_impl.h.
|
noexcept |
Convenience function to connect all sinks at once.
Definition at line 137 of file combiner_impl.h.
|
privatenoexcept |
Definition at line 130 of file combiner_impl.h.
|
privatenoexcept |
Definition at line 124 of file combiner_impl.h.
|
overridenoexcept |
Disconnect from all connected sources and sinks.
Definition at line 116 of file combiner_impl.h.
|
noexcept |
Disconnect the sinks from their sources.
Definition at line 105 of file combiner_impl.h.
|
noexcept |
Access combiner policy.
Definition at line 99 of file combiner_impl.h.
|
overridenoexcept |
Reset filter.
This will reset the internal state by calling the PolicyTmpl::reset() method
Definition at line 78 of file combiner_impl.h.
|
noexcept |
Set combiner policy.
Any previous policy is superseded. Implies a call to reset().
Definition at line 70 of file combiner_impl.h.
|
noexcept |
Definition at line 86 of file combiner_impl.h.
|
noexcept |
Definition at line 93 of file combiner_impl.h.
|
noexcept |
Access the sink for the Nth input.
|
noexcept |
Access the sink for the Nth input.
|
private |
Definition at line 148 of file combiner.h.
|
static |
Number of sinks.
Definition at line 80 of file combiner.h.
|
private |
Definition at line 149 of file combiner.h.
|
private |
Definition at line 150 of file combiner.h.