From f879a50989a35a2ba4886630164d71353a560c2e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 7 Jan 2011 10:03:46 -0800 Subject: uhd: create sensor value from string --- host/lib/types/sensors.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'host/lib/types') diff --git a/host/lib/types/sensors.cpp b/host/lib/types/sensors.cpp index 497f4bfd5..2bff136a4 100644 --- a/host/lib/types/sensors.cpp +++ b/host/lib/types/sensors.cpp @@ -57,12 +57,24 @@ sensor_value_t::sensor_value_t( /* NOP */ } +sensor_value_t::sensor_value_t( + const std::string &name, + const std::string &value, + const std::string &unit +): + name(name), value(value), + unit(unit), type(STRING) +{ + /* NOP */ +} + std::string sensor_value_t::to_pp_string(void) const{ switch(type){ case BOOLEAN: return str(boost::format("%s: %s") % name % unit); case INTEGER: case REALNUM: + case STRING: return str(boost::format("%s: %s %s") % name % value % unit); } UHD_THROW_INVALID_CODE_PATH(); -- cgit v1.2.3