Simplified filter with user-defined callback function. More...
#include <simple_user_filter.h>
Public Types | |
using | ProcessingFunction = std::function< bool(const Inputs &...)> |
Processing function type. More... | |
Public Member Functions | |
void | set_processing_function (const ProcessingFunction &f) noexcept |
Set the user-defined processing function. More... | |
Protected Member Functions | |
void | receive (const Inputs &... in) override |
Process incoming data. More... | |
Private Attributes | |
ProcessingFunction | f_ |
Additional Inherited Members |
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.
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.
true | if the data shall be passed to the connected sinks |
false | if the data shall be discarded |
Definition at line 49 of file simple_user_filter.h.
|
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.
|
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.
|
private |
Definition at line 60 of file simple_user_filter.h.