diff options
author | Josh Blum <josh@joshknows.com> | 2010-08-12 10:08:17 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-08-12 10:08:17 -0700 |
commit | 805d4a0cff00fb4e0071bb300436bb7eefb8fb16 (patch) | |
tree | d3e076ecff7e6ce7899b7cb8da0e932ee5ca8236 /host/lib/usrp | |
parent | ef6953024f1075a729e85f2511c75de337879888 (diff) | |
download | uhd-805d4a0cff00fb4e0071bb300436bb7eefb8fb16.tar.gz uhd-805d4a0cff00fb4e0071bb300436bb7eefb8fb16.tar.bz2 uhd-805d4a0cff00fb4e0071bb300436bb7eefb8fb16.zip |
uhd: made split string utility function
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/subdev_spec.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 12 |
2 files changed, 6 insertions, 15 deletions
diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index 0f00e2f74..765eecb3d 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.cpp @@ -16,7 +16,7 @@ // #include <uhd/usrp/subdev_spec.hpp> -#include <boost/algorithm/string.hpp> +#include <uhd/utils/algorithm.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> #include <stdexcept> @@ -35,12 +35,9 @@ subdev_spec_pair_t::subdev_spec_pair_t( } subdev_spec_t::subdev_spec_t(const std::string &markup){ - std::vector<std::string> pairs; - boost::split(pairs, markup, boost::is_any_of("\t ")); - BOOST_FOREACH(const std::string &pair, pairs){ + BOOST_FOREACH(const std::string &pair, std::split_string(markup)){ if (pair == "") continue; - std::vector<std::string> db_sd; - boost::split(db_sd, pair, boost::is_any_of(":")); + std::vector<std::string> db_sd = std::split_string(pair, ":"); switch(db_sd.size()){ 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; diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 21f411afe..45362c20f 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -21,7 +21,7 @@ #include <uhd/usrp/device_props.hpp> #include <uhd/utils/assert.hpp> #include <uhd/utils/static.hpp> -#include <boost/algorithm/string.hpp> +#include <uhd/utils/algorithm.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> @@ -41,12 +41,6 @@ static const size_t DISCOVERY_TIMEOUT_MS = 100; /*********************************************************************** * Helper Functions **********************************************************************/ -std::vector<std::string> split_addrs(const std::string &addrs_str){ - std::vector<std::string> addrs; - boost::split(addrs, addrs_str, boost::is_any_of("\t ")); - return addrs; -} - template <class T> std::string num2str(T num){ return boost::lexical_cast<std::string>(num); } @@ -80,7 +74,7 @@ static uhd::device_addrs_t usrp2_find(const device_addr_t &hint){ } //if there are multiple addresses, just return good, dont test - std::vector<std::string> addrs = split_addrs(hint["addr"]); + std::vector<std::string> addrs = std::split_string(hint["addr"]); if (addrs.size() > 1){ device_addr_t new_addr; new_addr["type"] = "usrp2"; @@ -155,7 +149,7 @@ static device::sptr usrp2_make(const device_addr_t &device_addr){ std::vector<udp_simple::sptr> ctrl_transports; std::vector<udp_zero_copy::sptr> data_transports; - BOOST_FOREACH(const std::string &addr, split_addrs(device_addr["addr"])){ + BOOST_FOREACH(const std::string &addr, std::split_string(device_addr["addr"])){ ctrl_transports.push_back(udp_simple::make_connected( addr, num2str(USRP2_UDP_CTRL_PORT) )); |