FKIE Message Filters
Improved filters for processing ROS messages
|
Combine multiple sources into a single one. More...
#include <fkie_message_filters/combiner.h>
Public Types | |
using | Connections = std::array< Connection, NUM_SINKS > |
Array of connection objects. | |
using | Output = IO< Outputs... > |
Grouped output types. More... | |
using | Policy = PolicyTmpl< IOs... > |
Class type of the policy that applies to the combiner. | |
template<std::size_t N> | |
using | SinkType = helpers::io_rewrap_t< helpers::select_nth< N, IOs... >, Sink > |
Base class for the Nth sink. | |
Public Member Functions | |
Combiner (const Policy &policy=Policy()) noexcept | |
Constructor. More... | |
Connection | connect_to_sink (Sink< Outputs... > &dst) noexcept |
Connect this source to a sink. 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_sinks () noexcept |
Disconnect from all connected sinks. More... | |
void | disconnect_from_all_sources () noexcept |
Disconnect the sinks from their sources. More... | |
const Policy & | policy () const noexcept |
Access combiner policy. | |
void | reset () noexcept override |
Reset filter. More... | |
void | set_policy (const Policy &policy) noexcept |
Set combiner policy. More... | |
template<std::size_t N> | |
SinkType< N > & | sink () noexcept |
Access the sink for the Nth input. | |
template<std::size_t N> | |
const SinkType< N > & | sink () const noexcept |
Access the sink for the Nth input. | |
Static Public Attributes | |
static constexpr std::size_t | NUM_OUTPUTS |
Number of output arguments. | |
static constexpr std::size_t | NUM_SINKS = sizeof...(IOs) |
Number of sinks. | |
Protected Member Functions | |
void | send (const Outputs &... out) |
Pass data to all connected sinks. More... | |
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.
|
inherited |
Grouped output types.
This type can be used to define sinks with matching types.
|
explicitnoexcept |
Constructor.
policy
Instance of the policy class that applies to the combiner.
|
noexceptinherited |
Connect this source to a sink.
Can be called multiple times to connect multiple sinks; in that case, the sinks receive data in the same order as they have been connected. This function does basically the same thing as Sink::connect_to_source(), only from the opposite point of view.
dst
the sink that is to be connected
|
noexcept |
Convenience function to connect all sinks at once.
|
overridevirtualnoexcept |
Disconnect from all connected sources and sinks.
Reimplemented from fkie_message_filters::Source< IOs... >.
|
noexceptinherited |
Disconnect from all connected sinks.
Severs the connection to all sinks, turning the send() method into a no-op.
|
noexcept |
Disconnect the sinks from their sources.
|
overridevirtualnoexcept |
Reset filter.
This will reset the internal state by calling the PolicyTmpl::reset() method
Reimplemented from fkie_message_filters::FilterBase.
|
protectedinherited |
Pass data to all connected sinks.
out
data
|
noexcept |
Set combiner policy.
Any previous policy is superseded. Implies a call to reset().