.. _program_listing_file_include_dynamic_params.h: Program Listing for File dynamic_params.h ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/dynamic_params.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2023 Intel Corporation. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include #include "constants.h" #include #include "ros_param_backend.h" namespace realsense2_camera { class Parameters { public: Parameters(rclcpp::Node& node); ~Parameters(); template T setParam(std::string param_name, const T& initial_value, std::function func = std::function(), rcl_interfaces::msg::ParameterDescriptor descriptor=rcl_interfaces::msg::ParameterDescriptor()); template T readAndDeleteParam(std::string param_name, const T& initial_value); template void setParamT(std::string param_name, T& param, std::function func = std::function(), rcl_interfaces::msg::ParameterDescriptor descriptor=rcl_interfaces::msg::ParameterDescriptor()); template void setParamValue(T& param, const T& value); // function updates the parameter value both locally and in the parameters server void setRosParamValue(const std::string param_name, void const* const value); // function updates the parameters server void removeParam(std::string param_name); void pushUpdateFunctions(std::vector > funcs); template void queueSetRosValue(const std::string& param_name, const T value); template T getParam(std::string param_name); private: void monitor_update_functions(); private: rclcpp::Node& _node; rclcpp::Logger _logger; std::map > _param_functions; std::map _param_names; ParametersBackend _params_backend; std::condition_variable _update_functions_cv; bool _is_running; std::shared_ptr _update_functions_t; std::deque > _update_functions_v; std::list self_set_parameters; std::mutex _mu; }; }