summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib')
-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);
+}