@@ -156,41 +156,53 @@ class FilterBase
156156 * \brief Get a filter parameter as a string
157157 * \param name The name of the parameter
158158 * \param value The string to set with the value
159+ * \param default_value The default value to use if the parameter is not set
159160 * \return Whether or not the parameter of name/type was set */
160- bool getParam (const std::string & name, std::string & value)
161+ bool getParam (
162+ const std::string & name, std::string & value,
163+ std::string default_value = std::string())
161164 {
162165 return getParamImpl (
163- name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING, std::string () , value);
166+ name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING, default_value , value);
164167 }
165168
166169 /* *
167170 * \brief Get a filter parameter as a boolean
168171 * \param name The name of the parameter
169172 * \param value The boolean to set with the value
173+ * \param default_value The default value to use if the parameter is not set
170174 * \return Whether or not the parameter of name/type was set */
171- bool getParam (const std::string & name, bool & value)
175+ bool getParam (const std::string & name, bool & value, bool default_value = false )
172176 {
173- return getParamImpl (name, rcl_interfaces::msg::ParameterType::PARAMETER_BOOL, false , value);
177+ return getParamImpl (
178+ name, rcl_interfaces::msg::ParameterType::PARAMETER_BOOL, default_value,
179+ value);
174180 }
175181
176182 /* *
177183 * \brief Get a filter parameter as a double
178184 * \param name The name of the parameter
179185 * \param value The double to set with the value
186+ * \param default_value The default value to use if the parameter is not set
180187 * \return Whether or not the parameter of name/type was set */
181- bool getParam (const std::string & name, double & value)
188+ bool getParam (const std::string & name, double & value, double default_value = 0.0 )
182189 {
183- return getParamImpl (name, rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE, 0.0 , value);
190+ return getParamImpl (
191+ name, rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE, default_value,
192+ value);
184193 }
185194
186195 /* *
187196 * \brief Get a filter parameter as a int
188197 * \param name The name of the parameter
189198 * \param value The int to set with the value
199+ * \param default_value The default value to use if the parameter is not set
190200 * \return Whether or not the parameter of name/type was set */
191- bool getParam (const std::string & name, int & value)
201+ bool getParam (const std::string & name, int & value, int default_value = 0 )
192202 {
193- return getParamImpl (name, rcl_interfaces::msg::ParameterType::PARAMETER_INTEGER, 0 , value);
203+ return getParamImpl (
204+ name, rcl_interfaces::msg::ParameterType::PARAMETER_INTEGER, default_value,
205+ value);
194206 }
195207
196208 /* *
@@ -233,22 +245,28 @@ class FilterBase
233245 * \brief Get a filter parameter as a std::vector<double>
234246 * \param name The name of the parameter
235247 * \param value The std::vector<double> to set with the value
248+ * \param default_value The default value to use if the parameter is not set
236249 * \return Whether or not the parameter of name/type was set */
237- bool getParam (const std::string & name, std::vector<double > & value)
250+ bool getParam (
251+ const std::string & name, std::vector<double > & value,
252+ std::vector<double > default_value = {})
238253 {
239254 return getParamImpl (
240- name, rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE_ARRAY, {} , value);
255+ name, rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE_ARRAY, default_value , value);
241256 }
242257
243258 /* *
244259 * \brief Get a filter parameter as a std::vector<string>
245260 * \param name The name of the parameter
246261 * \param value The std::vector<sgring> to set with the value
262+ * \param default_value The default value to use if the parameter is not set
247263 * \return Whether or not the parameter of name/type was set */
248- bool getParam (const std::string & name, std::vector<std::string> & value)
264+ bool getParam (
265+ const std::string & name, std::vector<std::string> & value,
266+ std::vector<std::string> default_value = {})
249267 {
250268 return getParamImpl (
251- name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING_ARRAY, {} , value);
269+ name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING_ARRAY, default_value , value);
252270 }
253271
254272 // / The name of the filter
0 commit comments