filter_base.hpp
Go to the documentation of this file.
1 #pragma once
2 
11 #include <functional>
12 #include <memory>
13 
14 #include <ros/common.h>
15 #if ROS_VERSION_MINIMUM(1, 15, 0)
16 #include <filters/filter_base.hpp>
17 #else
18 #include <filters/filter_base.h>
19 #endif
20 
21 #include <nodelet/nodelet.h>
22 
26 
27 namespace cras
28 {
29 
30 // these are declared in the impl file
31 template <typename F> class FilterLogHelper;
32 template <typename F> struct FilterGetParamAdapter;
33 
39 template<typename F>
41 {
42 public:
47  ::std::make_shared<::cras::FilterLogHelper<F>>(*this),
48  ::std::make_shared<::cras::FilterGetParamAdapter<F>>(*this))
49  {
50  }
51 
52  ~FilterBase() override = default;
53 
58  void setNodelet(const ::nodelet::Nodelet* nodelet)
59  {
60  this->nodelet = nodelet;
61  }
62 
63  // Allow FilterGetParamAdapter to call getParam() methods.
64  friend struct ::cras::FilterGetParamAdapter<F>;
65 
66 protected:
67  // Use getParam() implementation provided by BoundParamHelper.
69 
71  const ::nodelet::Nodelet* nodelet {nullptr};
72 };
73 
74 }
75 
76 #include "impl/filter_base.hpp"
FilterBase()
Construct the filter and pass the corresponding Log and GetParam helpers.
Definition: filter_base.hpp:46
const ::nodelet::Nodelet * nodelet
The nodelet this filter is running in. It should be set via setNodelet() after the filter is configur...
Definition: filter_base.hpp:71
ResultType getParam(const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt...
Definition: node_utils.hpp:110
Bound param helper (allows omitting the param adapter in each getParam call).
~FilterBase() override=default
void setNodelet(const ::nodelet::Nodelet *nodelet)
Inform this filter that it is running inside the passed nodelet. This should be called after configur...
Definition: filter_base.hpp:58
This file provides helper methods easing access to parameters passed to nodes, nodelets and filters...
Definition: any.hpp:15
Bound param helper (allows omitting the param adapter in each getParam call).
Utils for working with strings.


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sat Jun 17 2023 02:32:53