Skip to content

Commit

Permalink
adapt enum to new names
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelarguedas committed Jan 10, 2018
1 parent 44eb4ca commit ed4094a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions rclcpp/include/rclcpp/parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ enum ParameterType
PARAMETER_INTEGER = rcl_interfaces::msg::ParameterType::PARAMETER_INTEGER,
PARAMETER_DOUBLE = rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE,
PARAMETER_STRING = rcl_interfaces::msg::ParameterType::PARAMETER_STRING,
PARAMETER_BYTES = rcl_interfaces::msg::ParameterType::PARAMETER_BYTES,
PARAMETER_BYTE_ARRAY = rcl_interfaces::msg::ParameterType::PARAMETER_BYTE_ARRAY,
};

// Structure to store an arbitrary parameter with templated get/set methods
Expand Down Expand Up @@ -128,10 +128,10 @@ class ParameterVariant

template<ParameterType type>
typename std::enable_if<
type == ParameterType::PARAMETER_BYTES, const std::vector<uint8_t> &>::type
type == ParameterType::PARAMETER_BYTE_ARRAY, const std::vector<uint8_t> &>::type
get_value() const
{
if (value_.type != rcl_interfaces::msg::ParameterType::PARAMETER_BYTES) {
if (value_.type != rcl_interfaces::msg::ParameterType::PARAMETER_BYTE_ARRAY) {
// TODO(wjwwood): use custom exception
throw std::runtime_error("Invalid type");
}
Expand Down Expand Up @@ -175,7 +175,7 @@ class ParameterVariant
type, const std::vector<uint8_t> &>::value, const std::vector<uint8_t> &>::type
get_value() const
{
return get_value<ParameterType::PARAMETER_BYTES>();
return get_value<ParameterType::PARAMETER_BYTE_ARRAY>();
}

RCLCPP_PUBLIC
Expand Down
10 changes: 5 additions & 5 deletions rclcpp/src/rclcpp/parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ParameterVariant::ParameterVariant(
: name_(name)
{
value_.byte_values = byte_values;
value_.type = rcl_interfaces::msg::ParameterType::PARAMETER_BYTES;
value_.type = rcl_interfaces::msg::ParameterType::PARAMETER_BYTE_ARRAY;
}

ParameterType
Expand All @@ -101,7 +101,7 @@ ParameterVariant::get_type_name() const
return "double";
case rclcpp::parameter::ParameterType::PARAMETER_STRING:
return "string";
case rclcpp::parameter::ParameterType::PARAMETER_BYTES:
case rclcpp::parameter::ParameterType::PARAMETER_BYTE_ARRAY:
return "bytes";
case rclcpp::parameter::ParameterType::PARAMETER_NOT_SET:
return "not set";
Expand Down Expand Up @@ -152,7 +152,7 @@ ParameterVariant::as_bool() const
const std::vector<uint8_t> &
ParameterVariant::as_bytes() const
{
return get_value<ParameterType::PARAMETER_BYTES>();
return get_value<ParameterType::PARAMETER_BYTE_ARRAY>();
}

ParameterVariant
Expand All @@ -167,7 +167,7 @@ ParameterVariant::from_parameter(const rcl_interfaces::msg::Parameter & paramete
return ParameterVariant(parameter.name, parameter.value.double_value);
case PARAMETER_STRING:
return ParameterVariant(parameter.name, parameter.value.string_value);
case PARAMETER_BYTES:
case PARAMETER_BYTE_ARRAY:
return ParameterVariant(parameter.name, parameter.value.byte_values);
case PARAMETER_NOT_SET:
throw std::runtime_error("Type from ParameterValue is not set");
Expand Down Expand Up @@ -201,7 +201,7 @@ ParameterVariant::value_to_string() const
return std::to_string(as_double());
case rclcpp::parameter::ParameterType::PARAMETER_STRING:
return as_string();
case rclcpp::parameter::ParameterType::PARAMETER_BYTES:
case rclcpp::parameter::ParameterType::PARAMETER_BYTE_ARRAY:
{
std::stringstream bytes;
bool first_byte = true;
Expand Down

0 comments on commit ed4094a

Please sign in to comment.