From 35e65135c3e254c7c989de815c2c55ce90cc7d66 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sat, 11 Jul 2015 07:46:42 +0300 Subject: [PATCH] Nodetool update; build is fixed now --- .../linux/apps/uavcan_nodetool.cpp | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/libuavcan_drivers/linux/apps/uavcan_nodetool.cpp b/libuavcan_drivers/linux/apps/uavcan_nodetool.cpp index 13d6bca905..78a3e44cad 100644 --- a/libuavcan_drivers/linux/apps/uavcan_nodetool.cpp +++ b/libuavcan_drivers/linux/apps/uavcan_nodetool.cpp @@ -76,42 +76,36 @@ public: std::string paramValueToString(const uavcan::protocol::param::Value& value) { - if (!value.value_bool.empty()) + if (auto x = value.as()) { - return value.value_bool[0] ? "true" : "false"; + return *x ? "true" : "false"; } - else if (!value.value_int.empty()) + if (auto x = value.as()) { - return std::to_string(value.value_int[0]); + return std::to_string(*x); } - else if (!value.value_float.empty()) + if (auto x = value.as()) { - return std::to_string(value.value_float[0]); + return std::to_string(*x); } - else if (!value.value_string.empty()) + if (auto x = value.as()) { - return std::string(value.value_string[0].value.c_str()) + " "; - } - else - { - return ""; + return std::string(x->c_str()) + " "; } + return ""; } std::string paramValueToString(const uavcan::protocol::param::NumericValue& value) { - if (!value.value_int.empty()) + if (auto x = value.as()) { - return std::to_string(value.value_int[0]); + return std::to_string(*x); } - else if (!value.value_float.empty()) + if (auto x = value.as()) { - return std::to_string(value.value_float[0]); - } - else - { - return ""; + return std::to_string(*x); } + return ""; } void printGetSetResponseHeader() @@ -197,7 +191,7 @@ const std::map