aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/types
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-22 10:59:21 -0800
committerJosh Blum <josh@joshknows.com>2011-02-22 10:59:21 -0800
commit557d62ee648cef2a8edfd15602544064550f82fc (patch)
tree0614b00317b55a5a2b09315924cc43865ad6dc73 /host/lib/types
parentde35e125bc6e09fbe4da60f8f18390c137c77c43 (diff)
parent4613f454c781d258d6d9b210ff1b9043a2125981 (diff)
downloaduhd-557d62ee648cef2a8edfd15602544064550f82fc.tar.gz
uhd-557d62ee648cef2a8edfd15602544064550f82fc.tar.bz2
uhd-557d62ee648cef2a8edfd15602544064550f82fc.zip
Merge branch 'sensors' into dboard_serial
Diffstat (limited to 'host/lib/types')
-rw-r--r--host/lib/types/sensors.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/host/lib/types/sensors.cpp b/host/lib/types/sensors.cpp
index 2bff136a4..5f7115d70 100644
--- a/host/lib/types/sensors.cpp
+++ b/host/lib/types/sensors.cpp
@@ -17,6 +17,7 @@
#include <uhd/types/sensors.hpp>
#include <uhd/utils/exception.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
using namespace uhd;
@@ -35,7 +36,7 @@ sensor_value_t::sensor_value_t(
sensor_value_t::sensor_value_t(
const std::string &name,
- int_type value,
+ signed value,
const std::string &unit,
const std::string &formatter
):
@@ -47,7 +48,7 @@ sensor_value_t::sensor_value_t(
sensor_value_t::sensor_value_t(
const std::string &name,
- real_type value,
+ double value,
const std::string &unit,
const std::string &formatter
):
@@ -79,3 +80,15 @@ std::string sensor_value_t::to_pp_string(void) const{
}
UHD_THROW_INVALID_CODE_PATH();
}
+
+bool sensor_value_t::to_bool(void) const{
+ return value == "true";
+}
+
+signed sensor_value_t::to_int(void) const{
+ return boost::lexical_cast<signed>(value);
+}
+
+double sensor_value_t::to_real(void) const{
+ return boost::lexical_cast<double>(value);
+}