Skip to content

Commit

Permalink
Get primitive parameters by value
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron committed Mar 17, 2020
1 parent b65f95e commit 9d17592
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rclcpp/include/rclcpp/parameter_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class ParameterValue

template<ParameterType type>
constexpr
typename std::enable_if<type == ParameterType::PARAMETER_BOOL, const bool &>::type
typename std::enable_if<type == ParameterType::PARAMETER_BOOL, bool>::type
get() const
{
if (value_.type != rcl_interfaces::msg::ParameterType::PARAMETER_BOOL) {
Expand All @@ -155,7 +155,7 @@ class ParameterValue

template<ParameterType type>
constexpr
typename std::enable_if<type == ParameterType::PARAMETER_INTEGER, const int64_t &>::type
typename std::enable_if<type == ParameterType::PARAMETER_INTEGER, int64_t>::type
get() const
{
if (value_.type != rcl_interfaces::msg::ParameterType::PARAMETER_INTEGER) {
Expand All @@ -166,7 +166,7 @@ class ParameterValue

template<ParameterType type>
constexpr
typename std::enable_if<type == ParameterType::PARAMETER_DOUBLE, const double &>::type
typename std::enable_if<type == ParameterType::PARAMETER_DOUBLE, double>::type
get() const
{
if (value_.type != rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE) {
Expand Down Expand Up @@ -250,7 +250,7 @@ class ParameterValue

template<typename type>
constexpr
typename std::enable_if<std::is_same<type, bool>::value, const bool &>::type
typename std::enable_if<std::is_same<type, bool>::value, bool>::type
get() const
{
return get<ParameterType::PARAMETER_BOOL>();
Expand All @@ -259,15 +259,15 @@ class ParameterValue
template<typename type>
constexpr
typename std::enable_if<
std::is_integral<type>::value && !std::is_same<type, bool>::value, const int64_t &>::type
std::is_integral<type>::value && !std::is_same<type, bool>::value, int64_t>::type
get() const
{
return get<ParameterType::PARAMETER_INTEGER>();
}

template<typename type>
constexpr
typename std::enable_if<std::is_floating_point<type>::value, const double &>::type
typename std::enable_if<std::is_floating_point<type>::value, double>::type
get() const
{
return get<ParameterType::PARAMETER_DOUBLE>();
Expand Down

0 comments on commit 9d17592

Please sign in to comment.