aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/subdev_spec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/subdev_spec.cpp')
-rw-r--r--host/lib/usrp/subdev_spec.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp
index 69ab6a339..cca5c36b8 100644
--- a/host/lib/usrp/subdev_spec.cpp
+++ b/host/lib/usrp/subdev_spec.cpp
@@ -25,6 +25,15 @@
using namespace uhd;
using namespace uhd::usrp;
+subdev_spec_pair_t::subdev_spec_pair_t(
+ const std::string &db_name, const std::string &sd_name
+):
+ db_name(db_name),
+ sd_name(sd_name)
+{
+ /* NOP */
+}
+
subdev_spec_t::subdev_spec_t(const std::string &markup){
std::vector<std::string> pairs;
boost::split(pairs, markup, boost::is_any_of("\t "));
@@ -33,8 +42,8 @@ subdev_spec_t::subdev_spec_t(const std::string &markup){
std::vector<std::string> db_sd;
boost::split(db_sd, pair, boost::is_any_of(":"));
switch(db_sd.size()){
- case 1: this->push_back(pair_t("", db_sd.front())); break;
- case 2: this->push_back(pair_t(db_sd.front(), db_sd.back())); break;
+ case 1: this->push_back(subdev_spec_pair_t("", db_sd.front())); break;
+ case 2: this->push_back(subdev_spec_pair_t(db_sd.front(), db_sd.back())); break;
default: throw std::runtime_error("invalid subdev-spec markup string: "+markup);
}
}
@@ -46,10 +55,10 @@ std::string subdev_spec_t::to_pp_string(void) const{
std::stringstream ss;
size_t count = 0;
ss << "Subdevice Specification:" << std::endl;
- BOOST_FOREACH(const pair_t &pair, *this){
+ BOOST_FOREACH(const subdev_spec_pair_t &pair, *this){
ss << boost::format(
" Channel %d: Daughterboard %s, Subdevice %s"
- ) % (count++) % pair.first % pair.second << std::endl;
+ ) % (count++) % pair.db_name % pair.sd_name << std::endl;
}
return ss.str();
}
@@ -57,8 +66,8 @@ std::string subdev_spec_t::to_pp_string(void) const{
std::string subdev_spec_t::to_string(void) const{
std::string markup;
size_t count = 0;
- BOOST_FOREACH(const pair_t &pair, *this){
- markup += ((count++)? " " : "") + pair.first + ":" + pair.second;
+ BOOST_FOREACH(const subdev_spec_pair_t &pair, *this){
+ markup += ((count++)? " " : "") + pair.db_name + ":" + pair.sd_name;
}
return markup;
}