@@ -139,7 +139,9 @@ class FilterBase
139139
140140private:
141141 template <typename PT>
142- bool getParamImpl (const std::string & name, const uint8_t type, PT default_value, PT & value_out)
142+ bool getParamImpl (
143+ const std::string & name, const uint8_t type, PT default_value, PT & value_out,
144+ bool read_only)
143145 {
144146 std::string param_name = param_prefix_ + name;
145147
@@ -149,7 +151,7 @@ class FilterBase
149151 rcl_interfaces::msg::ParameterDescriptor desc;
150152 desc.name = name;
151153 desc.type = type;
152- desc.read_only = false ;
154+ desc.read_only = read_only ;
153155
154156 if (name.empty ()) {
155157 throw std::runtime_error (" Parameter must have a name" );
@@ -177,11 +179,11 @@ class FilterBase
177179 * \param default_value The default value to use if the parameter is not set
178180 * \return Whether or not the parameter of name/type was set */
179181 bool getParam (
180- const std::string & name, std::string & value,
182+ const std::string & name, std::string & value, bool read_only = true ,
181183 std::string default_value = std::string())
182184 {
183185 return getParamImpl (
184- name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING, default_value, value);
186+ name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING, default_value, value, read_only );
185187 }
186188
187189 /* *
@@ -190,11 +192,13 @@ class FilterBase
190192 * \param value The boolean to set with the value
191193 * \param default_value The default value to use if the parameter is not set
192194 * \return Whether or not the parameter of name/type was set */
193- bool getParam (const std::string & name, bool & value, bool default_value = false )
195+ bool getParam (
196+ const std::string & name, bool & value,
197+ bool read_only = true , bool default_value = false )
194198 {
195199 return getParamImpl (
196200 name, rcl_interfaces::msg::ParameterType::PARAMETER_BOOL, default_value,
197- value);
201+ value, read_only );
198202 }
199203
200204 /* *
@@ -203,11 +207,13 @@ class FilterBase
203207 * \param value The double to set with the value
204208 * \param default_value The default value to use if the parameter is not set
205209 * \return Whether or not the parameter of name/type was set */
206- bool getParam (const std::string & name, double & value, double default_value = 0.0 )
210+ bool getParam (
211+ const std::string & name, double & value,
212+ bool read_only = true , double default_value = 0.0 )
207213 {
208214 return getParamImpl (
209215 name, rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE, default_value,
210- value);
216+ value, read_only );
211217 }
212218
213219 /* *
@@ -216,11 +222,13 @@ class FilterBase
216222 * \param value The int to set with the value
217223 * \param default_value The default value to use if the parameter is not set
218224 * \return Whether or not the parameter of name/type was set */
219- bool getParam (const std::string & name, int & value, int default_value = 0 )
225+ bool getParam (
226+ const std::string & name, int & value,
227+ bool read_only = true , int default_value = 0 )
220228 {
221229 return getParamImpl (
222230 name, rcl_interfaces::msg::ParameterType::PARAMETER_INTEGER, default_value,
223- value);
231+ value, read_only );
224232 }
225233
226234 /* *
@@ -267,10 +275,12 @@ class FilterBase
267275 * \return Whether or not the parameter of name/type was set */
268276 bool getParam (
269277 const std::string & name, std::vector<double > & value,
278+ bool read_only = true ,
270279 std::vector<double > default_value = {})
271280 {
272281 return getParamImpl (
273- name, rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE_ARRAY, default_value, value);
282+ name, rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE_ARRAY, default_value, value,
283+ read_only);
274284 }
275285
276286 /* *
@@ -281,10 +291,12 @@ class FilterBase
281291 * \return Whether or not the parameter of name/type was set */
282292 bool getParam (
283293 const std::string & name, std::vector<std::string> & value,
294+ bool read_only = true ,
284295 std::vector<std::string> default_value = {})
285296 {
286297 return getParamImpl (
287- name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING_ARRAY, default_value, value);
298+ name, rcl_interfaces::msg::ParameterType::PARAMETER_STRING_ARRAY, default_value, value,
299+ read_only);
288300 }
289301
290302 // / The name of the filter
0 commit comments