aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/types.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/types.cpp')
-rw-r--r--host/lib/types.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/host/lib/types.cpp b/host/lib/types.cpp
index 1cfe84832..5c0fb1f42 100644
--- a/host/lib/types.cpp
+++ b/host/lib/types.cpp
@@ -36,6 +36,7 @@
#include <boost/thread.hpp>
#include <stdexcept>
#include <complex>
+#include <sstream>
using namespace uhd;
@@ -190,7 +191,7 @@ device_addr_t::device_addr_t(const std::string &args){
std::vector<std::string> key_val;
boost::split(key_val, pair, boost::is_any_of(pair_delim));
if (key_val.size() != 2) throw std::runtime_error("invalid args string: "+args);
- (*this)[trim(key_val[0])] = trim(key_val[1]);
+ (*this)[trim(key_val.front())] = trim(key_val.back());
}
}
@@ -198,16 +199,18 @@ std::string device_addr_t::to_pp_string(void) const{
if (this->size() == 0) return "Empty Device Address";
std::stringstream ss;
+ ss << "Device Address:" << std::endl;
BOOST_FOREACH(std::string key, this->keys()){
- ss << boost::format("%s: %s") % key % (*this)[key] << std::endl;
+ ss << boost::format(" %s: %s") % key % (*this)[key] << std::endl;
}
return ss.str();
}
std::string device_addr_t::to_string(void) const{
std::string args_str;
+ size_t count = 0;
BOOST_FOREACH(const std::string &key, this->keys()){
- args_str += key + pair_delim + (*this)[key] + arg_delim;
+ args_str += ((count++)? arg_delim : "") + key + pair_delim + (*this)[key];
}
return args_str;
}