Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
fkie_message_filters::SimpleUserFilter< Inputs > Class Template Reference

Simplified filter with user-defined callback function. More...

#include <simple_user_filter.h>

Inheritance diagram for fkie_message_filters::SimpleUserFilter< Inputs >:
Inheritance graph
[legend]

Public Types

using ProcessingFunction = std::function< bool(const Inputs &...)>
 Processing function type. More...
 
- Public Types inherited from fkie_message_filters::Sink< Inputs... >
using Input = IO< Inputs... >
 Grouped input types. More...
 
- Public Types inherited from fkie_message_filters::Source< IO< Inputs... > >
using Output = IO< Outputs... >
 Grouped output types. More...
 

Public Member Functions

void set_processing_function (const ProcessingFunction &f) noexcept
 Set the user-defined processing function. More...
 
- Public Member Functions inherited from fkie_message_filters::Sink< Inputs... >
Connection connect_to_source (Source< Inputs... > &src) noexcept
 Connect this sink to a source. More...
 
void disconnect_from_all_sources () noexcept
 Disconnect from all connected sources. More...
 
virtual ~Sink ()
 
- Public Member Functions inherited from fkie_message_filters::FilterBase
virtual void reset () noexcept
 Reset filter state. More...
 
virtual ~FilterBase ()
 
- Public Member Functions inherited from fkie_message_filters::Source< IO< Inputs... > >
Connection connect_to_sink (Sink< Outputs... > &dst) noexcept
 Connect this source to a sink. More...
 
void disconnect_from_all_sinks () noexcept
 Disconnect from all connected sinks. More...
 
virtual ~Source ()
 

Protected Member Functions

void receive (const Inputs &... in) override
 Process incoming data. More...
 
- Protected Member Functions inherited from fkie_message_filters::Source< IO< Inputs... > >
void send (const Outputs &... out)
 Pass data to all connected sinks. More...
 

Private Attributes

ProcessingFunction f_
 

Additional Inherited Members

- Static Public Attributes inherited from fkie_message_filters::Sink< Inputs... >
static constexpr std::size_t NUM_INPUTS
 Number of input arguments. More...
 
- Static Public Attributes inherited from fkie_message_filters::Source< IO< Inputs... > >
static constexpr std::size_t NUM_OUTPUTS
 Number of output arguments. More...
 

Detailed Description

template<typename... Inputs>
class fkie_message_filters::SimpleUserFilter< Inputs >

Simplified filter with user-defined callback function.

This is a simplified version of the UserFilter where inputs and outputs are identical. A user-defined processing function is called for all incoming data. If the function returns true, the data is passed on, otherwise the data is discarded.

The filter will throw a std::bad_function_call exception if it is invoked without a user-defined processing function.

Definition at line 38 of file simple_user_filter.h.

Member Typedef Documentation

◆ ProcessingFunction

template<typename... Inputs>
using fkie_message_filters::SimpleUserFilter< Inputs >::ProcessingFunction = std::function<bool(const Inputs&...)>

Processing function type.

This can be any user-defined function and will be called to process incoming data.

Return values
trueif the data shall be passed to the connected sinks
falseif the data shall be discarded

Definition at line 49 of file simple_user_filter.h.

Member Function Documentation

◆ receive()

template<typename... Inputs>
void fkie_message_filters::SimpleUserFilter< Inputs >::receive ( const Inputs &...  in)
overrideprotectedvirtual

Process incoming data.

Derived classes need to override this method to handle all data that is to be consumed by the sink.

Implements fkie_message_filters::Sink< Inputs... >.

Definition at line 35 of file simple_user_filter_impl.h.

◆ set_processing_function()

template<typename... Inputs>
void fkie_message_filters::SimpleUserFilter< Inputs >::set_processing_function ( const ProcessingFunction f)
noexcept

Set the user-defined processing function.

You must call this method before the filter gets invoked with incoming data.

Definition at line 29 of file simple_user_filter_impl.h.

Member Data Documentation

◆ f_

template<typename... Inputs>
ProcessingFunction fkie_message_filters::SimpleUserFilter< Inputs >::f_
private

Definition at line 60 of file simple_user_filter.h.


The documentation for this class was generated from the following files:


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Mon Feb 28 2022 22:21:44