From 15d9c6850c23c867c8ec823dedd20c7ec09d7e6b Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Tue, 4 Apr 2017 19:00:30 -0700 Subject: multi_usrp: Removed ordering req. from prop_tree path access - Path getters for mboard, rx_dsp and tx_dsp concat the numeric channel to the tree path instead of indexing a list. This allows for easier multi threaded tree construction because values can be placed in the tree in a random order. --- host/lib/usrp/multi_usrp.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index d64ff8ebd..9ae628eb7 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1754,8 +1754,12 @@ private: { try { - const std::string name = _tree->list("/mboards").at(mboard); - return "/mboards/" + name; + const std::string tree_path = "/mboards/" + boost::lexical_cast(mboard); + if (_tree->exists(tree_path)) { + return tree_path; + } else { + throw uhd::index_error(str(boost::format("multi_usrp::mb_root(%u) - path not found") % mboard)); + } } catch(const std::exception &e) { @@ -1778,8 +1782,12 @@ private: try { - const std::string name = _tree->list(mb_root(mcp.mboard) / "rx_dsps").at(mcp.chan); - return mb_root(mcp.mboard) / "rx_dsps" / name; + const std::string tree_path = mb_root(mcp.mboard) / "rx_dsps" / boost::lexical_cast(mcp.chan); + if (_tree->exists(tree_path)) { + return tree_path; + } else { + throw uhd::index_error(str(boost::format("multi_usrp::rx_dsp_root(%u) - mcp(%u) - path not found") % chan % mcp.chan)); + } } catch(const std::exception &e) { @@ -1801,8 +1809,12 @@ private: } try { - const std::string name = _tree->list(mb_root(mcp.mboard) / "tx_dsps").at(mcp.chan); - return mb_root(mcp.mboard) / "tx_dsps" / name; + const std::string tree_path = mb_root(mcp.mboard) / "tx_dsps" / boost::lexical_cast(mcp.chan); + if (_tree->exists(tree_path)) { + return tree_path; + } else { + throw uhd::index_error(str(boost::format("multi_usrp::tx_dsp_root(%u) - mcp(%u) - path not found") % chan % mcp.chan)); + } } catch(const std::exception &e) { -- cgit v1.2.3