Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split ParameterVariant into Parameter and ParameterValue #481

Merged
merged 17 commits into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ set(${PROJECT_NAME}_SRCS
src/rclcpp/node_interfaces/node_timers.cpp
src/rclcpp/node_interfaces/node_topics.cpp
src/rclcpp/parameter.cpp
src/rclcpp/parameter_value.cpp
src/rclcpp/parameter_client.cpp
src/rclcpp/parameter_events_filter.cpp
src/rclcpp/parameter_service.cpp
Expand Down
10 changes: 5 additions & 5 deletions rclcpp/include/rclcpp/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ class Node : public std::enable_shared_from_this<Node>

RCLCPP_PUBLIC
std::vector<rcl_interfaces::msg::SetParametersResult>
set_parameters(const std::vector<rclcpp::parameter::ParameterVariant> & parameters);
set_parameters(const std::vector<rclcpp::Parameter> & parameters);

RCLCPP_PUBLIC
rcl_interfaces::msg::SetParametersResult
set_parameters_atomically(const std::vector<rclcpp::parameter::ParameterVariant> & parameters);
set_parameters_atomically(const std::vector<rclcpp::Parameter> & parameters);

template<typename ParameterT>
void
Expand All @@ -269,18 +269,18 @@ class Node : public std::enable_shared_from_this<Node>
const ParameterT & value);

RCLCPP_PUBLIC
std::vector<rclcpp::parameter::ParameterVariant>
std::vector<rclcpp::Parameter>
get_parameters(const std::vector<std::string> & names) const;

RCLCPP_PUBLIC
rclcpp::parameter::ParameterVariant
rclcpp::Parameter
get_parameter(const std::string & name) const;

RCLCPP_PUBLIC
bool
get_parameter(
const std::string & name,
rclcpp::parameter::ParameterVariant & parameter) const;
rclcpp::Parameter & parameter) const;

/// Assign the value of the parameter if set into the parameter argument.
/**
Expand Down
12 changes: 6 additions & 6 deletions rclcpp/include/rclcpp/node_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ Node::set_parameter_if_not_set(
const std::string & name,
const ParameterT & value)
{
rclcpp::parameter::ParameterVariant parameter_variant;
if (!this->get_parameter(name, parameter_variant)) {
rclcpp::Parameter parameter;
if (!this->get_parameter(name, parameter)) {
this->set_parameters({
rclcpp::parameter::ParameterVariant(name, value),
rclcpp::Parameter(name, value),
});
}
}
Expand All @@ -215,10 +215,10 @@ template<typename ParameterT>
bool
Node::get_parameter(const std::string & name, ParameterT & value) const
{
rclcpp::parameter::ParameterVariant parameter_variant;
bool result = get_parameter(name, parameter_variant);
rclcpp::Parameter parameter;
bool result = get_parameter(name, parameter);
if (result) {
value = parameter_variant.get_value<ParameterT>();
value = parameter.get_value<ParameterT>();
}

return result;
Expand Down
12 changes: 6 additions & 6 deletions rclcpp/include/rclcpp/node_interfaces/node_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,30 @@ class NodeParameters : public NodeParametersInterface
virtual
std::vector<rcl_interfaces::msg::SetParametersResult>
set_parameters(
const std::vector<rclcpp::parameter::ParameterVariant> & parameters);
const std::vector<rclcpp::Parameter> & parameters);

RCLCPP_PUBLIC
virtual
rcl_interfaces::msg::SetParametersResult
set_parameters_atomically(
const std::vector<rclcpp::parameter::ParameterVariant> & parameters);
const std::vector<rclcpp::Parameter> & parameters);

RCLCPP_PUBLIC
virtual
std::vector<rclcpp::parameter::ParameterVariant>
std::vector<rclcpp::Parameter>
get_parameters(const std::vector<std::string> & names) const;

RCLCPP_PUBLIC
virtual
rclcpp::parameter::ParameterVariant
rclcpp::Parameter
get_parameter(const std::string & name) const;

RCLCPP_PUBLIC
virtual
bool
get_parameter(
const std::string & name,
rclcpp::parameter::ParameterVariant & parameter) const;
rclcpp::Parameter & parameter) const;

RCLCPP_PUBLIC
virtual
Expand Down Expand Up @@ -114,7 +114,7 @@ class NodeParameters : public NodeParametersInterface

ParametersCallbackFunction parameters_callback_ = nullptr;

std::map<std::string, rclcpp::parameter::ParameterVariant> parameters_;
std::map<std::string, rclcpp::Parameter> parameters_;

Publisher<rcl_interfaces::msg::ParameterEvent>::SharedPtr events_publisher_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,30 @@ class NodeParametersInterface
virtual
std::vector<rcl_interfaces::msg::SetParametersResult>
set_parameters(
const std::vector<rclcpp::parameter::ParameterVariant> & parameters) = 0;
const std::vector<rclcpp::Parameter> & parameters) = 0;

RCLCPP_PUBLIC
virtual
rcl_interfaces::msg::SetParametersResult
set_parameters_atomically(
const std::vector<rclcpp::parameter::ParameterVariant> & parameters) = 0;
const std::vector<rclcpp::Parameter> & parameters) = 0;

RCLCPP_PUBLIC
virtual
std::vector<rclcpp::parameter::ParameterVariant>
std::vector<rclcpp::Parameter>
get_parameters(const std::vector<std::string> & names) const = 0;

RCLCPP_PUBLIC
virtual
rclcpp::parameter::ParameterVariant
rclcpp::Parameter
get_parameter(const std::string & name) const = 0;

RCLCPP_PUBLIC
virtual
bool
get_parameter(
const std::string & name,
rclcpp::parameter::ParameterVariant & parameter) const = 0;
rclcpp::Parameter & parameter) const = 0;

RCLCPP_PUBLIC
virtual
Expand All @@ -83,7 +83,7 @@ class NodeParametersInterface

using ParametersCallbackFunction = std::function<
rcl_interfaces::msg::SetParametersResult(
const std::vector<rclcpp::parameter::ParameterVariant> &)>;
const std::vector<rclcpp::Parameter> &)>;

RCLCPP_PUBLIC
virtual
Expand Down
Loading