diff options
-rw-r--r-- | host/include/uhd/property_tree.hpp | 35 | ||||
-rw-r--r-- | host/include/uhd/property_tree.ipp | 4 | ||||
-rw-r--r-- | host/lib/property_tree.cpp | 102 | ||||
-rw-r--r-- | host/lib/usrp/b100/b100_impl.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/b100/io_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/e100/e100_impl.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/e100/io_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 10 | ||||
-rw-r--r-- | host/utils/uhd_usrp_probe.cpp | 12 | ||||
-rw-r--r-- | host/utils/usrp_burn_db_eeprom.cpp | 4 |
13 files changed, 137 insertions, 78 deletions
diff --git a/host/include/uhd/property_tree.hpp b/host/include/uhd/property_tree.hpp index cd8cba7e5..47b2c5736 100644 --- a/host/include/uhd/property_tree.hpp +++ b/host/include/uhd/property_tree.hpp @@ -22,7 +22,6 @@ #include <boost/utility.hpp> #include <boost/shared_ptr.hpp> #include <boost/function.hpp> -#include <boost/filesystem/path.hpp> #include <vector> namespace uhd{ @@ -99,40 +98,56 @@ public: }; /*! + * FS Path: A glorified string with path manipulations. + * Inspired by boost filesystem path, but without the dependency. + * + * Notice: we do not declare UHD_API on the whole structure + * because MSVC will do weird things with std::string and linking. + */ +struct fs_path : std::string{ + UHD_API fs_path(void); + UHD_API fs_path(const char *); + UHD_API fs_path(const std::string &); + UHD_API std::string leaf(void) const; + UHD_API fs_path branch_path(void) const; +}; + +UHD_API fs_path operator/(const fs_path &, const fs_path &); + +/*! * The property tree provides a file system structure for accessing properties. */ class UHD_API property_tree : boost::noncopyable{ public: typedef boost::shared_ptr<property_tree> sptr; - typedef boost::filesystem::path path_type; //! Create a new + empty property tree static sptr make(void); //! Get a subtree with a new root starting at path - virtual sptr subtree(const path_type &path) const = 0; + virtual sptr subtree(const fs_path &path) const = 0; //! Remove a property or directory (recursive) - virtual void remove(const path_type &path) = 0; + virtual void remove(const fs_path &path) = 0; //! True if the path exists in the tree - virtual bool exists(const path_type &path) const = 0; + virtual bool exists(const fs_path &path) const = 0; //! Get an iterable to all things in the given path - virtual std::vector<std::string> list(const path_type &path) const = 0; + virtual std::vector<std::string> list(const fs_path &path) const = 0; //! Create a new property entry in the tree - template <typename T> property<T> &create(const path_type &path); + template <typename T> property<T> &create(const fs_path &path); //! Get access to a property in the tree - template <typename T> property<T> &access(const path_type &path); + template <typename T> property<T> &access(const fs_path &path); private: //! Internal create property with wild-card type - virtual void _create(const path_type &path, const boost::shared_ptr<void> &prop) = 0; + virtual void _create(const fs_path &path, const boost::shared_ptr<void> &prop) = 0; //! Internal access property with wild-card type - virtual boost::shared_ptr<void> &_access(const path_type &path) const = 0; + virtual boost::shared_ptr<void> &_access(const fs_path &path) const = 0; }; diff --git a/host/include/uhd/property_tree.ipp b/host/include/uhd/property_tree.ipp index 868cba475..85720dc6b 100644 --- a/host/include/uhd/property_tree.ipp +++ b/host/include/uhd/property_tree.ipp @@ -81,12 +81,12 @@ private: **********************************************************************/ namespace uhd{ - template <typename T> property<T> &property_tree::create(const path_type &path){ + template <typename T> property<T> &property_tree::create(const fs_path &path){ this->_create(path, typename boost::shared_ptr<property<T> >(new property_impl<T>())); return this->access<T>(path); } - template <typename T> property<T> &property_tree::access(const path_type &path){ + template <typename T> property<T> &property_tree::access(const fs_path &path){ return *boost::static_pointer_cast<property<T> >(this->_access(path)); } diff --git a/host/lib/property_tree.cpp b/host/lib/property_tree.cpp index 58cd3f6ea..50e82a6ba 100644 --- a/host/lib/property_tree.cpp +++ b/host/lib/property_tree.cpp @@ -22,17 +22,63 @@ #include <boost/make_shared.hpp> #include <iostream> +using namespace uhd; + +/*********************************************************************** + * Helper function to iterate through paths + **********************************************************************/ +#include <boost/tokenizer.hpp> +#define path_tokenizer(path) \ + boost::tokenizer<boost::char_separator<char> > \ + (path, boost::char_separator<char>("/")) + +/*********************************************************************** + * Property path implementation wrapper + **********************************************************************/ +fs_path::fs_path(void): std::string(){} +fs_path::fs_path(const char *p): std::string(p){} +fs_path::fs_path(const std::string &p): std::string(p){} + +std::string fs_path::leaf(void) const{ + const size_t pos = this->rfind("/"); + if (pos == std::string::npos) return *this; + return this->substr(pos+1); +} + +fs_path fs_path::branch_path(void) const{ + const size_t pos = this->rfind("/"); + if (pos == std::string::npos) return *this; + return fs_path(this->substr(0, pos)); +} + +fs_path uhd::operator/(const fs_path &lhs, const fs_path &rhs){ + //strip trailing slash on left-hand-side + if (not lhs.empty() and *lhs.rbegin() == '/'){ + return fs_path(lhs.substr(0, lhs.size()-1)) / rhs; + } + + //strip leading slash on right-hand-side + if (not rhs.empty() and *rhs.begin() == '/'){ + return lhs / fs_path(rhs.substr(1)); + } + + return fs_path(lhs + "/" + rhs); +} + +/*********************************************************************** + * Property tree implementation + **********************************************************************/ class property_tree_impl : public uhd::property_tree{ public: - property_tree_impl(const path_type &root = path_type()): + property_tree_impl(const fs_path &root = fs_path()): _root(root) { _guts = boost::make_shared<tree_guts_type>(); } - sptr subtree(const path_type &path_) const{ - const path_type path = _root / path_; + sptr subtree(const fs_path &path_) const{ + const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); property_tree_impl *subtree = new property_tree_impl(path); @@ -40,42 +86,39 @@ public: return sptr(subtree); } - void remove(const path_type &path_){ - const path_type path = _root / path_; + void remove(const fs_path &path_){ + const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); node_type *parent = NULL; node_type *node = &_guts->root; - BOOST_FOREACH(const path_type &branch, path){ - const std::string name = branch.string(); + BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ if (not node->has_key(name)) throw_path_not_found(path); parent = node; node = &(*node)[name]; } if (parent == NULL) throw uhd::runtime_error("Cannot uproot"); - parent->pop(path_type(path.leaf()).string()); + parent->pop(fs_path(path.leaf())); } - bool exists(const path_type &path_) const{ - const path_type path = _root / path_; + bool exists(const fs_path &path_) const{ + const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const path_type &branch, path){ - const std::string name = branch.string(); + BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ if (not node->has_key(name)) return false; node = &(*node)[name]; } return true; } - std::vector<std::string> list(const path_type &path_) const{ - const path_type path = _root / path_; + std::vector<std::string> list(const fs_path &path_) const{ + const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const path_type &branch, path){ - const std::string name = branch.string(); + BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ if (not node->has_key(name)) throw_path_not_found(path); node = &(*node)[name]; } @@ -83,37 +126,35 @@ public: return node->keys(); } - void _create(const path_type &path_, const boost::shared_ptr<void> &prop){ - const path_type path = _root / path_; + void _create(const fs_path &path_, const boost::shared_ptr<void> &prop){ + const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const path_type &branch, path){ - const std::string name = branch.string(); + BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ if (not node->has_key(name)) (*node)[name] = node_type(); node = &(*node)[name]; } - if (node->prop.get() != NULL) throw uhd::runtime_error("Cannot create! Property already exists at: " + path.string()); + if (node->prop.get() != NULL) throw uhd::runtime_error("Cannot create! Property already exists at: " + path); node->prop = prop; } - boost::shared_ptr<void> &_access(const path_type &path_) const{ - const path_type path = _root / path_; + boost::shared_ptr<void> &_access(const fs_path &path_) const{ + const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const path_type &branch, path){ - const std::string name = branch.string(); + BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ if (not node->has_key(name)) throw_path_not_found(path); node = &(*node)[name]; } - if (node->prop.get() == NULL) throw uhd::runtime_error("Cannot access! Property uninitialized at: " + path.string()); + if (node->prop.get() == NULL) throw uhd::runtime_error("Cannot access! Property uninitialized at: " + path); return node->prop; } private: - void throw_path_not_found(const path_type &path) const{ - throw uhd::lookup_error("Path not found in tree: " + path.string()); + void throw_path_not_found(const fs_path &path) const{ + throw uhd::lookup_error("Path not found in tree: " + path); } //basic structural node element @@ -129,9 +170,12 @@ private: //members, the tree and root prefix boost::shared_ptr<tree_guts_type> _guts; - const path_type _root; + const fs_path _root; }; +/*********************************************************************** + * Property tree factory + **********************************************************************/ uhd::property_tree::sptr uhd::property_tree::make(void){ return sptr(new property_tree_impl()); } diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp index 2e2421ed3..ea9c91c50 100644 --- a/host/lib/usrp/b100/b100_impl.cpp +++ b/host/lib/usrp/b100/b100_impl.cpp @@ -209,7 +209,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //////////////////////////////////////////////////////////////////// _tree = property_tree::make(); _tree->create<std::string>("/name").set("B-Series Device"); - const property_tree::path_type mb_path = "/mboards/0"; + const fs_path mb_path = "/mboards/0"; _tree->create<std::string>(mb_path / "name").set("B100 (B-Hundo)"); _tree->create<std::string>(mb_path / "load_eeprom") .subscribe(boost::bind(&fx2_ctrl::usrp_load_eeprom, _fx2_ctrl, _1)); @@ -234,8 +234,8 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ // create codec control objects //////////////////////////////////////////////////////////////////// _codec_ctrl = b100_codec_ctrl::make(_fpga_spi_ctrl); - const property_tree::path_type rx_codec_path = mb_path / "rx_codecs/A"; - const property_tree::path_type tx_codec_path = mb_path / "tx_codecs/A"; + const fs_path rx_codec_path = mb_path / "rx_codecs/A"; + const fs_path tx_codec_path = mb_path / "tx_codecs/A"; _tree->create<std::string>(rx_codec_path / "name").set("ad9522"); _tree->create<meta_range_t>(rx_codec_path / "gains/pga/range").set(b100_codec_ctrl::rx_pga_gain_range); _tree->create<double>(rx_codec_path / "gains/pga/value") @@ -276,7 +276,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ _rx_dsps[dspno]->set_link_rate(B100_LINK_RATE_BPS); _tree->access<double>(mb_path / "tick_rate") .subscribe(boost::bind(&rx_dsp_core_200::set_tick_rate, _rx_dsps[dspno], _1)); - property_tree::path_type rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); + fs_path rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); _tree->create<double>(rx_dsp_path / "rate/value") .coerce(boost::bind(&rx_dsp_core_200::set_host_rate, _rx_dsps[dspno], _1)) .subscribe(boost::bind(&b100_impl::update_rx_samp_rate, this, _1)); diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp index d841188c0..34535217a 100644 --- a/host/lib/usrp/b100/io_impl.cpp +++ b/host/lib/usrp/b100/io_impl.cpp @@ -140,7 +140,7 @@ void b100_impl::update_tx_samp_rate(const double rate){ void b100_impl::update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ boost::mutex::scoped_lock recv_lock = _io_impl->recv_handler.get_scoped_lock(); - property_tree::path_type root = "/mboards/0/dboards"; + fs_path root = "/mboards/0/dboards"; //sanity checking validate_subdev_spec(_tree, spec, "rx"); @@ -169,7 +169,7 @@ void b100_impl::update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ void b100_impl::update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ boost::mutex::scoped_lock send_lock = _io_impl->send_handler.get_scoped_lock(); - property_tree::path_type root = "/mboards/0/dboards"; + fs_path root = "/mboards/0/dboards"; //sanity checking validate_subdev_spec(_tree, spec, "tx"); diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp index cca4ee9b3..0defb2973 100644 --- a/host/lib/usrp/e100/e100_impl.cpp +++ b/host/lib/usrp/e100/e100_impl.cpp @@ -170,7 +170,7 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ //////////////////////////////////////////////////////////////////// _tree = property_tree::make(); _tree->create<std::string>("/name").set("E-Series Device"); - const property_tree::path_type mb_path = "/mboards/0"; + const fs_path mb_path = "/mboards/0"; _tree->create<std::string>(mb_path / "name").set("E100 (euewanee)"); //////////////////////////////////////////////////////////////////// @@ -193,8 +193,8 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ // create codec control objects //////////////////////////////////////////////////////////////////// _codec_ctrl = e100_codec_ctrl::make(_fpga_spi_ctrl); - const property_tree::path_type rx_codec_path = mb_path / "rx_codecs/A"; - const property_tree::path_type tx_codec_path = mb_path / "tx_codecs/A"; + const fs_path rx_codec_path = mb_path / "rx_codecs/A"; + const fs_path tx_codec_path = mb_path / "tx_codecs/A"; _tree->create<std::string>(rx_codec_path / "name").set("ad9522"); _tree->create<meta_range_t>(rx_codec_path / "gains/pga/range").set(e100_codec_ctrl::rx_pga_gain_range); _tree->create<double>(rx_codec_path / "gains/pga/value") @@ -235,7 +235,7 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ _rx_dsps[dspno]->set_link_rate(E100_LINK_RATE_BPS); _tree->access<double>(mb_path / "tick_rate") .subscribe(boost::bind(&rx_dsp_core_200::set_tick_rate, _rx_dsps[dspno], _1)); - property_tree::path_type rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); + fs_path rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); _tree->create<double>(rx_dsp_path / "rate/value") .coerce(boost::bind(&rx_dsp_core_200::set_host_rate, _rx_dsps[dspno], _1)) .subscribe(boost::bind(&e100_impl::update_rx_samp_rate, this, _1)); diff --git a/host/lib/usrp/e100/io_impl.cpp b/host/lib/usrp/e100/io_impl.cpp index a10b3ffb3..0b81c1a86 100644 --- a/host/lib/usrp/e100/io_impl.cpp +++ b/host/lib/usrp/e100/io_impl.cpp @@ -218,7 +218,7 @@ void e100_impl::update_tx_samp_rate(const double rate){ void e100_impl::update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ boost::mutex::scoped_lock recv_lock = _io_impl->recv_handler.get_scoped_lock(); - property_tree::path_type root = "/mboards/0/dboards"; + fs_path root = "/mboards/0/dboards"; //sanity checking validate_subdev_spec(_tree, spec, "rx"); @@ -247,7 +247,7 @@ void e100_impl::update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ void e100_impl::update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ boost::mutex::scoped_lock send_lock = _io_impl->send_handler.get_scoped_lock(); - property_tree::path_type root = "/mboards/0/dboards"; + fs_path root = "/mboards/0/dboards"; //sanity checking validate_subdev_spec(_tree, spec, "tx"); diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index f9f5e675f..49cbe522f 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -634,30 +634,30 @@ private: return mcp; } - property_tree::path_type mb_root(const size_t mboard){ + fs_path mb_root(const size_t mboard){ const std::string name = _tree->list("/mboards").at(mboard); return "/mboards/" + name; } - property_tree::path_type rx_dsp_root(const size_t chan){ + fs_path rx_dsp_root(const size_t chan){ mboard_chan_pair mcp = rx_chan_to_mcp(chan); const std::string name = _tree->list(mb_root(mcp.mboard) / "rx_dsps").at(mcp.chan); return mb_root(mcp.mboard) / "rx_dsps" / name; } - property_tree::path_type tx_dsp_root(const size_t chan){ + fs_path tx_dsp_root(const size_t chan){ mboard_chan_pair mcp = tx_chan_to_mcp(chan); const std::string name = _tree->list(mb_root(mcp.mboard) / "tx_dsps").at(mcp.chan); return mb_root(mcp.mboard) / "tx_dsps" / name; } - property_tree::path_type rx_rf_fe_root(const size_t chan){ + fs_path rx_rf_fe_root(const size_t chan){ mboard_chan_pair mcp = rx_chan_to_mcp(chan); const subdev_spec_pair_t spec = get_rx_subdev_spec(mcp.mboard).at(mcp.chan); return mb_root(mcp.mboard) / "dboards" / spec.db_name / "rx_frontends" / spec.sd_name; } - property_tree::path_type tx_rf_fe_root(const size_t chan){ + fs_path tx_rf_fe_root(const size_t chan){ mboard_chan_pair mcp = tx_chan_to_mcp(chan); const subdev_spec_pair_t spec = get_tx_subdev_spec(mcp.mboard).at(mcp.chan); return mb_root(mcp.mboard) / "dboards" / spec.db_name / "tx_frontends" / spec.sd_name; diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 7a8f6497c..7c9e61e94 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -208,7 +208,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ //////////////////////////////////////////////////////////////////// _tree = property_tree::make(); _tree->create<std::string>("/name").set("USRP1 Device"); - const property_tree::path_type mb_path = "/mboards/0"; + const fs_path mb_path = "/mboards/0"; _tree->create<std::string>(mb_path / "name").set("USRP1 (Classic)"); _tree->create<std::string>(mb_path / "load_eeprom") .subscribe(boost::bind(&fx2_ctrl::usrp_load_eeprom, _fx2_ctrl, _1)); @@ -239,8 +239,8 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ //////////////////////////////////////////////////////////////////// BOOST_FOREACH(const std::string &db, _dbc.keys()){ _dbc[db].codec = usrp1_codec_ctrl::make(_iface, (db == "A")? SPI_ENABLE_CODEC_A : SPI_ENABLE_CODEC_B); - const property_tree::path_type rx_codec_path = mb_path / "rx_codecs" / db; - const property_tree::path_type tx_codec_path = mb_path / "tx_codecs" / db; + const fs_path rx_codec_path = mb_path / "rx_codecs" / db; + const fs_path tx_codec_path = mb_path / "tx_codecs" / db; _tree->create<std::string>(rx_codec_path / "name").set("ad9522"); _tree->create<meta_range_t>(rx_codec_path / "gains/pga/range").set(usrp1_codec_ctrl::rx_pga_gain_range); _tree->create<double>(rx_codec_path / "gains/pga/value") @@ -270,7 +270,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ // create rx dsp control objects //////////////////////////////////////////////////////////////////// for (size_t dspno = 0; dspno < get_num_ddcs(); dspno++){ - property_tree::path_type rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); + fs_path rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); _tree->create<double>(rx_dsp_path / "rate/value") .coerce(boost::bind(&usrp1_impl::update_rx_samp_rate, this, _1)); _tree->create<double>(rx_dsp_path / "freq/value") @@ -289,7 +289,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ // create tx dsp control objects //////////////////////////////////////////////////////////////////// for (size_t dspno = 0; dspno < get_num_ducs(); dspno++){ - property_tree::path_type tx_dsp_path = mb_path / str(boost::format("tx_dsps/%u") % dspno); + fs_path tx_dsp_path = mb_path / str(boost::format("tx_dsps/%u") % dspno); _tree->create<double>(tx_dsp_path / "rate/value") .coerce(boost::bind(&usrp1_impl::update_tx_samp_rate, this, _1)); _tree->create<double>(tx_dsp_path / "freq/value") diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 67bf25c2b..aef3f3a39 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -316,7 +316,7 @@ static subdev_spec_t replace_zero_in_spec(const std::string &type, const subdev_ subdev_spec_t usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec_){ const subdev_spec_t spec = replace_zero_in_spec("RX", spec_); boost::mutex::scoped_lock recv_lock = _io_impl->recv_handler.get_scoped_lock(); - property_tree::path_type root = "/mboards/" + which_mb + "/dboards"; + fs_path root = "/mboards/" + which_mb + "/dboards"; //sanity checking validate_subdev_spec(_tree, spec, "rx", which_mb); @@ -352,7 +352,7 @@ subdev_spec_t usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, con subdev_spec_t usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec_){ const subdev_spec_t spec = replace_zero_in_spec("TX", spec_); boost::mutex::scoped_lock send_lock = _io_impl->send_handler.get_scoped_lock(); - property_tree::path_type root = "/mboards/" + which_mb + "/dboards"; + fs_path root = "/mboards/" + which_mb + "/dboards"; //sanity checking validate_subdev_spec(_tree, spec, "tx", which_mb); diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 9a8269e6f..f87eb067e 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -328,7 +328,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ const device_addr_t device_args_i = device_args[mbi]; const std::string mb = boost::lexical_cast<std::string>(mbi); const std::string addr = device_args_i["addr"]; - const property_tree::path_type mb_path = "/mboards/" + mb; + const fs_path mb_path = "/mboards/" + mb; //////////////////////////////////////////////////////////////// // create the iface that controls i2c, spi, uart, and wb @@ -395,8 +395,8 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ //////////////////////////////////////////////////////////////// // create codec control objects //////////////////////////////////////////////////////////////// - const property_tree::path_type rx_codec_path = mb_path / "rx_codecs/A"; - const property_tree::path_type tx_codec_path = mb_path / "tx_codecs/A"; + const fs_path rx_codec_path = mb_path / "rx_codecs/A"; + const fs_path tx_codec_path = mb_path / "tx_codecs/A"; _tree->create<int>(rx_codec_path / "gains"); //phony property so this dir exists _tree->create<int>(tx_codec_path / "gains"); //phony property so this dir exists _mbc[mb].codec = usrp2_codec_ctrl::make(_mbc[mb].iface); @@ -479,7 +479,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ //The dsp core starts streaming briefly... now we flush _mbc[mb].rx_dsp_xports[dspno]->get_recv_buff(0.01).get(); //recv with timeout for lingering _mbc[mb].rx_dsp_xports[dspno]->get_recv_buff(0.01).get(); //recv with timeout for expected - property_tree::path_type rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); + fs_path rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno); _tree->create<double>(rx_dsp_path / "rate/value") .coerce(boost::bind(&rx_dsp_core_200::set_host_rate, _mbc[mb].rx_dsps[dspno], _1)) .subscribe(boost::bind(&usrp2_impl::update_rx_samp_rate, this, _1)); @@ -595,7 +595,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ //do some post-init tasks BOOST_FOREACH(const std::string &mb, _mbc.keys()){ - property_tree::path_type root = "/mboards/" + mb; + fs_path root = "/mboards/" + mb; _tree->access<double>(root / "tick_rate").update(); //and now that the tick rate is set, init the host rates to something diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 6c5f451cd..55b9e3ddd 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -51,7 +51,7 @@ static std::string make_border(const std::string &text){ return ss.str(); } -static std::string get_dsp_pp_string(const std::string &type, property_tree::sptr tree, const property_tree::path_type &path){ +static std::string get_dsp_pp_string(const std::string &type, property_tree::sptr tree, const fs_path &path){ std::stringstream ss; ss << boost::format("%s DSP: %s") % type % path.leaf() << std::endl; //ss << std::endl; @@ -68,7 +68,7 @@ static std::string prop_names_to_pp_string(const std::vector<std::string> &prop_ return ss.str(); } -static std::string get_subdev_pp_string(const std::string &type, property_tree::sptr tree, const property_tree::path_type &path){ +static std::string get_subdev_pp_string(const std::string &type, property_tree::sptr tree, const fs_path &path){ std::stringstream ss; ss << boost::format("%s Subdev: %s") % type % path.leaf() << std::endl; //ss << std::endl; @@ -93,7 +93,7 @@ static std::string get_subdev_pp_string(const std::string &type, property_tree:: return ss.str(); } -static std::string get_codec_pp_string(const std::string &type, property_tree::sptr tree, const property_tree::path_type &path){ +static std::string get_codec_pp_string(const std::string &type, property_tree::sptr tree, const fs_path &path){ std::stringstream ss; ss << boost::format("%s Codec: %s") % type % path.leaf() << std::endl; //ss << std::endl; @@ -108,7 +108,7 @@ static std::string get_codec_pp_string(const std::string &type, property_tree::s return ss.str(); } -static std::string get_dboard_pp_string(const std::string &type, property_tree::sptr tree, const property_tree::path_type &path){ +static std::string get_dboard_pp_string(const std::string &type, property_tree::sptr tree, const fs_path &path){ std::stringstream ss; ss << boost::format("%s Dboard: %s") % type % path.leaf() << std::endl; //ss << std::endl; @@ -128,7 +128,7 @@ static std::string get_dboard_pp_string(const std::string &type, property_tree:: return ss.str(); } -static std::string get_mboard_pp_string(property_tree::sptr tree, const property_tree::path_type &path){ +static std::string get_mboard_pp_string(property_tree::sptr tree, const fs_path &path){ std::stringstream ss; ss << boost::format("Mboard: %s") % (tree->access<std::string>(path / "name").get()) << std::endl; //ss << std::endl; @@ -166,7 +166,7 @@ static std::string get_device_pp_string(property_tree::sptr tree){ return ss.str(); } -void print_tree(const uhd::property_tree::path_type &path, uhd::property_tree::sptr tree){ +void print_tree(const uhd::fs_path &path, uhd::property_tree::sptr tree){ std::cout << path << std::endl; BOOST_FOREACH(const std::string &name, tree->list(path)){ print_tree(path / name, tree); diff --git a/host/utils/usrp_burn_db_eeprom.cpp b/host/utils/usrp_burn_db_eeprom.cpp index 9dfce141b..253b73262 100644 --- a/host/utils/usrp_burn_db_eeprom.cpp +++ b/host/utils/usrp_burn_db_eeprom.cpp @@ -63,14 +63,14 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //make the device and extract the dboard w/ property device::sptr dev = device::make(args); uhd::property_tree::sptr tree = dev->get_tree(); - const uhd::property_tree::path_type db_root = "/mboards/0/dboards"; + const uhd::fs_path db_root = "/mboards/0/dboards"; std::vector<std::string> dboard_names = tree->list(db_root); if (dboard_names.size() == 1 and slot.empty()) slot = dboard_names.front(); uhd::assert_has(dboard_names, slot, "dboard slot name"); std::cout << boost::format("Reading %s EEPROM on %s dboard...") % unit % slot << std::endl; boost::to_lower(unit); - const uhd::property_tree::path_type db_path = db_root / slot / (unit + "_eeprom"); + const uhd::fs_path db_path = db_root / slot / (unit + "_eeprom"); dboard_eeprom_t db_eeprom = tree->access<dboard_eeprom_t>(db_path).get(); //------------- handle the dboard ID -----------------------------// |