Go to the documentation of this file.
15 #include <unordered_set>
18 #include <ros/common.h>
19 #if ROS_VERSION_MINIMUM(1, 15, 0)
53 typedef ::std::function<
54 void(
const F&
data,
const size_t filterNum, const ::std::string& name, const ::std::string& type)>
66 typedef ::std::function<
67 void(
const F& data,
const size_t filterNum, const ::std::string& name, const ::std::string& type,
bool success)>
108 bool update(
const F& data_in, F& data_out);
146 ::std::vector<::std::shared_ptr<::filters::FilterBase<F>>>
getActiveFilters()
const;
198 #include "impl/filter_chain.hpp"
FilterFinishedCallback filterFinishedCallback
The optional callback to call when a filter finishes its work.
void updateActiveFilters()
Update the contents of activeFilters with just the filters that have not been disabled.
::std::unordered_set<::std::string > getDisabledFilters() const
Get which filters are temporarily disabled.
void callStartCallback(const F &data, size_t filterNum)
If filterStartCallback is set, call it.
Convenience base class for providing this->log and getCrasLogger(). Just add it as a base to your cla...
::std::function< void(const F &data, const size_t filterNum, const ::std::string &name, const ::std::string &type)> FilterStartCallback
Callback to be called before each filter processes the data.
::std::function< void(const F &data, const size_t filterNum, const ::std::string &name, const ::std::string &type, bool success)> FilterFinishedCallback
Callback to be called after each filter processes the data.
void setDisabledFilters(::std::unordered_set<::std::string > filters)
Set which filters are temporarily disabled. This overrides any previous calls to disableFilter() and ...
void setNodelet(const ::nodelet::Nodelet *nodelet)
Inform this chain that it is running in the given nodelet, so that it can do appropriate optimization...
bool clear()
Clear all filters from this chain. This function intentionally shadows filters::FilterChain::clear() ...
Log helper redirecting the logging calls to ROS_ macros.
bool update(const F &data_in, F &data_out)
Do the filtering. This function intentionally shadows filters::FilterChain::update() which is non-vir...
void callFinishedCallback(const F &data, size_t filterNum, bool succeeded)
If filterFinishedCallback is set, call it.
void setFilterStartCallback(const FilterStartCallback &callback)
Set the filter start callback.
::std::unordered_set<::std::string > disabledFilters
A set of filters that have been temporarily disabled.
void setFilterFinishedCallback(const FilterFinishedCallback &callback)
Set the filter finished callback.
void enableFilter(const ::std::string &name)
Enable the temporarily disabled filter with the given name.
::cras::LogHelper::Ptr LogHelperPtr
Pointer to LogHelper.
F buffer1
A temporary intermediate buffer.
FilterChain(const ::std::string &dataType, const FilterFinishedCallback &filterFinishedCallback={}, const FilterStartCallback &filterStartCallback={}, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
Construct a filter chain.
F buffer0
A temporary intermediate buffer.
::std::vector<::std::shared_ptr<::filters::FilterBase< F > > > getActiveFilters() const
Get a copy of the list of active filters.
void disableFilter(const ::std::string &name)
Temporarily disable the filter with the given name.
::std::vector<::std::shared_ptr<::filters::FilterBase< F > > > activeFilters
A list of filters that should be treated as active and should act on the input data.
bool initialized
Whether this filter chain has been initialized (gets set by first update() and cleared by clear()).
mutable ::std::mutex activeFiltersMutex
Mutex protecting activeFilters access.
FilterStartCallback filterStartCallback
The optional callback to call when a filter starts its work.
cras_cpp_common
Author(s): Martin Pecka
autogenerated on Mon Jun 17 2024 02:48:56