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"
cras::FilterBase::setNodelet
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
filters::FilterBase
cras::FilterBase::FilterBase
FilterBase()
Construct the filter and pass the corresponding Log and GetParam helpers.
Definition: filter_base.hpp:46
cras
Definition: any.hpp:15
bound_param_helper.hpp
Bound param helper (allows omitting the param adapter in each getParam call).
string_utils.hpp
Utils for working with strings.
cras::BoundParamHelper
Bound param helper (allows omitting the param adapter in each getParam call).
Definition: bound_param_helper.hpp:30
cras::FilterLogHelper
Definition: filter_base.hpp:31
param_utils.hpp
This file provides helper methods easing access to parameters passed to nodes, nodelets and filters.
filter_base.hpp
cras::FilterBase::nodelet
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
cras::getParam
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
nodelet
std
nodelet.h
cras::FilterBase
Definition: filter_base.hpp:40
cras::FilterGetParamAdapter
Definition: filter_base.hpp:32
filter_base.h
cras::FilterBase::~FilterBase
~FilterBase() override=default


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sun Jan 14 2024 03:48:14