diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-02-09 23:19:55 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-02-10 16:44:33 -0800 |
commit | 26cc20847cde543e759aa5cee9a27eaa69c5dd9e (patch) | |
tree | eee102333381e2313af59e725d6b7a06b665161f /host | |
parent | f3a004faf7d50cbb5564f5e2f67f54ee07e051dd (diff) | |
download | uhd-26cc20847cde543e759aa5cee9a27eaa69c5dd9e.tar.gz uhd-26cc20847cde543e759aa5cee9a27eaa69c5dd9e.tar.bz2 uhd-26cc20847cde543e759aa5cee9a27eaa69c5dd9e.zip |
uhd: replace BOOST_FOREACH with C++11 range-based for loop
Note: This is the first commit that uses for-range, and range-based
for-loops are now usable for UHD development.
Diffstat (limited to 'host')
133 files changed, 396 insertions, 467 deletions
diff --git a/host/examples/gpio.cpp b/host/examples/gpio.cpp index 02c73e96b..e47b2ab27 100644 --- a/host/examples/gpio.cpp +++ b/host/examples/gpio.cpp @@ -129,7 +129,7 @@ void output_reg_values( for (int i = num_bits - 1; i >= 0; i--) std::cout << (boost::format(" %2d") % i); std::cout << std::endl; - BOOST_FOREACH(std::string &attr, attrs) + for(std::string &attr: attrs) { std::cout << (boost::format("%10s:%s") % attr % to_bit_string(uint32_t(usrp->get_gpio_attr(bank, attr)), num_bits)) diff --git a/host/examples/test_dboard_coercion.cpp b/host/examples/test_dboard_coercion.cpp index 81c45fcb3..0119f39cd 100644 --- a/host/examples/test_dboard_coercion.cpp +++ b/host/examples/test_dboard_coercion.cpp @@ -102,7 +102,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in std::cout << boost::format("\nTesting %s coercion...") % type << std::endl; - BOOST_FOREACH(const uhd::range_t &range, freq_ranges){ + for(const uhd::range_t &range: freq_ranges){ double freq_begin = range.start(); double freq_end = range.stop(); @@ -152,7 +152,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in bool has_sensor = (std::find(dboard_sensor_names.begin(), dboard_sensor_names.end(), "lo_locked")) != dboard_sensor_names.end(); - BOOST_FOREACH(double freq, freqs){ + for(double freq: freqs){ //Testing for successful frequency tune if(type == "TX") usrp->set_tx_freq(freq,chan); @@ -212,7 +212,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in //Testing for successful gain tune - BOOST_FOREACH(double gain, gains){ + for(double gain: gains){ if(type == "TX") usrp->set_tx_gain(gain,chan); else usrp->set_rx_gain(gain,chan); @@ -266,7 +266,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in } else{ results += "USRP did not successfully tune to the following frequencies: "; - BOOST_FOREACH(double bad_freq, bad_tune_freqs){ + for(double bad_freq: bad_tune_freqs){ if(bad_freq != *bad_tune_freqs.begin()) results += ", "; results += MHz_str(bad_freq); } @@ -282,7 +282,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in } else{ results += "LO did not lock at the following frequencies: "; - BOOST_FOREACH(double bad_freq, no_lock_freqs){ + for(double bad_freq: no_lock_freqs){ if(bad_freq != *no_lock_freqs.begin()) results += ", "; results += MHz_str(bad_freq); } @@ -298,7 +298,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in } else{ results += "USRP did not successfully set gain under the following circumstances:"; - BOOST_FOREACH(double_pair bad_pair, bad_gain_vals){ + for(double_pair bad_pair: bad_gain_vals){ double bad_freq = bad_pair.first; double bad_gain = bad_pair.second; results += str(boost::format("\nFrequency: %s, Gain: %5.2f") % MHz_str(bad_freq) % bad_gain); diff --git a/host/examples/test_messages.cpp b/host/examples/test_messages.cpp index 4135bca56..2583811ba 100644 --- a/host/examples/test_messages.cpp +++ b/host/examples/test_messages.cpp @@ -23,7 +23,6 @@ #include <uhd/usrp/multi_usrp.hpp> #include <boost/assign/list_of.hpp> #include <boost/program_options.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/format.hpp> #include <cstdlib> @@ -330,7 +329,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //init result counts uhd::dict<std::string, size_t> failures, successes; - BOOST_FOREACH(const std::string &key, tests.keys()){ + for(const std::string &key: tests.keys()){ failures[key] = 0; successes[key] = 0; } @@ -352,7 +351,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //print the result summary bool any_failure = false; std::cout << std::endl << "Summary:" << std::endl << std::endl; - BOOST_FOREACH(const std::string &key, tests.keys()){ + for(const std::string &key: tests.keys()){ std::cout << boost::format( "%s -> %3u successes, %3u failures" ) % key % successes[key] % failures[key] << std::endl; diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp index b2a8f944c..d596d9ed4 100644 --- a/host/examples/tx_waveforms.cpp +++ b/host/examples/tx_waveforms.cpp @@ -23,7 +23,6 @@ #include <uhd/exception.hpp> #include <boost/program_options.hpp> #include <boost/math/special_functions/round.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/thread.hpp> #include <boost/lexical_cast.hpp> diff --git a/host/include/uhd/image_loader.hpp b/host/include/uhd/image_loader.hpp index fd4a96781..4ebac288e 100644 --- a/host/include/uhd/image_loader.hpp +++ b/host/include/uhd/image_loader.hpp @@ -21,6 +21,7 @@ #include <string> #include <boost/function.hpp> +#include <boost/noncopyable.hpp> #include <uhd/config.hpp> #include <uhd/types/device_addr.hpp> diff --git a/host/include/uhd/property_tree.ipp b/host/include/uhd/property_tree.ipp index 6ed1056e6..ef63ced24 100644 --- a/host/include/uhd/property_tree.ipp +++ b/host/include/uhd/property_tree.ipp @@ -19,7 +19,6 @@ #define INCLUDED_UHD_PROPERTY_TREE_IPP #include <uhd/exception.hpp> -#include <boost/foreach.hpp> #include <boost/scoped_ptr.hpp> #include <vector> @@ -72,14 +71,14 @@ public: void _set_coerced(const T &value){ init_or_set_value(_coerced_value, value); - BOOST_FOREACH(typename property<T>::subscriber_type &csub, _coerced_subscribers){ + for(typename property<T>::subscriber_type &csub: _coerced_subscribers){ csub(get_value_ref(_coerced_value)); //let errors propagate } } property<T> &set(const T &value){ init_or_set_value(_value, value); - BOOST_FOREACH(typename property<T>::subscriber_type &dsub, _desired_subscribers){ + for(typename property<T>::subscriber_type &dsub: _desired_subscribers){ dsub(get_value_ref(_value)); //let errors propagate } if (not _coercer.empty()) { diff --git a/host/include/uhd/rfnoc/node_ctrl_base.ipp b/host/include/uhd/rfnoc/node_ctrl_base.ipp index d300f72a7..2492031be 100644 --- a/host/include/uhd/rfnoc/node_ctrl_base.ipp +++ b/host/include/uhd/rfnoc/node_ctrl_base.ipp @@ -45,7 +45,7 @@ namespace uhd { while (iters++ < MAX_ITER) { next_q.clear(); - BOOST_FOREACH(const sptr &this_node, search_q) { + for(const sptr &this_node: search_q) { // Add this node to the list of explored nodes explored.insert(this_node); // Create set of all child nodes of this_node that are not in explored: @@ -98,7 +98,7 @@ namespace uhd { std::vector< boost::shared_ptr<T> > descendant_rate_nodes = _find_child_node<T, downstream>(); value_type ret_val = NULL_VALUE; std::string first_node_id; - BOOST_FOREACH(const boost::shared_ptr<T> &node, descendant_rate_nodes) { + for(const boost::shared_ptr<T> &node: descendant_rate_nodes) { if (exclude_nodes.count(node)) { continue; } diff --git a/host/include/uhd/types/dict.ipp b/host/include/uhd/types/dict.ipp index 5fd4b536e..b9d367a3c 100644 --- a/host/include/uhd/types/dict.ipp +++ b/host/include/uhd/types/dict.ipp @@ -19,7 +19,6 @@ #define INCLUDED_UHD_TYPES_DICT_IPP #include <uhd/exception.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/lexical_cast.hpp> #include <typeinfo> @@ -61,7 +60,7 @@ namespace uhd{ template <typename Key, typename Val> std::vector<Key> dict<Key, Val>::keys(void) const{ std::vector<Key> keys; - BOOST_FOREACH(const pair_t &p, _map){ + for(const pair_t &p: _map){ keys.push_back(p.first); } return keys; @@ -70,7 +69,7 @@ namespace uhd{ template <typename Key, typename Val> std::vector<Val> dict<Key, Val>::vals(void) const{ std::vector<Val> vals; - BOOST_FOREACH(const pair_t &p, _map){ + for(const pair_t &p: _map){ vals.push_back(p.second); } return vals; @@ -78,7 +77,7 @@ namespace uhd{ template <typename Key, typename Val> bool dict<Key, Val>::has_key(const Key &key) const{ - BOOST_FOREACH(const pair_t &p, _map){ + for(const pair_t &p: _map){ if (p.first == key) return true; } return false; @@ -86,7 +85,7 @@ namespace uhd{ template <typename Key, typename Val> const Val &dict<Key, Val>::get(const Key &key, const Val &other) const{ - BOOST_FOREACH(const pair_t &p, _map){ + for(const pair_t &p: _map){ if (p.first == key) return p.second; } return other; @@ -94,7 +93,7 @@ namespace uhd{ template <typename Key, typename Val> const Val &dict<Key, Val>::get(const Key &key) const{ - BOOST_FOREACH(const pair_t &p, _map){ + for(const pair_t &p: _map){ if (p.first == key) return p.second; } throw key_not_found<Key, Val>(key); @@ -107,7 +106,7 @@ namespace uhd{ template <typename Key, typename Val> const Val &dict<Key, Val>::operator[](const Key &key) const{ - BOOST_FOREACH(const pair_t &p, _map){ + for(const pair_t &p: _map){ if (p.first == key) return p.second; } throw key_not_found<Key, Val>(key); @@ -115,7 +114,7 @@ namespace uhd{ template <typename Key, typename Val> Val &dict<Key, Val>::operator[](const Key &key){ - BOOST_FOREACH(pair_t &p, _map){ + for(pair_t &p: _map){ if (p.first == key) return p.second; } _map.push_back(std::make_pair(key, Val())); @@ -138,7 +137,7 @@ namespace uhd{ template <typename Key, typename Val> void dict<Key, Val>::update(const dict<Key, Val> &new_dict, bool fail_on_conflict) { - BOOST_FOREACH(const Key &key, new_dict.keys()) { + for(const Key &key: new_dict.keys()) { if (fail_on_conflict and has_key(key) and get(key) != new_dict[key]) { throw uhd::value_error(str( boost::format("Option merge conflict: %s:%s != %s:%s") diff --git a/host/include/uhd/utils/assert_has.ipp b/host/include/uhd/utils/assert_has.ipp index 7b3c88cb7..6457cf2ee 100644 --- a/host/include/uhd/utils/assert_has.ipp +++ b/host/include/uhd/utils/assert_has.ipp @@ -21,7 +21,6 @@ #include <uhd/utils/algorithm.hpp> #include <uhd/exception.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> namespace uhd{ @@ -34,7 +33,7 @@ namespace uhd{ if (uhd::has(range, value)) return; std::string possible_values = ""; size_t i = 0; - BOOST_FOREACH(const T &v, range){ + for(const T &v: range){ if (i++ > 0) possible_values += ", "; possible_values += boost::lexical_cast<std::string>(v); } diff --git a/host/include/uhd/utils/soft_register.hpp b/host/include/uhd/utils/soft_register.hpp index 2870ad595..d3a1e0943 100644 --- a/host/include/uhd/utils/soft_register.hpp +++ b/host/include/uhd/utils/soft_register.hpp @@ -27,7 +27,6 @@ #include <boost/thread/locks.hpp> #include <boost/unordered_map.hpp> #include <boost/tokenizer.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <list> @@ -479,7 +478,7 @@ public: */ void initialize(wb_iface& iface, bool sync = false) { boost::lock_guard<boost::mutex> lock(_mutex); - BOOST_FOREACH(soft_register_base* reg, _reglist) { + for(soft_register_base* reg: _reglist) { reg->initialize(iface, sync); } } @@ -491,7 +490,7 @@ public: */ void flush() { boost::lock_guard<boost::mutex> lock(_mutex); - BOOST_FOREACH(soft_register_base* reg, _reglist) { + for(soft_register_base* reg: _reglist) { reg->flush(); } } @@ -503,7 +502,7 @@ public: */ void refresh() { boost::lock_guard<boost::mutex> lock(_mutex); - BOOST_FOREACH(soft_register_base* reg, _reglist) { + for(soft_register_base* reg: _reglist) { reg->refresh(); } } @@ -527,7 +526,7 @@ public: */ virtual std::vector<std::string> enumerate() const { std::vector<std::string> temp; - BOOST_FOREACH(const regmap_t::value_type& reg, _regmap) { + for(const regmap_t::value_type& reg: _regmap) { temp.push_back(_name + "/" + reg.first); } return temp; @@ -623,8 +622,8 @@ public: { //Turn the slash separated path string into tokens std::list<std::string> tokens; - BOOST_FOREACH( - const std::string& node, + for( + const std::string& node: boost::tokenizer< boost::char_separator<char> >(path, boost::char_separator<char>("/"))) { tokens.push_back(node); @@ -633,7 +632,7 @@ public: (tokens.size() > 1 && _name == "")) { //If this is a top-level DB if (_name != "") tokens.pop_front(); if (tokens.size() == 2) { //2 tokens => regmap/register path - BOOST_FOREACH(const soft_regmap_accessor_t* regmap, _regmaps) { + for(const soft_regmap_accessor_t* regmap: _regmaps) { if (regmap->get_name() == tokens.front()) { return regmap->lookup(tokens.back()); } @@ -642,11 +641,11 @@ public: } else if (not _regmap_dbs.empty()) { //>2 tokens => <1 or more dbs>/regmap/register //Reconstruct path from tokens std::string newpath; - BOOST_FOREACH(const std::string& node, tokens) { + for(const std::string& node: tokens) { newpath += ("/" + node); } //Dispatch path to hierarchical DB - BOOST_FOREACH(const soft_regmap_accessor_t* db, _regmap_dbs) { + for(const soft_regmap_accessor_t* db: _regmap_dbs) { try { return db->lookup(newpath.substr(1)); } catch (std::exception&) { @@ -663,11 +662,11 @@ public: */ virtual std::vector<std::string> enumerate() const { std::vector<std::string> paths; - BOOST_FOREACH(const soft_regmap_accessor_t* regmap, _regmaps) { + for(const soft_regmap_accessor_t* regmap: _regmaps) { const std::vector<std::string>& regs = regmap->enumerate(); paths.insert(paths.end(), regs.begin(), regs.end()); } - BOOST_FOREACH(const soft_regmap_accessor_t* db, _regmap_dbs) { + for(const soft_regmap_accessor_t* db: _regmap_dbs) { const std::vector<std::string>& regs = db->enumerate(); paths.insert(paths.end(), regs.begin(), regs.end()); } diff --git a/host/lib/convert/convert_impl.cpp b/host/lib/convert/convert_impl.cpp index d624bf970..9508e7984 100644 --- a/host/lib/convert/convert_impl.cpp +++ b/host/lib/convert/convert_impl.cpp @@ -22,7 +22,6 @@ #include <uhd/exception.hpp> #include <stdint.h> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <complex> using namespace uhd; @@ -100,7 +99,7 @@ convert::function_type convert::get_converter( //find a matching priority priority_type best_prio = -1; - BOOST_FOREACH(priority_type prio_i, get_table()[id].keys()){ + for(priority_type prio_i: get_table()[id].keys()){ if (prio_i == prio) { //----------------------------------------------------------------// UHD_LOGV(always) << "get_converter: For converter ID: " << id.to_pp_string() << std::endl diff --git a/host/lib/device.cpp b/host/lib/device.cpp index c75ecad77..40798c6c3 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -22,7 +22,6 @@ #include <uhd/utils/msg.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/algorithm.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/weak_ptr.hpp> #include <boost/functional/hash.hpp> @@ -53,7 +52,7 @@ static size_t hash_device_addr( boost::hash_combine(hash, dev_addr["resource"]); } else { - BOOST_FOREACH(const std::string &key, uhd::sorted(dev_addr.keys())){ + for(const std::string &key: uhd::sorted(dev_addr.keys())){ boost::hash_combine(hash, key); boost::hash_combine(hash, dev_addr[key]); } @@ -90,7 +89,7 @@ device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){ device_addrs_t device_addrs; - BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()) { + for(const dev_fcn_reg_t &fcn: get_dev_fcn_regs()) { try { if (filter == ANY or fcn.get<2>() == filter) { device_addrs_t discovered_addrs = fcn.get<0>()(hint); @@ -118,10 +117,10 @@ device::sptr device::make(const device_addr_t &hint, device_filter_t filter, siz typedef boost::tuple<device_addr_t, make_t> dev_addr_make_t; std::vector<dev_addr_make_t> dev_addr_makers; - BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){ + for(const dev_fcn_reg_t &fcn: get_dev_fcn_regs()){ try{ if(filter == ANY or fcn.get<2>() == filter){ - BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){ + for(device_addr_t dev_addr: fcn.get<0>()(hint)){ //append the discovered address and its factory function dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>())); } @@ -154,7 +153,7 @@ device::sptr device::make(const device_addr_t &hint, device_filter_t filter, siz //copy keys that were in hint but not in dev_addr //this way, we can pass additional transport arguments - BOOST_FOREACH(const std::string &key, hint.keys()){ + for(const std::string &key: hint.keys()){ if (not dev_addr.has_key(key)) dev_addr[key] = hint[key]; } diff --git a/host/lib/device3.cpp b/host/lib/device3.cpp index 3b316e8ea..e1f53656f 100644 --- a/host/lib/device3.cpp +++ b/host/lib/device3.cpp @@ -68,7 +68,7 @@ std::vector<rfnoc::block_id_t> device3::find_blocks(const std::string &block_id_ void device3::clear() { - BOOST_FOREACH(const block_ctrl_base::sptr &block, _rfnoc_block_ctrl) { + for(const block_ctrl_base::sptr &block: _rfnoc_block_ctrl) { block->clear(); } } diff --git a/host/lib/experts/expert_container.cpp b/host/lib/experts/expert_container.cpp index 853e3e4b7..53995e5e3 100644 --- a/host/lib/experts/expert_container.cpp +++ b/host/lib/experts/expert_container.cpp @@ -19,7 +19,6 @@ #include <uhd/exception.hpp> #include <uhd/utils/msg.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/bind.hpp> #include <boost/make_shared.hpp> @@ -185,7 +184,7 @@ public: EX_LOG(1, "cycle check ... PASSED"); } else { EX_LOG(1, "cycle check ... ERROR!!!"); - BOOST_FOREACH(const std::string& e, back_edges) { + for(const std::string& e: back_edges) { EX_LOG(2, "back edge: " + e); } } @@ -193,7 +192,7 @@ public: //Test 2: Check data node input and output edges std::vector<std::string> data_node_issues; - BOOST_FOREACH(const vertex_map_t::value_type& v, _datanode_map) { + for(const vertex_map_t::value_type& v: _datanode_map) { size_t in_count = 0, out_count = 0; for (std::pair<edge_iter, edge_iter> ei = boost::edges(_expert_dag); ei.first != ei.second; @@ -238,7 +237,7 @@ public: EX_LOG(1, "data node check ... PASSED"); } else { EX_LOG(1, "data node check ... WARNING!"); - BOOST_FOREACH(const std::string& i, data_node_issues) { + for(const std::string& i: data_node_issues) { EX_LOG(2, i); } } @@ -246,7 +245,7 @@ public: //Test 3: Check worker node input and output edges std::vector<std::string> worker_issues; - BOOST_FOREACH(const vertex_map_t::value_type& v, _worker_map) { + for(const vertex_map_t::value_type& v: _worker_map) { size_t in_count = 0, out_count = 0; for (std::pair<edge_iter, edge_iter> ei = boost::edges(_expert_dag); ei.first != ei.second; @@ -268,7 +267,7 @@ public: EX_LOG(1, "worker check ... PASSED"); } else { EX_LOG(1, "worker check ... WARNING!"); - BOOST_FOREACH(const std::string& i, worker_issues) { + for(const std::string& i: worker_issues) { EX_LOG(2, i); } } @@ -347,7 +346,7 @@ protected: _worker_map.insert(vertex_map_t::value_type(worker->get_name(), gr_node)); //For each input, add an edge from the input to this node - BOOST_FOREACH(const std::string& node_name, worker->get_inputs()) { + for(const std::string& node_name: worker->get_inputs()) { vertex_map_t::const_iterator node = _datanode_map.find(node_name); if (node != _datanode_map.end()) { boost::add_edge((*node).second, gr_node, _expert_dag); @@ -358,7 +357,7 @@ protected: } //For each output, add an edge from this node to the output - BOOST_FOREACH(const std::string& node_name, worker->get_outputs()) { + for(const std::string& node_name: worker->get_outputs()) { vertex_map_t::const_iterator node = _datanode_map.find(node_name); if (node != _datanode_map.end()) { boost::add_edge(gr_node, (*node).second, _expert_dag); @@ -423,7 +422,7 @@ private: boost::depth_first_search(_expert_dag, boost::visitor(cdet_vis)); if (not back_edges.empty()) { std::string edges; - BOOST_FOREACH(const std::string& e, back_edges) { + for(const std::string& e: back_edges) { edges += "* " + e + ""; } throw uhd::runtime_error("Cannot resolve expert because it has at least one cycle!\n" diff --git a/host/lib/experts/expert_nodes.hpp b/host/lib/experts/expert_nodes.hpp index 6040cd19e..4a285cc80 100644 --- a/host/lib/experts/expert_nodes.hpp +++ b/host/lib/experts/expert_nodes.hpp @@ -23,7 +23,6 @@ #include <uhd/utils/dirty_tracked.hpp> #include <uhd/types/time_spec.hpp> #include <boost/function.hpp> -#include <boost/foreach.hpp> #include <boost/thread/recursive_mutex.hpp> #include <boost/thread.hpp> #include <boost/units/detail/utility.hpp> @@ -409,7 +408,7 @@ namespace uhd { namespace experts { // Worker node specific std::list<std::string> get_inputs() const { std::list<std::string> retval; - BOOST_FOREACH(data_accessor_t* acc, _inputs) { + for(data_accessor_t* acc: _inputs) { retval.push_back(acc->node().get_name()); } return retval; @@ -417,7 +416,7 @@ namespace uhd { namespace experts { std::list<std::string> get_outputs() const { std::list<std::string> retval; - BOOST_FOREACH(data_accessor_t* acc, _outputs) { + for(data_accessor_t* acc: _outputs) { retval.push_back(acc->node().get_name()); } return retval; @@ -442,14 +441,14 @@ namespace uhd { namespace experts { // Graph resolution specific virtual bool is_dirty() const { bool inputs_dirty = false; - BOOST_FOREACH(data_accessor_t* acc, _inputs) { + for(data_accessor_t* acc: _inputs) { inputs_dirty |= acc->node().is_dirty(); } return inputs_dirty; } virtual void mark_clean() { - BOOST_FOREACH(data_accessor_t* acc, _inputs) { + for(data_accessor_t* acc: _inputs) { acc->node().mark_clean(); } } diff --git a/host/lib/image_loader.cpp b/host/lib/image_loader.cpp index 91dd325dd..5ad257368 100644 --- a/host/lib/image_loader.cpp +++ b/host/lib/image_loader.cpp @@ -20,7 +20,6 @@ #include <utility> #include <boost/filesystem.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <uhd/exception.hpp> @@ -69,7 +68,7 @@ bool uhd::image_loader::load(const uhd::image_loader::image_loader_args_t &image else return get_image_loaders().at(type)(image_loader_args); } else{ - BOOST_FOREACH(const loader_fcn_pair_t &loader_fcn_pair, get_image_loaders()){ + for(const loader_fcn_pair_t &loader_fcn_pair: get_image_loaders()){ if(loader_fcn_pair.second(image_loader_args)) return true; } return false; diff --git a/host/lib/property_tree.cpp b/host/lib/property_tree.cpp index 76d7bccba..d62f61878 100644 --- a/host/lib/property_tree.cpp +++ b/host/lib/property_tree.cpp @@ -17,7 +17,6 @@ #include <uhd/property_tree.hpp> #include <uhd/types/dict.hpp> -#include <boost/foreach.hpp> #include <boost/thread/mutex.hpp> #include <boost/make_shared.hpp> #include <iostream> @@ -98,7 +97,7 @@ public: node_type *parent = NULL; node_type *node = &_guts->root; - BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ + for(const std::string &name: path_tokenizer(path)){ if (not node->has_key(name)) throw_path_not_found(path); parent = node; node = &(*node)[name]; @@ -112,7 +111,7 @@ public: boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ + for(const std::string &name: path_tokenizer(path)){ if (not node->has_key(name)) return false; node = &(*node)[name]; } @@ -124,7 +123,7 @@ public: boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ + for(const std::string &name: path_tokenizer(path)){ if (not node->has_key(name)) throw_path_not_found(path); node = &(*node)[name]; } @@ -137,7 +136,7 @@ public: boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ + for(const std::string &name: path_tokenizer(path)){ if (not node->has_key(name)) (*node)[name] = node_type(); node = &(*node)[name]; } @@ -150,7 +149,7 @@ public: boost::mutex::scoped_lock lock(_guts->mutex); node_type *node = &_guts->root; - BOOST_FOREACH(const std::string &name, path_tokenizer(path)){ + for(const std::string &name: path_tokenizer(path)){ if (not node->has_key(name)) throw_path_not_found(path); node = &(*node)[name]; } diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp index 4ee577891..2a486ac31 100644 --- a/host/lib/rfnoc/block_ctrl_base.cpp +++ b/host/lib/rfnoc/block_ctrl_base.cpp @@ -26,7 +26,6 @@ #include <uhd/rfnoc/block_ctrl_base.hpp> #include <uhd/rfnoc/constants.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #define UHD_BLOCK_LOG() UHD_LOGV(never) @@ -80,7 +79,7 @@ block_ctrl_base::block_ctrl_base( /*** Configure ports ****************************************************/ size_t n_valid_input_buffers = 0; - BOOST_FOREACH(const size_t ctrl_port, get_ctrl_ports()) { + for(const size_t ctrl_port: get_ctrl_ports()) { // Set source addresses: sr_write(SR_BLOCK_SID, get_address(ctrl_port), ctrl_port); // Set sink buffer sizes: @@ -94,7 +93,7 @@ block_ctrl_base::block_ctrl_base( /*** Register names *****************************************************/ blockdef::registers_t sregs = _block_def->get_settings_registers(); - BOOST_FOREACH(const std::string ®_name, sregs.keys()) { + for(const std::string ®_name: sregs.keys()) { if (DEFAULT_NAMED_SR.has_key(reg_name)) { throw uhd::runtime_error(str( boost::format("Register name %s is already defined!") @@ -105,7 +104,7 @@ block_ctrl_base::block_ctrl_base( .set(sregs.get(reg_name)); } blockdef::registers_t rbacks = _block_def->get_readback_registers(); - BOOST_FOREACH(const std::string ®_name, rbacks.keys()) { + for(const std::string ®_name: rbacks.keys()) { _tree->create<size_t>(_root_path / "registers"/ "rb" / reg_name) .set(rbacks.get(reg_name)); } @@ -137,7 +136,7 @@ void block_ctrl_base::_init_port_defs( const size_t first_port_index ) { size_t port_index = first_port_index; - BOOST_FOREACH(const blockdef::port_t &port_def, ports) { + for(const blockdef::port_t &port_def: ports) { fs_path port_path = _root_path / "ports" / direction / port_index; if (not _tree->exists(port_path)) { _tree->create<blockdef::port_t>(port_path); @@ -154,12 +153,12 @@ void block_ctrl_base::_init_block_args() { blockdef::args_t args = _block_def->get_args(); fs_path arg_path = _root_path / "args"; - BOOST_FOREACH(const size_t port, get_ctrl_ports()) { + for(const size_t port: get_ctrl_ports()) { _tree->create<std::string>(arg_path / port); } // First, create all nodes. - BOOST_FOREACH(const blockdef::arg_t &arg, args) { + for(const blockdef::arg_t &arg: args) { fs_path arg_type_path = arg_path / arg["port"] / arg["name"] / "type"; _tree->create<std::string>(arg_type_path).set(arg["type"]); fs_path arg_val_path = arg_path / arg["port"] / arg["name"] / "value"; @@ -173,7 +172,7 @@ void block_ctrl_base::_init_block_args() // TODO: Add coercer #define _SUBSCRIBE_CHECK_AND_RUN(type, arg_tag, error_message) \ _tree->access<type>(arg_val_path).add_coerced_subscriber(boost::bind((&nocscript::block_iface::run_and_check), _nocscript_iface, arg[#arg_tag], error_message)) - BOOST_FOREACH(const blockdef::arg_t &arg, args) { + for(const blockdef::arg_t &arg: args) { fs_path arg_val_path = arg_path / arg["port"] / arg["name"] / "value"; if (not arg["check"].empty()) { if (arg["type"] == "string") { _SUBSCRIBE_CHECK_AND_RUN(string, check, arg["check_message"]); } @@ -192,7 +191,7 @@ void block_ctrl_base::_init_block_args() } // Finally: Set the values. This will call subscribers, if we have any. - BOOST_FOREACH(const blockdef::arg_t &arg, args) { + for(const blockdef::arg_t &arg: args) { fs_path arg_val_path = arg_path / arg["port"] / arg["name"] / "value"; if (not arg["value"].empty()) { if (arg["type"] == "int_vector") { throw uhd::runtime_error("not yet implemented: int_vector"); } @@ -217,7 +216,7 @@ std::vector<size_t> block_ctrl_base::get_ctrl_ports() const std::vector<size_t> ctrl_ports; ctrl_ports.reserve(_ctrl_ifaces.size()); std::pair<size_t, wb_iface::sptr> it; - BOOST_FOREACH(it, _ctrl_ifaces) { + for(auto it: _ctrl_ifaces) { ctrl_ports.push_back(it.first); } return ctrl_ports; @@ -340,7 +339,7 @@ void block_ctrl_base::set_command_time( const size_t port ) { if (port == ANY_PORT) { - BOOST_FOREACH(const size_t specific_port, get_ctrl_ports()) { + for(const size_t specific_port: get_ctrl_ports()) { set_command_time(time_spec, specific_port); } return; @@ -377,7 +376,7 @@ void block_ctrl_base::set_command_tick_rate( const size_t port ) { if (port == ANY_PORT) { - BOOST_FOREACH(const size_t specific_port, get_ctrl_ports()) { + for(const size_t specific_port: get_ctrl_ports()) { set_command_tick_rate(tick_rate, specific_port); } return; @@ -414,7 +413,7 @@ void block_ctrl_base::clear() // Call parent... node_ctrl_base::clear(); // ...then child - BOOST_FOREACH(const size_t port_index, get_ctrl_ports()) { + for(const size_t port_index: get_ctrl_ports()) { _clear(port_index); } } @@ -429,7 +428,7 @@ uint32_t block_ctrl_base::get_address(size_t block_port) { **********************************************************************/ void block_ctrl_base::set_args(const uhd::device_addr_t &args, const size_t port) { - BOOST_FOREACH(const std::string &key, args.keys()) { + for(const std::string &key: args.keys()) { if (_tree->exists(get_arg_path(key, port))) { set_arg(key, args.get(key), port); } @@ -472,7 +471,7 @@ void block_ctrl_base::set_arg(const std::string &key, const std::string &val, co device_addr_t block_ctrl_base::get_args(const size_t port) const { device_addr_t args; - BOOST_FOREACH(const std::string &key, _tree->list(_root_path / "args" / port)) { + for(const std::string &key: _tree->list(_root_path / "args" / port)) { args[key] = get_arg(key); } return args; diff --git a/host/lib/rfnoc/blockdef_xml_impl.cpp b/host/lib/rfnoc/blockdef_xml_impl.cpp index 78d1995d1..9c56d82a6 100644 --- a/host/lib/rfnoc/blockdef_xml_impl.cpp +++ b/host/lib/rfnoc/blockdef_xml_impl.cpp @@ -21,7 +21,6 @@ #include <uhd/utils/msg.hpp> #include <uhd/utils/paths.hpp> #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/lexical_cast.hpp> #include <boost/algorithm/string.hpp> @@ -57,7 +56,7 @@ blockdef::port_t::port_t() { // This guarantees that we can access these keys // even if they were never initialized: - BOOST_FOREACH(const std::string &key, PORT_ARGS.keys()) { + for(const std::string &key: PORT_ARGS.keys()) { set(key, PORT_ARGS[key]); } } @@ -77,7 +76,7 @@ bool blockdef::port_t::is_keyword(const std::string &key) const bool blockdef::port_t::is_valid() const { // Check we have all the keys: - BOOST_FOREACH(const std::string &key, PORT_ARGS.keys()) { + for(const std::string &key: PORT_ARGS.keys()) { if (not has_key(key)) { return false; } @@ -90,7 +89,7 @@ bool blockdef::port_t::is_valid() const std::string blockdef::port_t::to_string() const { std::string result; - BOOST_FOREACH(const std::string &key, PORT_ARGS.keys()) { + for(const std::string &key: PORT_ARGS.keys()) { if (has_key(key)) { result += str(boost::format("%s=%s,") % key % get(key)); } @@ -125,7 +124,7 @@ blockdef::arg_t::arg_t() { // This guarantees that we can access these keys // even if they were never initialized: - BOOST_FOREACH(const std::string &key, ARG_ARGS.keys()) { + for(const std::string &key: ARG_ARGS.keys()) { set(key, ARG_ARGS[key]); } } @@ -133,7 +132,7 @@ blockdef::arg_t::arg_t() bool blockdef::arg_t::is_valid() const { // 1. Check we have all the keys: - BOOST_FOREACH(const std::string &key, ARG_ARGS.keys()) { + for(const std::string &key: ARG_ARGS.keys()) { if (not has_key(key)) { return false; } @@ -151,7 +150,7 @@ bool blockdef::arg_t::is_valid() const std::string blockdef::arg_t::to_string() const { std::string result; - BOOST_FOREACH(const std::string &key, ARG_ARGS.keys()) { + for(const std::string &key: ARG_ARGS.keys()) { if (has_key(key)) { result += str(boost::format("%s=%s,") % key % get(key)); } @@ -218,7 +217,7 @@ public: pt::ptree propt; try { read_xml(filename.string(), propt); - BOOST_FOREACH(pt::ptree::value_type &v, propt.get_child("nocblock.ids")) { + for(pt::ptree::value_type &v: propt.get_child("nocblock.ids")) { if (v.first == "id" and match_noc_id(v.second.data(), noc_id)) { return true; } @@ -302,11 +301,11 @@ public: std::set<size_t> port_numbers; size_t n_ports = 0; ports_t ports; - BOOST_FOREACH(pt::ptree::value_type &v, _pt.get_child("nocblock.ports")) { + for(pt::ptree::value_type &v: _pt.get_child("nocblock.ports")) { if (v.first != port_type) continue; // Now we have the correct sink or source node: port_t port; - BOOST_FOREACH(const std::string &key, port_t::PORT_ARGS.keys()) { + for(const std::string &key: port_t::PORT_ARGS.keys()) { port[key] = v.second.get(key, port_t::PORT_ARGS[key]); } // We have to be extra-careful with the port numbers: @@ -338,10 +337,10 @@ public: std::vector<size_t> get_all_port_numbers() { std::set<size_t> set_ports; - BOOST_FOREACH(const port_t &port, get_input_ports()) { + for(const port_t &port: get_input_ports()) { set_ports.insert(boost::lexical_cast<size_t>(port["port"])); } - BOOST_FOREACH(const port_t &port, get_output_ports()) { + for(const port_t &port: get_output_ports()) { set_ports.insert(boost::lexical_cast<size_t>(port["port"])); } return std::vector<size_t>(set_ports.begin(), set_ports.end()); @@ -353,10 +352,10 @@ public: args_t args; bool is_valid = true; pt::ptree def; - BOOST_FOREACH(pt::ptree::value_type &v, _pt.get_child("nocblock.args", def)) { + for(pt::ptree::value_type &v: _pt.get_child("nocblock.args", def)) { arg_t arg; if (v.first != "arg") continue; - BOOST_FOREACH(const std::string &key, arg_t::ARG_ARGS.keys()) { + for(const std::string &key: arg_t::ARG_ARGS.keys()) { arg[key] = v.second.get(key, arg_t::ARG_ARGS[key]); } if (arg["type"].empty()) { @@ -391,7 +390,7 @@ public: { registers_t registers; pt::ptree def; - BOOST_FOREACH(pt::ptree::value_type &v, _pt.get_child("nocblock.registers", def)) { + for(pt::ptree::value_type &v: _pt.get_child("nocblock.registers", def)) { if (v.first != reg_type) continue; registers[v.second.get<std::string>("name")] = boost::lexical_cast<size_t>(v.second.get<size_t>("address")); @@ -419,7 +418,7 @@ blockdef::sptr blockdef::make_from_noc_id(uint64_t noc_id) std::vector<fs::path> valid; // Check if any of the paths exist - BOOST_FOREACH(const fs::path &base_path, paths) { + for(const fs::path &base_path: paths) { fs::path this_path = base_path / XML_BLOCKS_SUBDIR; if (fs::exists(this_path) and fs::is_directory(this_path)) { valid.push_back(this_path); @@ -436,7 +435,7 @@ blockdef::sptr blockdef::make_from_noc_id(uint64_t noc_id) } // Iterate over all paths - BOOST_FOREACH(const fs::path &path, valid) { + for(const fs::path &path: valid) { // Iterate over all .xml files fs::directory_iterator end_itr; for (fs::directory_iterator i(path); i != end_itr; ++i) { diff --git a/host/lib/rfnoc/duc_block_ctrl_impl.cpp b/host/lib/rfnoc/duc_block_ctrl_impl.cpp index 0340ba0d6..6a3f32eaf 100644 --- a/host/lib/rfnoc/duc_block_ctrl_impl.cpp +++ b/host/lib/rfnoc/duc_block_ctrl_impl.cpp @@ -141,7 +141,7 @@ public: stream_cmd.num_samps *= interpolation; } - BOOST_FOREACH(const node_ctrl_base::node_map_pair_t upstream_node, list_upstream_nodes()) { + for(const node_ctrl_base::node_map_pair_t upstream_node: list_upstream_nodes()) { source_node_ctrl::sptr this_upstream_block_ctrl = boost::dynamic_pointer_cast<source_node_ctrl>(upstream_node.second.lock()); this_upstream_block_ctrl->issue_stream_cmd(stream_cmd, chan); diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp index 4060c62ae..8d64cb51a 100644 --- a/host/lib/rfnoc/legacy_compat.cpp +++ b/host/lib/rfnoc/legacy_compat.cpp @@ -261,7 +261,7 @@ public: _update_stream_args_for_streaming<uhd::RX_DIRECTION>(args, _rx_channel_map); UHD_LEGACY_LOG() << "[legacy_compat] rx stream args: " << args.args.to_string() << std::endl; uhd::rx_streamer::sptr streamer = _device->get_rx_stream(args); - BOOST_FOREACH(const size_t chan, args.channels) { + for(const size_t chan: args.channels) { _rx_stream_cache[chan] = streamer; } return streamer; @@ -278,7 +278,7 @@ public: _update_stream_args_for_streaming<uhd::TX_DIRECTION>(args, _tx_channel_map); UHD_LEGACY_LOG() << "[legacy_compat] tx stream args: " << args.args.to_string() << std::endl; uhd::tx_streamer::sptr streamer = _device->get_tx_stream(args); - BOOST_FOREACH(const size_t chan, args.channels) { + for(const size_t chan: args.channels) { _tx_stream_cache[chan] = streamer; } return streamer; @@ -332,14 +332,14 @@ public: if (_rx_stream_cache.count(chan)) { uhd::rx_streamer::sptr str_ptr = _rx_stream_cache[chan].lock(); if (str_ptr) { - BOOST_FOREACH(const rx_stream_map_type::value_type &chan_streamer_pair, _rx_stream_cache) { + for(const rx_stream_map_type::value_type &chan_streamer_pair: _rx_stream_cache) { if (chan_streamer_pair.second.lock() == str_ptr) { chans_to_change.insert(chan_streamer_pair.first); } } } } - BOOST_FOREACH(const size_t this_chan, chans_to_change) { + for(const size_t this_chan: chans_to_change) { size_t mboard, mb_chan; chan_to_mcp<uhd::RX_DIRECTION>(this_chan, _rx_channel_map, mboard, mb_chan); const size_t dsp_index = _rx_channel_map[mboard][mb_chan].radio_index; @@ -375,14 +375,14 @@ public: if (_tx_stream_cache.count(chan)) { uhd::tx_streamer::sptr str_ptr = _tx_stream_cache[chan].lock(); if (str_ptr) { - BOOST_FOREACH(const tx_stream_map_type::value_type &chan_streamer_pair, _tx_stream_cache) { + for(const tx_stream_map_type::value_type &chan_streamer_pair: _tx_stream_cache) { if (chan_streamer_pair.second.lock() == str_ptr) { chans_to_change.insert(chan_streamer_pair.first); } } } } - BOOST_FOREACH(const size_t this_chan, chans_to_change) { + for(const size_t this_chan: chans_to_change) { size_t mboard, mb_chan; chan_to_mcp<uhd::TX_DIRECTION>(this_chan, _tx_channel_map, mboard, mb_chan); const size_t dsp_index = _tx_channel_map[mboard][mb_chan].radio_index; diff --git a/host/lib/rfnoc/nocscript/expression.cpp b/host/lib/rfnoc/nocscript/expression.cpp index 38d6e2128..257e0b447 100644 --- a/host/lib/rfnoc/nocscript/expression.cpp +++ b/host/lib/rfnoc/nocscript/expression.cpp @@ -18,7 +18,6 @@ #include "expression.hpp" #include "function_table.hpp" #include <uhd/utils/cast.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/assign.hpp> #include <boost/algorithm/string.hpp> @@ -77,7 +76,7 @@ expression_literal::expression_literal( std::string str_vec = _val.substr(1, _val.size()-2); std::vector<std::string> subtoken_list; boost::split(subtoken_list, str_vec, boost::is_any_of(", "), boost::token_compress_on); - BOOST_FOREACH(const std::string &t, subtoken_list) { + for(const std::string &t: subtoken_list) { _int_vector_val.push_back(boost::lexical_cast<int>(t)); } break; @@ -299,7 +298,7 @@ expression_literal expression_container::eval() } expression_literal ret_val; - BOOST_FOREACH(const expression::sptr &sub_expr, _sub_exprs) { + for(const expression::sptr &sub_expr: _sub_exprs) { ret_val = sub_expr->eval(); if (_combiner == COMBINE_AND and ret_val.to_bool() == false) { return ret_val; @@ -319,7 +318,7 @@ std::string expression_function::to_string(const std::string &name, const argtyp { std::string s = name; int arg_count = 0; - BOOST_FOREACH(const expression::type_t type, types) { + for(const expression::type_t type: types) { if (arg_count == 0) { s += "("; } else { diff --git a/host/lib/rfnoc/nocscript/function_table.cpp b/host/lib/rfnoc/nocscript/function_table.cpp index a4e36c1a1..aabaef635 100644 --- a/host/lib/rfnoc/nocscript/function_table.cpp +++ b/host/lib/rfnoc/nocscript/function_table.cpp @@ -18,7 +18,6 @@ #include "function_table.hpp" #include "basic_functions.hpp" #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <map> diff --git a/host/lib/rfnoc/radio_ctrl_impl.cpp b/host/lib/rfnoc/radio_ctrl_impl.cpp index 43e5cb7fc..7a3cae79c 100644 --- a/host/lib/rfnoc/radio_ctrl_impl.cpp +++ b/host/lib/rfnoc/radio_ctrl_impl.cpp @@ -16,7 +16,6 @@ // #include "wb_iface_adapter.hpp" -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/bind.hpp> #include <uhd/convert.hpp> @@ -283,7 +282,7 @@ std::vector<size_t> radio_ctrl_impl::get_active_rx_ports() { std::vector<size_t> active_rx_ports; typedef std::map<size_t, bool> map_t; - BOOST_FOREACH(map_t::value_type &m, _rx_streamer_active) { + for(map_t::value_type &m: _rx_streamer_active) { if (m.second) { active_rx_ports.push_back(m.first); } diff --git a/host/lib/rfnoc/rx_stream_terminator.cpp b/host/lib/rfnoc/rx_stream_terminator.cpp index 43b3664fc..52803d6b6 100644 --- a/host/lib/rfnoc/rx_stream_terminator.cpp +++ b/host/lib/rfnoc/rx_stream_terminator.cpp @@ -21,7 +21,6 @@ #include <uhd/utils/msg.hpp> #include <uhd/rfnoc/source_node_ctrl.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> using namespace uhd::rfnoc; @@ -49,7 +48,7 @@ void rx_stream_terminator::set_rx_streamer(bool active, const size_t) { // TODO this is identical to source_node_ctrl::set_rx_streamer() -> factor out UHD_RFNOC_BLOCK_TRACE() << "rx_stream_terminator::set_rx_streamer() " << active << std::endl; - BOOST_FOREACH(const node_ctrl_base::node_map_pair_t upstream_node, _upstream_nodes) { + for(const node_ctrl_base::node_map_pair_t upstream_node: _upstream_nodes) { source_node_ctrl::sptr curr_upstream_block_ctrl = boost::dynamic_pointer_cast<source_node_ctrl>(upstream_node.second.lock()); if (curr_upstream_block_ctrl) { @@ -78,9 +77,9 @@ void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> stre bool in_continuous_streaming_mode = true; int num_channels = 0; - BOOST_FOREACH(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node, upstream_radio_nodes) { + for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node: upstream_radio_nodes) { num_channels += node->get_active_rx_ports().size(); - BOOST_FOREACH(const size_t port, node->get_active_rx_ports()) { + for(const size_t port: node->get_active_rx_ports()) { in_continuous_streaming_mode = in_continuous_streaming_mode && node->in_continuous_streaming_mode(port); } } @@ -101,8 +100,8 @@ void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> stre ///////////////////////////////////////////////////////////// // MIMO overflow recovery time ///////////////////////////////////////////////////////////// - BOOST_FOREACH(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node, upstream_radio_nodes) { - BOOST_FOREACH(const size_t port, node->get_active_rx_ports()) { + for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node: upstream_radio_nodes) { + for(const size_t port: node->get_active_rx_ports()) { // check all the ports on all the radios node->rx_ctrl_clear_cmds(port); node->issue_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS, port); @@ -116,8 +115,8 @@ void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> stre stream_cmd.stream_now = false; stream_cmd.time_spec = upstream_radio_nodes[0]->get_time_now() + time_spec_t(0.05); - BOOST_FOREACH(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node, upstream_radio_nodes) { - BOOST_FOREACH(const size_t port, node->get_active_rx_ports()) { + for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node: upstream_radio_nodes) { + for(const size_t port: node->get_active_rx_ports()) { node->issue_stream_cmd(stream_cmd, port); } } diff --git a/host/lib/rfnoc/sink_block_ctrl_base.cpp b/host/lib/rfnoc/sink_block_ctrl_base.cpp index 55d502ede..4b4eec20d 100644 --- a/host/lib/rfnoc/sink_block_ctrl_base.cpp +++ b/host/lib/rfnoc/sink_block_ctrl_base.cpp @@ -45,7 +45,7 @@ std::vector<size_t> sink_block_ctrl_base::get_input_ports() const { std::vector<size_t> input_ports; input_ports.reserve(_tree->list(_root_path / "ports" / "in").size()); - BOOST_FOREACH(const std::string port, _tree->list(_root_path / "ports" / "in")) { + for(const std::string port: _tree->list(_root_path / "ports" / "in")) { input_ports.push_back(boost::lexical_cast<size_t>(port)); } return input_ports; diff --git a/host/lib/rfnoc/sink_node_ctrl.cpp b/host/lib/rfnoc/sink_node_ctrl.cpp index 8398641fd..2915369f3 100644 --- a/host/lib/rfnoc/sink_node_ctrl.cpp +++ b/host/lib/rfnoc/sink_node_ctrl.cpp @@ -38,7 +38,7 @@ void sink_node_ctrl::set_tx_streamer(bool active, const size_t port) UHD_RFNOC_BLOCK_TRACE() << "sink_node_ctrl::set_tx_streamer() " << active << " " << port << std::endl; /* Enable all downstream connections: - BOOST_FOREACH(const node_ctrl_base::node_map_pair_t downstream_node, list_downstream_nodes()) { + for(const node_ctrl_base::node_map_pair_t downstream_node: list_downstream_nodes()) { sptr curr_downstream_block_ctrl = boost::dynamic_pointer_cast<sink_node_ctrl>(downstream_node.second.lock()); if (curr_downstream_block_ctrl) { diff --git a/host/lib/rfnoc/source_block_ctrl_base.cpp b/host/lib/rfnoc/source_block_ctrl_base.cpp index 94e271541..3d5d2b2b6 100644 --- a/host/lib/rfnoc/source_block_ctrl_base.cpp +++ b/host/lib/rfnoc/source_block_ctrl_base.cpp @@ -36,7 +36,7 @@ void source_block_ctrl_base::issue_stream_cmd( return; } - BOOST_FOREACH(const node_ctrl_base::node_map_pair_t upstream_node, _upstream_nodes) { + for(const node_ctrl_base::node_map_pair_t upstream_node: _upstream_nodes) { source_node_ctrl::sptr this_upstream_block_ctrl = boost::dynamic_pointer_cast<source_node_ctrl>(upstream_node.second.lock()); this_upstream_block_ctrl->issue_stream_cmd(stream_cmd, chan); @@ -64,7 +64,7 @@ std::vector<size_t> source_block_ctrl_base::get_output_ports() const { std::vector<size_t> output_ports; output_ports.reserve(_tree->list(_root_path / "ports" / "out").size()); - BOOST_FOREACH(const std::string port, _tree->list(_root_path / "ports" / "out")) { + for(const std::string port: _tree->list(_root_path / "ports" / "out")) { output_ports.push_back(boost::lexical_cast<size_t>(port)); } return output_ports; diff --git a/host/lib/rfnoc/source_node_ctrl.cpp b/host/lib/rfnoc/source_node_ctrl.cpp index c97c72354..b3cc5e640 100644 --- a/host/lib/rfnoc/source_node_ctrl.cpp +++ b/host/lib/rfnoc/source_node_ctrl.cpp @@ -38,7 +38,7 @@ void source_node_ctrl::set_rx_streamer(bool active, const size_t port) UHD_RFNOC_BLOCK_TRACE() << "source_node_ctrl::set_rx_streamer() " << port << " -> " << active << std::endl; /* This will enable all upstream blocks: - BOOST_FOREACH(const node_ctrl_base::node_map_pair_t upstream_node, list_upstream_nodes()) { + for(const node_ctrl_base::node_map_pair_t upstream_node: list_upstream_nodes()) { sptr curr_upstream_block_ctrl = boost::dynamic_pointer_cast<source_node_ctrl>(upstream_node.second.lock()); if (curr_upstream_block_ctrl) { diff --git a/host/lib/rfnoc/tick_node_ctrl.cpp b/host/lib/rfnoc/tick_node_ctrl.cpp index 5548194ae..625771945 100644 --- a/host/lib/rfnoc/tick_node_ctrl.cpp +++ b/host/lib/rfnoc/tick_node_ctrl.cpp @@ -47,7 +47,7 @@ double tick_node_ctrl::get_tick_rate( ); } // neighbouring_tick_nodes is now initialized double ret_val = RATE_UNDEFINED; - BOOST_FOREACH(const sptr &node, neighbouring_tick_nodes) { + for(const sptr &node: neighbouring_tick_nodes) { if (_explored_nodes.count(node)) { continue; } diff --git a/host/lib/rfnoc/tx_stream_terminator.cpp b/host/lib/rfnoc/tx_stream_terminator.cpp index ee856843d..8544b945d 100644 --- a/host/lib/rfnoc/tx_stream_terminator.cpp +++ b/host/lib/rfnoc/tx_stream_terminator.cpp @@ -45,7 +45,7 @@ void tx_stream_terminator::set_tx_streamer(bool active, const size_t /* port */) { // TODO this is identical to sink_node_ctrl::set_tx_streamer() -> factor out UHD_RFNOC_BLOCK_TRACE() << "tx_stream_terminator::set_tx_streamer() " << active << std::endl; - BOOST_FOREACH(const node_ctrl_base::node_map_pair_t downstream_node, _downstream_nodes) { + for(const node_ctrl_base::node_map_pair_t downstream_node: _downstream_nodes) { sink_node_ctrl::sptr curr_downstream_block_ctrl = boost::dynamic_pointer_cast<sink_node_ctrl>(downstream_node.second.lock()); if (curr_downstream_block_ctrl) { diff --git a/host/lib/rfnoc/utils.hpp b/host/lib/rfnoc/utils.hpp index ecd3d7cfb..1ee10397c 100644 --- a/host/lib/rfnoc/utils.hpp +++ b/host/lib/rfnoc/utils.hpp @@ -47,7 +47,7 @@ namespace uhd { namespace rfnoc { namespace utils { port++; } } else { - BOOST_FOREACH(const size_t allowed_port, allowed_ports) { + for(const size_t allowed_port: allowed_ports) { if (not nodes.count(port)) { return allowed_port; } @@ -65,7 +65,7 @@ namespace uhd { namespace rfnoc { namespace utils { template <typename T> static std::set<T> str_list_to_set(const std::vector<std::string> &list) { std::set<T> return_set; - BOOST_FOREACH(const std::string &S, list) { + for(const std::string &S: list) { return_set.insert(boost::lexical_cast<T>(S)); } return return_set; diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp index d04b679f8..720e54e4d 100644 --- a/host/lib/transport/libusb1_base.cpp +++ b/host/lib/transport/libusb1_base.cpp @@ -24,7 +24,6 @@ #include <uhd/types/serial.hpp> #include <boost/weak_ptr.hpp> #include <boost/thread/mutex.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <cstdlib> #include <iostream> @@ -227,7 +226,7 @@ public: std::string string_descriptor((char *)buff, size_t(ret)); byte_vector_t string_vec(string_descriptor.begin(), string_descriptor.end()); std::string out; - BOOST_FOREACH(uint8_t byte, string_vec){ + for(uint8_t byte: string_vec){ if (byte < 32 or byte > 127) return out; out += byte; } diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index c32b96b63..719893bcd 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -21,7 +21,6 @@ #include <uhd/transport/bounded_buffer.hpp> #include <uhd/utils/msg.hpp> #include <uhd/exception.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/function.hpp> #include <boost/bind.hpp> @@ -274,19 +273,19 @@ public: ~libusb_zero_copy_single(void) { //cancel all transfers - BOOST_FOREACH(libusb_transfer *lut, _all_luts) + for(libusb_transfer *lut: _all_luts) { libusb_cancel_transfer(lut); } //process all transfers until timeout occurs - BOOST_FOREACH(libusb_zero_copy_mb *mb, _enqueued) + for(libusb_zero_copy_mb *mb: _enqueued) { mb->wait_for_completion(0.01); } //free all transfers - BOOST_FOREACH(libusb_transfer *lut, _all_luts) + for(libusb_transfer *lut: _all_luts) { libusb_free_transfer(lut); } diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp index d34f222e8..161d921bc 100644 --- a/host/lib/transport/super_recv_packet_handler.hpp +++ b/host/lib/transport/super_recv_packet_handler.hpp @@ -30,7 +30,6 @@ #include <uhd/transport/vrt_if_packet.hpp> #include <uhd/transport/zero_copy.hpp> #include <boost/dynamic_bitset.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/format.hpp> #include <boost/bind.hpp> diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 0acc8df4b..09ae0c882 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -31,7 +31,6 @@ #include <uhd/transport/zero_copy.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/thread_time.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <iostream> #include <vector> @@ -382,7 +381,7 @@ private: if_packet_info.packet_count = _next_packet_seq; //get a buffer for each channel or timeout - BOOST_FOREACH(xport_chan_props_type &props, _props){ + for(xport_chan_props_type &props: _props){ if (not props.buff) props.buff = props.get_buff(timeout); if (not props.buff) return 0; //timeout } diff --git a/host/lib/types/byte_vector.cpp b/host/lib/types/byte_vector.cpp index 15ae93858..f08b6e088 100644 --- a/host/lib/types/byte_vector.cpp +++ b/host/lib/types/byte_vector.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include <boost/foreach.hpp> #include <uhd/types/byte_vector.hpp> @@ -23,7 +22,7 @@ namespace uhd{ std::string bytes_to_string(const byte_vector_t &bytes){ std::string out; - BOOST_FOREACH(uint8_t byte, bytes){ + for(uint8_t byte: bytes){ if (byte < 32 or byte > 127) return out; out += byte; } diff --git a/host/lib/types/device_addr.cpp b/host/lib/types/device_addr.cpp index 747f61b8d..71acd7f1f 100644 --- a/host/lib/types/device_addr.cpp +++ b/host/lib/types/device_addr.cpp @@ -18,7 +18,6 @@ #include <uhd/types/device_addr.hpp> #include <boost/algorithm/string.hpp> #include <boost/tokenizer.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/regex.hpp> #include <stdexcept> @@ -38,10 +37,10 @@ static std::string trim(const std::string &in){ (inp, boost::char_separator<char>(sep)) device_addr_t::device_addr_t(const std::string &args){ - BOOST_FOREACH(const std::string &pair, tokenizer(args, arg_delim)){ + for(const std::string &pair: tokenizer(args, arg_delim)){ if (trim(pair) == "") continue; std::vector<std::string> toks; - BOOST_FOREACH(const std::string &tok, tokenizer(pair, pair_delim)){ + for(const std::string &tok: tokenizer(pair, pair_delim)){ toks.push_back(tok); } if (toks.size() == 1) toks.push_back(""); //pad empty value @@ -57,7 +56,7 @@ std::string device_addr_t::to_pp_string(void) const{ std::stringstream ss; ss << "Device Address:" << std::endl; - BOOST_FOREACH(std::string key, this->keys()){ + for(std::string key: this->keys()){ ss << boost::format(" %s: %s") % key % this->get(key) << std::endl; } return ss.str(); @@ -66,7 +65,7 @@ std::string device_addr_t::to_pp_string(void) const{ 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()){ + for(const std::string &key: this->keys()){ args_str += ((count++)? arg_delim : "") + key + pair_delim + this->get(key); } return args_str; @@ -97,7 +96,7 @@ device_addrs_t uhd::separate_device_addr(const device_addr_t &dev_addr){ //------------------------------------------------------------------ device_addrs_t dev_addrs(1); //must be at least one (obviously) std::vector<std::string> global_keys; //keys that apply to all (no numerical suffix) - BOOST_FOREACH(const std::string &key, dev_addr.keys()){ + for(const std::string &key: dev_addr.keys()){ boost::cmatch matches; if (not boost::regex_match(key.c_str(), matches, boost::regex("^(\\D+)(\\d*)$"))){ throw std::runtime_error("unknown key format: " + key); @@ -114,8 +113,8 @@ device_addrs_t uhd::separate_device_addr(const device_addr_t &dev_addr){ } //copy the global settings across all device addresses - BOOST_FOREACH(device_addr_t &my_dev_addr, dev_addrs){ - BOOST_FOREACH(const std::string &global_key, global_keys){ + for(device_addr_t &my_dev_addr: dev_addrs){ + for(const std::string &global_key: global_keys){ my_dev_addr[global_key] = dev_addr[global_key]; } } @@ -125,7 +124,7 @@ device_addrs_t uhd::separate_device_addr(const device_addr_t &dev_addr){ device_addr_t uhd::combine_device_addrs(const device_addrs_t &dev_addrs){ device_addr_t dev_addr; for (size_t i = 0; i < dev_addrs.size(); i++){ - BOOST_FOREACH(const std::string &key, dev_addrs[i].keys()){ + for(const std::string &key: dev_addrs[i].keys()){ dev_addr[str(boost::format("%s%d") % key % i)] = dev_addrs[i][key]; } } diff --git a/host/lib/types/mac_addr.cpp b/host/lib/types/mac_addr.cpp index ab71bc0c3..2e5651558 100644 --- a/host/lib/types/mac_addr.cpp +++ b/host/lib/types/mac_addr.cpp @@ -18,7 +18,6 @@ #include <uhd/types/mac_addr.hpp> #include <uhd/exception.hpp> #include <boost/tokenizer.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <stdint.h> #include <sstream> @@ -45,7 +44,7 @@ mac_addr_t mac_addr_t::from_string(const std::string &mac_addr_str){ //split the mac addr hex string at the colons boost::tokenizer<boost::char_separator<char> > hex_num_toks( mac_addr_str, boost::char_separator<char>(":")); - BOOST_FOREACH(const std::string &hex_str, hex_num_toks){ + for(const std::string &hex_str: hex_num_toks){ int hex_num; std::istringstream iss(hex_str); iss >> std::hex >> hex_num; @@ -68,7 +67,7 @@ byte_vector_t mac_addr_t::to_bytes(void) const{ std::string mac_addr_t::to_string(void) const{ std::string addr = ""; - BOOST_FOREACH(uint8_t byte, this->to_bytes()){ + for(uint8_t byte: this->to_bytes()){ addr += str(boost::format("%s%02x") % ((addr == "")?"":":") % int(byte)); } return addr; diff --git a/host/lib/types/ranges.cpp b/host/lib/types/ranges.cpp index 82a9a84e1..ee4546cb8 100644 --- a/host/lib/types/ranges.cpp +++ b/host/lib/types/ranges.cpp @@ -18,7 +18,6 @@ #include <uhd/types/ranges.hpp> #include <uhd/exception.hpp> #include <boost/math/special_functions/round.hpp> -#include <boost/foreach.hpp> #include <algorithm> #include <sstream> @@ -93,7 +92,7 @@ meta_range_t::meta_range_t( double meta_range_t::start(void) const{ check_meta_range_monotonic(*this); double min_start = this->front().start(); - BOOST_FOREACH(const range_t &r, (*this)){ + for(const range_t &r: (*this)){ min_start = std::min(min_start, r.start()); } return min_start; @@ -102,7 +101,7 @@ double meta_range_t::start(void) const{ double meta_range_t::stop(void) const{ check_meta_range_monotonic(*this); double max_stop = this->front().stop(); - BOOST_FOREACH(const range_t &r, (*this)){ + for(const range_t &r: (*this)){ max_stop = std::max(max_stop, r.stop()); } return max_stop; @@ -112,7 +111,7 @@ double meta_range_t::step(void) const{ check_meta_range_monotonic(*this); std::vector<double> non_zero_steps; range_t last = this->front(); - BOOST_FOREACH(const range_t &r, (*this)){ + for(const range_t &r: (*this)){ //steps at each range if (r.step() > 0) non_zero_steps.push_back(r.step()); //and steps in-between ranges @@ -128,7 +127,7 @@ double meta_range_t::step(void) const{ double meta_range_t::clip(double value, bool clip_step) const{ check_meta_range_monotonic(*this); double last_stop = this->front().stop(); - BOOST_FOREACH(const range_t &r, (*this)){ + for(const range_t &r: (*this)){ //in-between ranges, clip to nearest if (value < r.start()){ return (std::abs(value - r.start()) < std::abs(value - last_stop))? @@ -147,7 +146,7 @@ double meta_range_t::clip(double value, bool clip_step) const{ const std::string meta_range_t::to_pp_string(void) const{ std::stringstream ss; - BOOST_FOREACH(const range_t &r, (*this)){ + for(const range_t &r: (*this)){ ss << r.to_pp_string() << std::endl; } return ss.str(); diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp index 1a38bf3b7..d87d0890d 100644 --- a/host/lib/usrp/b100/b100_impl.cpp +++ b/host/lib/usrp/b100/b100_impl.cpp @@ -73,7 +73,7 @@ static device_addrs_t b100_find(const device_addr_t &hint) //find the usrps and load firmware size_t found = 0; - BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) { + for(usb_device_handle::sptr handle: usb_device_handle::get_device_list(vid, pid)) { //extract the firmware path for the b100 std::string b100_fw_image; try{ @@ -102,7 +102,7 @@ static device_addrs_t b100_find(const device_addr_t &hint) //search for the device until found or timeout while (boost::get_system_time() < timeout_time and b100_addrs.empty() and found != 0) { - BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) + for(usb_device_handle::sptr handle: usb_device_handle::get_device_list(vid, pid)) { usb_control::sptr control; try{control = usb_control::make(handle, 0);} @@ -161,7 +161,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //locate the matching handle in the device list usb_device_handle::sptr handle; - BOOST_FOREACH(usb_device_handle::sptr dev_handle, device_list) { + for(usb_device_handle::sptr dev_handle: device_list) { if (dev_handle->get_serial() == device_addr["serial"]){ handle = dev_handle; break; @@ -478,12 +478,12 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //bind frontend corrections to the dboard freq props const fs_path db_tx_fe_path = mb_path / "dboards" / "A" / "tx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)){ + for(const std::string &name: _tree->list(db_tx_fe_path)){ _tree->access<double>(db_tx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&b100_impl::set_tx_fe_corrections, this, _1)); } const fs_path db_rx_fe_path = mb_path / "dboards" / "A" / "rx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)){ + for(const std::string &name: _tree->list(db_rx_fe_path)){ _tree->access<double>(db_rx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&b100_impl::set_rx_fe_corrections, this, _1)); } @@ -504,10 +504,10 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ .add_coerced_subscriber(boost::bind(&b100_clock_ctrl::set_fpga_clock_rate, _clock_ctrl, _1)); //reset cordic rates and their properties to zero - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "freq" / "value").set(0.0); } - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "tx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "tx_dsps")){ _tree->access<double>(mb_path / "tx_dsps" / name / "freq" / "value").set(0.0); } diff --git a/host/lib/usrp/b100/clock_ctrl.cpp b/host/lib/usrp/b100/clock_ctrl.cpp index 5700a321a..99ad6a052 100644 --- a/host/lib/usrp/b100/clock_ctrl.cpp +++ b/host/lib/usrp/b100/clock_ctrl.cpp @@ -25,7 +25,6 @@ #include <stdint.h> #include "b100_regs.hpp" //spi slave constants #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/thread/thread.hpp> #include <boost/math/common_factor_rt.hpp> //gcd @@ -533,7 +532,7 @@ private: ; //write initial register values and latch/update - BOOST_FOREACH(const range_t &range, ranges){ + for(const range_t &range: ranges){ for(uint16_t addr = range.first; addr <= range.second; addr++){ this->send_reg(addr); } diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp index c1810ed8c..09973491c 100644 --- a/host/lib/usrp/b100/io_impl.cpp +++ b/host/lib/usrp/b100/io_impl.cpp @@ -36,10 +36,10 @@ void b100_impl::update_rates(void){ _tree->access<double>(mb_path / "tick_rate").update(); //and now that the tick rate is set, init the host rates to something - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "rate" / "value").update(); } - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "tx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "tx_dsps")){ _tree->access<double>(mb_path / "tx_dsps" / name / "rate" / "value").update(); } } diff --git a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp index d57d57f21..568b7add9 100644 --- a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp +++ b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp @@ -21,7 +21,6 @@ #include <uhd/utils/msg.hpp> #include <uhd/utils/tasks.hpp> #include <uhd/utils/atomic.hpp> -#include <boost/foreach.hpp> #include <boost/make_shared.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/condition_variable.hpp> diff --git a/host/lib/usrp/b200/b200_image_loader.cpp b/host/lib/usrp/b200/b200_image_loader.cpp index b9c2c0caf..af79a59fc 100644 --- a/host/lib/usrp/b200/b200_image_loader.cpp +++ b/host/lib/usrp/b200/b200_image_loader.cpp @@ -16,7 +16,6 @@ // #include <boost/assign.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <uhd/exception.hpp> @@ -45,7 +44,7 @@ static b200_iface::sptr get_b200_iface(const image_loader::image_loader_args_t& mboard_eeprom_t eeprom; // Internal use if(dev_handles.size() > 0){ - BOOST_FOREACH(usb_device_handle::sptr dev_handle, dev_handles){ + for(usb_device_handle::sptr dev_handle: dev_handles){ if(dev_handle->firmware_loaded()){ iface = b200_iface::make(usb_control::make(dev_handle,0)); eeprom = mboard_eeprom_t(*iface, "B200"); @@ -74,7 +73,7 @@ static b200_iface::sptr get_b200_iface(const image_loader::image_loader_args_t& std::string err_msg = "Could not resolve given args to a single B2XX device.\n" "Applicable devices:\n"; - BOOST_FOREACH(usb_device_handle::sptr dev_handle, applicable_dev_handles){ + for(usb_device_handle::sptr dev_handle: applicable_dev_handles){ eeprom = mboard_eeprom_t(*b200_iface::make(usb_control::make(dev_handle,0)), "B200"); err_msg += str(boost::format(" * %s (serial=%s)\n") % B2XX_STR_NAMES.get(get_b200_product(dev_handle, mb_eeprom), "B2XX") diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index e2a0e0b70..62f0c2f59 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -172,7 +172,7 @@ static device_addrs_t b200_find(const device_addr_t &hint) //Return an empty list of addresses when an address or resource is specified, //since an address and resource is intended for a different, non-USB, device. - BOOST_FOREACH(device_addr_t hint_i, separate_device_addr(hint)) { + for(device_addr_t hint_i: separate_device_addr(hint)) { if (hint_i.has_key("addr") || hint_i.has_key("resource")) return b200_addrs; } @@ -182,7 +182,7 @@ static device_addrs_t b200_find(const device_addr_t &hint) // so that re-enumeration after fw load can occur successfully. // This requirement is a courtesy of libusb1.0 on windows. size_t found = 0; - BOOST_FOREACH(usb_device_handle::sptr handle, get_b200_device_handles(hint)) { + for(usb_device_handle::sptr handle: get_b200_device_handles(hint)) { //extract the firmware path for the b200 std::string b200_fw_image; try{ @@ -213,7 +213,7 @@ static device_addrs_t b200_find(const device_addr_t &hint) //search for the device until found or timeout while (boost::get_system_time() < timeout_time and b200_addrs.empty() and found != 0) { - BOOST_FOREACH(usb_device_handle::sptr handle, get_b200_device_handles(hint)) + for(usb_device_handle::sptr handle: get_b200_device_handles(hint)) { usb_control::sptr control; try{control = usb_control::make(handle, 0);} @@ -344,7 +344,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s std::vector<usb_device_handle::sptr> device_list = usb_device_handle::get_device_list(vid_pid_pair_list); //locate the matching handle in the device list - BOOST_FOREACH(usb_device_handle::sptr dev_handle, device_list) { + for(usb_device_handle::sptr dev_handle: device_list) { try { if (dev_handle->get_serial() == device_addr["serial"]){ handle = dev_handle; @@ -500,7 +500,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s if (_gps and _gps->gps_detected()) { //UHD_MSG(status) << "found" << std::endl; - BOOST_FOREACH(const std::string &name, _gps->get_sensors()) + for(const std::string &name: _gps->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&gps_ctrl::get_sensor, _gps, name)); @@ -621,7 +621,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s this->setup_radio(i); //now test each radio module's connection to the codec interface - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { _codec_mgr->loopback_self_test( boost::bind( @@ -641,7 +641,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s .add_coerced_subscriber(boost::bind(&b200_impl::sync_times, this)); _tree->create<time_spec_t>(mb_path / "time" / "pps") .set_publisher(boost::bind(&time_core_3000::get_time_last_pps, _radio_perifs[0].time64)); - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { _tree->access<time_spec_t>(mb_path / "time" / "pps") .add_coerced_subscriber(boost::bind(&time_core_3000::set_time_next_pps, perif.time64, _1)); @@ -670,7 +670,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s // front panel gpio //////////////////////////////////////////////////////////////////// _radio_perifs[0].fp_gpio = gpio_atr_3000::make(_radio_perifs[0].ctrl, TOREG(SR_FP_GPIO), RB32_FP_GPIO); - BOOST_FOREACH(const gpio_attr_map_t::value_type attr, gpio_attr_map) + for(const gpio_attr_map_t::value_type attr: gpio_attr_map) { _tree->create<uint32_t>(mb_path / "gpio" / "FP0" / attr.second) .set(0) @@ -701,11 +701,11 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s //subdev spec contains full width of selections subdev_spec_t rx_spec, tx_spec; - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) { rx_spec.push_back(subdev_spec_pair_t("A", fe)); } - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) { tx_spec.push_back(subdev_spec_pair_t("A", fe)); } @@ -830,7 +830,7 @@ void b200_impl::setup_radio(const size_t dspno) // create RF frontend interfacing //////////////////////////////////////////////////////////////////// static const std::vector<direction_t> dirs = boost::assign::list_of(RX_DIRECTION)(TX_DIRECTION); - BOOST_FOREACH(direction_t dir, dirs) { + for(direction_t dir: dirs) { const std::string x = (dir == RX_DIRECTION) ? "rx" : "tx"; const std::string key = std::string(((dir == RX_DIRECTION) ? "RX" : "TX")) + std::string(((dspno == _fe1) ? "1" : "2")); const fs_path rf_fe_path @@ -932,7 +932,7 @@ double b200_impl::set_tick_rate(const double new_tick_rate) _tick_rate = _codec_ctrl->set_clock_rate(new_tick_rate); UHD_MSG(status) << std::endl << (boost::format("Actually got clock rate %.6f MHz.") % (_tick_rate/1e6)) << std::endl; - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { perif.time64->set_tick_rate(_tick_rate); perif.time64->self_test(); @@ -1088,7 +1088,7 @@ void b200_impl::update_time_source(const std::string &source) void b200_impl::set_time(const uhd::time_spec_t& t) { - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) perif.time64->set_time_sync(t); _local_ctrl->poke32(TOREG(SR_CORE_SYNC), 1 << 2 | uint32_t(_time_source)); _local_ctrl->poke32(TOREG(SR_CORE_SYNC), _time_source); diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index 0a00b9402..09aaff7ed 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -45,7 +45,7 @@ void b200_impl::check_tick_rate_with_current_streamers(double rate) size_t b200_impl::max_chan_count(const std::string &direction /* = "" */) { size_t max_count = 0; - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { if ((direction == "RX" or direction.empty()) and not perif.rx_streamer.expired()) { boost::shared_ptr<sph::recv_packet_streamer> rx_streamer = @@ -97,7 +97,7 @@ void b200_impl::set_auto_tick_rate( for (int i = 0; i < 2; i++) { // Loop through rx and tx std::string dir = (i == 0) ? "tx" : "rx"; // We assume all 'set' DSPs are being used. - BOOST_FOREACH(const std::string &dsp_no, _tree->list(str(boost::format("/mboards/0/%s_dsps") % dir))) { + for(const std::string &dsp_no: _tree->list(str(boost::format("/mboards/0/%s_dsps") % dir))) { fs_path dsp_path = str(boost::format("/mboards/0/%s_dsps/%s") % dir % dsp_no); if (dsp_path == tree_dsp_path) { continue; @@ -146,14 +146,14 @@ void b200_impl::update_tick_rate(const double new_tick_rate) { check_tick_rate_with_current_streamers(new_tick_rate); - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::recv_packet_streamer>(perif.rx_streamer.lock()); if (my_streamer) my_streamer->set_tick_rate(new_tick_rate); perif.framer->set_tick_rate(new_tick_rate); } - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { boost::shared_ptr<sph::send_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::send_packet_streamer>(perif.tx_streamer.lock()); diff --git a/host/lib/usrp/b200/b200_uart.cpp b/host/lib/usrp/b200/b200_uart.cpp index 3c49ebf2a..016dd4ca3 100644 --- a/host/lib/usrp/b200/b200_uart.cpp +++ b/host/lib/usrp/b200/b200_uart.cpp @@ -23,7 +23,6 @@ #include <uhd/utils/msg.hpp> #include <uhd/types/time_spec.hpp> #include <uhd/exception.hpp> -#include <boost/foreach.hpp> using namespace uhd; using namespace uhd::transport; @@ -69,7 +68,7 @@ struct b200_uart_impl : b200_uart void write_uart(const std::string &buff) { - BOOST_FOREACH(const char ch, buff) + for(const char ch: buff) { this->send_char(ch); } diff --git a/host/lib/usrp/common/ad936x_manager.cpp b/host/lib/usrp/common/ad936x_manager.cpp index 2b6d69c15..20e06a072 100644 --- a/host/lib/usrp/common/ad936x_manager.cpp +++ b/host/lib/usrp/common/ad936x_manager.cpp @@ -17,7 +17,6 @@ #include "ad936x_manager.hpp" #include <uhd/utils/msg.hpp> -#include <boost/foreach.hpp> #include <boost/functional/hash.hpp> #include <boost/thread/thread.hpp> @@ -66,7 +65,7 @@ class ad936x_manager_impl : public ad936x_manager ***********************************************************************/ void init_codec() { - BOOST_FOREACH(const std::string &rx_fe, _rx_frontends) { + for(const std::string &rx_fe: _rx_frontends) { _codec_ctrl->set_gain(rx_fe, DEFAULT_GAIN); _codec_ctrl->set_bw_filter(rx_fe, DEFAULT_BANDWIDTH); _codec_ctrl->tune(rx_fe, DEFAULT_FREQ); @@ -74,7 +73,7 @@ class ad936x_manager_impl : public ad936x_manager _codec_ctrl->set_iq_balance_auto(rx_fe, DEFAULT_AUTO_IQ_BALANCE); _codec_ctrl->set_agc(rx_fe, DEFAULT_AGC_ENABLE); } - BOOST_FOREACH(const std::string &tx_fe, _tx_frontends) { + for(const std::string &tx_fe: _tx_frontends) { _codec_ctrl->set_gain(tx_fe, DEFAULT_GAIN); _codec_ctrl->set_bw_filter(tx_fe, DEFAULT_BANDWIDTH); _codec_ctrl->tune(tx_fe, DEFAULT_FREQ); @@ -218,7 +217,7 @@ class ad936x_manager_impl : public ad936x_manager } // Gains - BOOST_FOREACH(const std::string &name, ad9361_ctrl::get_gain_names(key)) + for(const std::string &name: ad9361_ctrl::get_gain_names(key)) { subtree->create<meta_range_t>(uhd::fs_path("gains") / name / "range") .set(ad9361_ctrl::get_gain_range(key)); @@ -278,7 +277,7 @@ class ad936x_manager_impl : public ad936x_manager } // Frontend filters - BOOST_FOREACH(const std::string &filter_name, _codec_ctrl->get_filter_names(key)) { + for(const std::string &filter_name: _codec_ctrl->get_filter_names(key)) { subtree->create<filter_info_base::sptr>(uhd::fs_path("filters") / filter_name / "value" ) .set_publisher(boost::bind(&ad9361_ctrl::get_filter, _codec_ctrl, key, filter_name)) .add_coerced_subscriber(boost::bind(&ad9361_ctrl::set_filter, _codec_ctrl, key, filter_name, _1)); diff --git a/host/lib/usrp/common/apply_corrections.cpp b/host/lib/usrp/common/apply_corrections.cpp index 272e0e093..f1ba47bd9 100644 --- a/host/lib/usrp/common/apply_corrections.cpp +++ b/host/lib/usrp/common/apply_corrections.cpp @@ -22,7 +22,6 @@ #include <uhd/utils/csv.hpp> #include <uhd/types/dict.hpp> #include <boost/filesystem.hpp> -#include <boost/foreach.hpp> #include <boost/thread/mutex.hpp> #include <cstdio> #include <complex> @@ -114,7 +113,7 @@ static void apply_fe_corrections( bool read_data = false, skip_next = false;; std::vector<fe_cal_t> datas; - BOOST_FOREACH(const uhd::csv::row_type &row, rows){ + for(const uhd::csv::row_type &row: rows){ if (not read_data and not row.empty() and row[0] == "DATA STARTS HERE"){ read_data = true; skip_next = true; diff --git a/host/lib/usrp/common/constrained_device_args.hpp b/host/lib/usrp/common/constrained_device_args.hpp index 1bfd1df00..47c5f4cc0 100644 --- a/host/lib/usrp/common/constrained_device_args.hpp +++ b/host/lib/usrp/common/constrained_device_args.hpp @@ -260,7 +260,7 @@ namespace usrp { template<typename arg_t, typename data_t> static inline void _enforce_discrete(const arg_t& arg, const std::vector<data_t>& valid_values) { bool match = false; - BOOST_FOREACH(const data_t& val, valid_values) { + for(const data_t& val: valid_values) { if (val == arg.get()) { match = true; break; diff --git a/host/lib/usrp/common/max287x.hpp b/host/lib/usrp/common/max287x.hpp index 9022e0f02..df6f6bc26 100644 --- a/host/lib/usrp/common/max287x.hpp +++ b/host/lib/usrp/common/max287x.hpp @@ -402,7 +402,7 @@ public: while (vco_freq < MIN_VCO_FREQ) vco_freq *=2; uint8_t vco_index = 0xFF; - BOOST_FOREACH(const vco_map_t::value_type &vco, max2871_vco_map) + for(const vco_map_t::value_type &vco: max2871_vco_map) { if (uhd::math::fp_compare::fp_compare_epsilon<double>(vco_freq) < vco.second.stop()) { diff --git a/host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp b/host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp index 16ee84140..35758d4dd 100644 --- a/host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp +++ b/host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp @@ -22,7 +22,6 @@ #include <uhd/exception.hpp> #include <boost/format.hpp> #include <boost/asio.hpp> //used for htonl and ntohl -#include <boost/foreach.hpp> #include "fw_comm_protocol.h" namespace uhd { namespace usrp { namespace usrp3 { diff --git a/host/lib/usrp/common/validate_subdev_spec.cpp b/host/lib/usrp/common/validate_subdev_spec.cpp index fab40b204..76e61221e 100644 --- a/host/lib/usrp/common/validate_subdev_spec.cpp +++ b/host/lib/usrp/common/validate_subdev_spec.cpp @@ -18,7 +18,6 @@ #include "validate_subdev_spec.hpp" #include <uhd/exception.hpp> #include <uhd/utils/assert_has.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> using namespace uhd; @@ -52,19 +51,19 @@ void uhd::usrp::validate_subdev_spec( //make a list of all possible specs subdev_spec_t all_specs; - BOOST_FOREACH(const std::string &db, tree->list(str(boost::format("/mboards/%s/dboards") % mb))){ - BOOST_FOREACH(const std::string &sd, tree->list(str(boost::format("/mboards/%s/dboards/%s/%s_frontends") % mb % db % type))){ + for(const std::string &db: tree->list(str(boost::format("/mboards/%s/dboards") % mb))){ + for(const std::string &sd: tree->list(str(boost::format("/mboards/%s/dboards/%s/%s_frontends") % mb % db % type))){ all_specs.push_back(subdev_spec_pair_t(db, sd)); } } //validate that the spec is possible - BOOST_FOREACH(const subdev_spec_pair_t &pair, spec){ + for(const subdev_spec_pair_t &pair: spec){ uhd::assert_has(all_specs, pair, str(boost::format("%s subdevice specification on mboard %s") % type % mb)); } //enable selected frontends, disable others - BOOST_FOREACH(const subdev_spec_pair_t &pair, all_specs){ + for(const subdev_spec_pair_t &pair: all_specs){ const bool enb = uhd::has(spec, pair); tree->access<bool>(str(boost::format( "/mboards/%s/dboards/%s/%s_frontends/%s/enabled" diff --git a/host/lib/usrp/dboard/db_cbx.cpp b/host/lib/usrp/dboard/db_cbx.cpp index c27cbf58a..05f8846d6 100644 --- a/host/lib/usrp/dboard/db_cbx.cpp +++ b/host/lib/usrp/dboard/db_cbx.cpp @@ -40,7 +40,7 @@ sbx_xcvr::cbx::~cbx(void){ void sbx_xcvr::cbx::write_lo_regs(dboard_iface::unit_t unit, const std::vector<uint32_t> ®s) { - BOOST_FOREACH(uint32_t reg, regs) + for(uint32_t reg: regs) { self_base->get_iface()->write_spi(unit, spi_config_t::EDGE_RISE, reg, 32); } diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index f296820c5..2862f97dc 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -205,7 +205,7 @@ dbsrx::dbsrx(ctor_args_t args) : rx_dboard_base(args){ .set("DBSRX"); this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&dbsrx::get_locked, this)); - BOOST_FOREACH(const std::string &name, dbsrx_gain_ranges.keys()){ + for(const std::string &name: dbsrx_gain_ranges.keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&dbsrx::set_gain, this, _1, name)) .set(dbsrx_gain_ranges[name].start()); @@ -266,7 +266,7 @@ double dbsrx::set_lo_freq(double target_freq){ //choose refclock std::vector<double> clock_rates = this->get_iface()->get_clock_rates(dboard_iface::UNIT_RX); const double max_clock_rate = uhd::sorted(clock_rates).back(); - BOOST_FOREACH(ref_clock, uhd::reversed(uhd::sorted(clock_rates))){ + for(auto ref_clock: uhd::reversed(uhd::sorted(clock_rates))){ //USRP1 feeds the DBSRX clock from a FPGA GPIO line. //make sure that this clock does not exceed rate limit. if (this->get_iface()->get_special_props().soft_clock_divider){ @@ -286,7 +286,7 @@ double dbsrx::set_lo_freq(double target_freq){ if (m >= 32) continue; //choose R - for(r = 0; r <= 6; r += 1) { + for(auto r = 0; r <= 6; r += 1) { //compute divider from setting R = 1 << (r+1); UHD_LOGV(often) << boost::format("DBSRX R:%d\n") % R << std::endl; diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index 21b0fd02d..544671d3b 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -192,7 +192,7 @@ dbsrx2::dbsrx2(ctor_args_t args) : rx_dboard_base(args){ .set("DBSRX2"); this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&dbsrx2::get_locked, this)); - BOOST_FOREACH(const std::string &name, dbsrx2_gain_ranges.keys()){ + for(const std::string &name: dbsrx2_gain_ranges.keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&dbsrx2::set_gain, this, _1, name)) .set(dbsrx2_gain_ranges[name].start()); diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 9bbd73425..3982ba224 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -184,7 +184,7 @@ rfx_xcvr::rfx_xcvr( this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&rfx_xcvr::get_locked, this, dboard_iface::UNIT_RX)); - BOOST_FOREACH(const std::string &name, _rx_gain_ranges.keys()){ + for(const std::string &name: _rx_gain_ranges.keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&rfx_xcvr::set_rx_gain, this, _1, name)) .set(_rx_gain_ranges[name].start()); @@ -379,9 +379,9 @@ double rfx_xcvr::set_lo_freq( * fvco*R/fref = P*B + A = N */ for(R = 2; R <= 32; R+=2){ - BOOST_FOREACH(BS, bandsel_to_enum.keys()){ + for(auto BS: bandsel_to_enum.keys()){ if (ref_freq/R/BS > 1e6) continue; //constraint on band select clock - BOOST_FOREACH(P, prescaler_to_enum.keys()){ + for(auto P: prescaler_to_enum.keys()){ //calculate B and A from N double N = target_freq*R/ref_freq; B = int(std::floor(N/P)); @@ -433,7 +433,7 @@ double rfx_xcvr::set_lo_freq( (adf4360_regs_t::ADDR_CONTROL) (adf4360_regs_t::ADDR_NCOUNTER) ; - BOOST_FOREACH(adf4360_regs_t::addr_t addr, addrs){ + for(adf4360_regs_t::addr_t addr: addrs){ this->get_iface()->write_spi( unit, spi_config_t::EDGE_RISE, regs.get_reg(addr), 24 diff --git a/host/lib/usrp/dboard/db_sbx_common.cpp b/host/lib/usrp/dboard/db_sbx_common.cpp index efc84d7e6..ab7eb2566 100644 --- a/host/lib/usrp/dboard/db_sbx_common.cpp +++ b/host/lib/usrp/dboard/db_sbx_common.cpp @@ -160,7 +160,7 @@ sbx_xcvr::sbx_xcvr(ctor_args_t args) : xcvr_dboard_base(args){ this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&sbx_xcvr::get_locked, this, dboard_iface::UNIT_RX)); - BOOST_FOREACH(const std::string &name, sbx_rx_gain_ranges.keys()){ + for(const std::string &name: sbx_rx_gain_ranges.keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&sbx_xcvr::set_rx_gain, this, _1, name)) .set(sbx_rx_gain_ranges[name].start()); @@ -201,7 +201,7 @@ sbx_xcvr::sbx_xcvr(ctor_args_t args) : xcvr_dboard_base(args){ this->get_tx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&sbx_xcvr::get_locked, this, dboard_iface::UNIT_TX)); - BOOST_FOREACH(const std::string &name, sbx_tx_gain_ranges.keys()){ + for(const std::string &name: sbx_tx_gain_ranges.keys()){ this->get_tx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&sbx_xcvr::set_tx_gain, this, _1, name)) .set(sbx_tx_gain_ranges[name].start()); diff --git a/host/lib/usrp/dboard/db_sbx_version3.cpp b/host/lib/usrp/dboard/db_sbx_version3.cpp index bb2ba6bd6..91a1b6a53 100644 --- a/host/lib/usrp/dboard/db_sbx_version3.cpp +++ b/host/lib/usrp/dboard/db_sbx_version3.cpp @@ -40,7 +40,7 @@ sbx_xcvr::sbx_version3::~sbx_version3(void){ void sbx_xcvr::sbx_version3::write_lo_regs(dboard_iface::unit_t unit, const std::vector<uint32_t> ®s) { - BOOST_FOREACH(uint32_t reg, regs) + for(uint32_t reg: regs) { self_base->get_iface()->write_spi(unit, spi_config_t::EDGE_RISE, reg, 32); } diff --git a/host/lib/usrp/dboard/db_sbx_version4.cpp b/host/lib/usrp/dboard/db_sbx_version4.cpp index e5b6e081c..6521285ea 100644 --- a/host/lib/usrp/dboard/db_sbx_version4.cpp +++ b/host/lib/usrp/dboard/db_sbx_version4.cpp @@ -41,7 +41,7 @@ sbx_xcvr::sbx_version4::~sbx_version4(void){ void sbx_xcvr::sbx_version4::write_lo_regs(dboard_iface::unit_t unit, const std::vector<uint32_t> ®s) { - BOOST_FOREACH(uint32_t reg, regs) + for(uint32_t reg: regs) { self_base->get_iface()->write_spi(unit, spi_config_t::EDGE_RISE, reg, 32); } diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index 5c0600c61..5b25883f8 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -107,7 +107,7 @@ static const boost::array<double, 17> tvrx_gains_volts = static uhd::dict<std::string, gain_range_t> get_tvrx_gain_ranges(void) { double rfmax = 0.0, rfmin = FLT_MAX; - BOOST_FOREACH(const std::string range, tvrx_rf_gains_db.keys()) { + for(const std::string range: tvrx_rf_gains_db.keys()) { double my_max = tvrx_rf_gains_db[range].back(); //we're assuming it's monotonic double my_min = tvrx_rf_gains_db[range].front(); //if it's not this is wrong wrong wrong if(my_max > rfmax) rfmax = my_max; @@ -188,7 +188,7 @@ tvrx::tvrx(ctor_args_t args) : rx_dboard_base(args){ this->get_rx_subtree()->create<std::string>("name") .set("TVRX"); this->get_rx_subtree()->create<int>("sensors"); //phony property so this dir exists - BOOST_FOREACH(const std::string &name, get_tvrx_gain_ranges().keys()){ + for(const std::string &name: get_tvrx_gain_ranges().keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&tvrx::set_gain, this, _1, name)); this->get_rx_subtree()->create<meta_range_t>("gains/"+name+"/range") @@ -232,7 +232,7 @@ tvrx::tvrx(ctor_args_t args) : rx_dboard_base(args){ this->get_rx_subtree()->access<double>("freq/value").set(tvrx_freq_range.start()); //set default gains - BOOST_FOREACH(const std::string &name, get_tvrx_gain_ranges().keys()){ + for(const std::string &name: get_tvrx_gain_ranges().keys()){ this->get_rx_subtree()->access<double>("gains/"+name+"/value") .set(get_tvrx_gain_ranges()[name].start()); } @@ -247,7 +247,7 @@ tvrx::~tvrx(void){ */ static std::string get_band(double freq) { - BOOST_FOREACH(const std::string &band, tvrx_freq_ranges.keys()) { + for(const std::string &band: tvrx_freq_ranges.keys()) { if(freq >= tvrx_freq_ranges[band].start() && freq <= tvrx_freq_ranges[band].stop()){ UHD_LOGV(often) << "Band: " << band << std::endl; return band; diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp index 1bac81153..3ba581b0f 100644 --- a/host/lib/usrp/dboard/db_tvrx2.cpp +++ b/host/lib/usrp/dboard/db_tvrx2.cpp @@ -962,7 +962,7 @@ tvrx2::tvrx2(ctor_args_t args) : rx_dboard_base(args){ .set_publisher(boost::bind(&tvrx2::get_rssi, this)); this->get_rx_subtree()->create<sensor_value_t>("sensors/temperature") .set_publisher(boost::bind(&tvrx2::get_temp, this)); - BOOST_FOREACH(const std::string &name, tvrx2_gain_ranges.keys()){ + for(const std::string &name: tvrx2_gain_ranges.keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&tvrx2::set_gain, this, _1, name)); this->get_rx_subtree()->create<meta_range_t>("gains/"+name+"/range") @@ -1066,7 +1066,7 @@ bool tvrx2::set_enabled(bool enable){ test_rf_filter_robustness(); - BOOST_FOREACH(const std::string &name, tvrx2_gain_ranges.keys()){ + for(const std::string &name: tvrx2_gain_ranges.keys()){ this->get_rx_subtree()->access<double>("gains/"+name+"/value") .set(tvrx2_gain_ranges[name].start()); } @@ -1271,14 +1271,14 @@ void tvrx2::tvrx2_tda18272_init_rfcal(void) // Loop through rfcal_log_* registers, initialize _rfcal_results - BOOST_FOREACH(const uint32_t &result, result_to_cal_regs.keys()) + for(const uint32_t &result: result_to_cal_regs.keys()) _rfcal_results[result].delta_c = result_to_cal_regs[result] > 63 ? result_to_cal_regs[result] - 128 : result_to_cal_regs[result]; /* read byte 0x26-0x2B */ read_reg(0x26, 0x2B); // Loop through rfcal_byte_* registers, initialize _rfcal_coeffs - BOOST_FOREACH(const uint32_t &subband, _rfcal_coeffs.keys()) + for(const uint32_t &subband: _rfcal_coeffs.keys()) { freq_range_t subband_freqs; @@ -1473,7 +1473,7 @@ void tvrx2::test_rf_filter_robustness(void){ ("UHFHigh_1", 0x43) ; - BOOST_FOREACH(const std::string &name, filter_cal_regs.keys()){ + for(const std::string &name: filter_cal_regs.keys()){ uint8_t cal_result = _tda18272hnm_regs.get_reg(filter_cal_regs[name]); if (cal_result & 0x80) { _filter_ratings.set(name, "E"); @@ -1516,7 +1516,7 @@ void tvrx2::test_rf_filter_robustness(void){ std::stringstream robustness_message; robustness_message << boost::format("TVRX2 (%s): RF Filter Robustness Results:") % (get_subdev_name()) << std::endl; - BOOST_FOREACH(const std::string &name, uhd::sorted(_filter_ratings.keys())){ + for(const std::string &name: uhd::sorted(_filter_ratings.keys())){ robustness_message << boost::format("\t%s:\tMargin = %0.2f,\tRobustness = %c") % name % (_filter_margins[name]) % (_filter_ratings[name]) << std::endl; } diff --git a/host/lib/usrp/dboard/db_twinrx.cpp b/host/lib/usrp/dboard/db_twinrx.cpp index 2af6bc4ff..91b38f90c 100644 --- a/host/lib/usrp/dboard/db_twinrx.cpp +++ b/host/lib/usrp/dboard/db_twinrx.cpp @@ -265,7 +265,7 @@ public: // Add workers to expert //--------------------------------------------------------- //Channel (front-end) specific - BOOST_FOREACH(const std::string& fe, _fe_names) { + for(const std::string& fe: _fe_names) { expert_factory::add_worker_node<twinrx_freq_path_expert>(_expert, _expert->node_retriever(), fe); expert_factory::add_worker_node<twinrx_freq_coercion_expert>(_expert, _expert->node_retriever(), fe); expert_factory::add_worker_node<twinrx_chan_gain_expert>(_expert, _expert->node_retriever(), fe); diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index 3dd0b1c84..2f3c1ebe7 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -300,7 +300,7 @@ public: { std::vector<double> rates = _iface->get_clock_rates(dboard_iface::UNIT_RX); double highest_rate = 0.0; - BOOST_FOREACH(double rate, rates) + for(double rate: rates) { if (rate <= pfd_freq_max and rate > highest_rate) highest_rate = rate; @@ -312,7 +312,7 @@ public: { std::vector<double> rates = _iface->get_clock_rates(dboard_iface::UNIT_TX); double highest_rate = 0.0; - BOOST_FOREACH(double rate, rates) + for(double rate: rates) { if (rate <= pfd_freq_max and rate > highest_rate) highest_rate = rate; @@ -370,7 +370,7 @@ public: _rxlo1 = max287x_iface::make<max2870>(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO1, _1)); _rxlo2 = max287x_iface::make<max2870>(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO2, _1)); std::vector<max287x_iface::sptr> los = boost::assign::list_of(_txlo1)(_txlo2)(_rxlo1)(_rxlo2); - BOOST_FOREACH(max287x_iface::sptr lo, los) + for(max287x_iface::sptr lo: los) { lo->set_auto_retune(false); lo->set_muxout_mode(max287x_iface::MUXOUT_DLD); @@ -384,7 +384,7 @@ public: _rxlo1 = max287x_iface::make<max2871>(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO1, _1)); _rxlo2 = max287x_iface::make<max2871>(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO2, _1)); std::vector<max287x_iface::sptr> los = boost::assign::list_of(_txlo1)(_txlo2)(_rxlo1)(_rxlo2); - BOOST_FOREACH(max287x_iface::sptr lo, los) + for(max287x_iface::sptr lo: los) { lo->set_auto_retune(false); //lo->set_cycle_slip_mode(true); // tried it - caused longer lock times @@ -547,7 +547,7 @@ private: { boost::mutex::scoped_lock lock(_spi_mutex); ROUTE_SPI(_iface, dest); - BOOST_FOREACH(uint32_t value, values) + for(uint32_t value: values) WRITE_SPI(_iface, value); } diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp index 2ed50cd91..7e1c20a9e 100644 --- a/host/lib/usrp/dboard/db_unknown.cpp +++ b/host/lib/usrp/dboard/db_unknown.cpp @@ -23,7 +23,6 @@ #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/tuple/tuple.hpp> #include <vector> @@ -43,7 +42,7 @@ static void warn_if_old_rfx(const dboard_id_t &dboard_id, const std::string &xx) (old_ids_t("Flex 1800 Classic", 0x0030, 0x0031)) (old_ids_t("Flex 2400 Classic", 0x0007, 0x000b)) ; - BOOST_FOREACH(const old_ids_t &old_id, old_rfx_ids){ + for(const old_ids_t &old_id: old_rfx_ids){ std::string name; dboard_id_t rx_id, tx_id; boost::tie(name, rx_id, tx_id) = old_id; if ( diff --git a/host/lib/usrp/dboard/db_wbx_common.cpp b/host/lib/usrp/dboard/db_wbx_common.cpp index 5afbb1f88..1ad6ad45b 100644 --- a/host/lib/usrp/dboard/db_wbx_common.cpp +++ b/host/lib/usrp/dboard/db_wbx_common.cpp @@ -70,7 +70,7 @@ wbx_base::wbx_base(ctor_args_t args) : xcvr_dboard_base(args){ this->get_rx_subtree()->create<device_addr_t>("tune_args").set(device_addr_t()); this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&wbx_base::get_locked, this, dboard_iface::UNIT_RX)); - BOOST_FOREACH(const std::string &name, wbx_rx_gain_ranges.keys()){ + for(const std::string &name: wbx_rx_gain_ranges.keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&wbx_base::set_rx_gain, this, _1, name)) .set(wbx_rx_gain_ranges[name].start()); @@ -158,7 +158,7 @@ sensor_value_t wbx_base::get_locked(dboard_iface::unit_t unit){ } void wbx_base::wbx_versionx::write_lo_regs(dboard_iface::unit_t unit, const std::vector<uint32_t> ®s) { - BOOST_FOREACH(uint32_t reg, regs) { + for(uint32_t reg: regs) { self_base->get_iface()->write_spi(unit, spi_config_t::EDGE_RISE, reg, 32); } } diff --git a/host/lib/usrp/dboard/db_wbx_version2.cpp b/host/lib/usrp/dboard/db_wbx_version2.cpp index 489291881..319434c3a 100644 --- a/host/lib/usrp/dboard/db_wbx_version2.cpp +++ b/host/lib/usrp/dboard/db_wbx_version2.cpp @@ -91,7 +91,7 @@ wbx_base::wbx_version2::wbx_version2(wbx_base *_self_wbx_base) { // Register TX properties //////////////////////////////////////////////////////////////////// this->get_tx_subtree()->create<std::string>("name").set("WBXv2 TX"); - BOOST_FOREACH(const std::string &name, wbx_v2_tx_gain_ranges.keys()){ + for(const std::string &name: wbx_v2_tx_gain_ranges.keys()){ self_base->get_tx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&wbx_base::wbx_version2::set_tx_gain, this, _1, name)) .set(wbx_v2_tx_gain_ranges[name].start()); diff --git a/host/lib/usrp/dboard/db_wbx_version3.cpp b/host/lib/usrp/dboard/db_wbx_version3.cpp index 1bd326e6f..cb7616e26 100644 --- a/host/lib/usrp/dboard/db_wbx_version3.cpp +++ b/host/lib/usrp/dboard/db_wbx_version3.cpp @@ -96,7 +96,7 @@ wbx_base::wbx_version3::wbx_version3(wbx_base *_self_wbx_base) { // Register TX properties //////////////////////////////////////////////////////////////////// this->get_tx_subtree()->create<std::string>("name").set("WBXv3 TX"); - BOOST_FOREACH(const std::string &name, wbx_v3_tx_gain_ranges.keys()){ + for(const std::string &name: wbx_v3_tx_gain_ranges.keys()){ self_base->get_tx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&wbx_base::wbx_version3::set_tx_gain, this, _1, name)) .set(wbx_v3_tx_gain_ranges[name].start()); diff --git a/host/lib/usrp/dboard/db_wbx_version4.cpp b/host/lib/usrp/dboard/db_wbx_version4.cpp index 3cc0f1887..8db03b961 100644 --- a/host/lib/usrp/dboard/db_wbx_version4.cpp +++ b/host/lib/usrp/dboard/db_wbx_version4.cpp @@ -103,7 +103,7 @@ wbx_base::wbx_version4::wbx_version4(wbx_base *_self_wbx_base) { //get_tx_id() will always return GDB ID, so use RX ID to determine WBXv4 vs. WBX-120 if(rx_id == 0x0063) this->get_tx_subtree()->create<std::string>("name").set("WBXv4 TX"); else if(rx_id == 0x0081) this->get_tx_subtree()->create<std::string>("name").set("WBX-120 TX"); - BOOST_FOREACH(const std::string &name, wbx_v4_tx_gain_ranges.keys()){ + for(const std::string &name: wbx_v4_tx_gain_ranges.keys()){ self_base->get_tx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&wbx_base::wbx_version4::set_tx_gain, this, _1, name)) .set(wbx_v4_tx_gain_ranges[name].start()); diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index 6876ee4be..63053e326 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -234,7 +234,7 @@ xcvr2450::xcvr2450(ctor_args_t args) : xcvr_dboard_base(args){ .set_publisher(boost::bind(&xcvr2450::get_locked, this)); this->get_rx_subtree()->create<sensor_value_t>("sensors/rssi") .set_publisher(boost::bind(&xcvr2450::get_rssi, this)); - BOOST_FOREACH(const std::string &name, xcvr_rx_gain_ranges.keys()){ + for(const std::string &name: xcvr_rx_gain_ranges.keys()){ this->get_rx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&xcvr2450::set_rx_gain, this, _1, name)) .set(xcvr_rx_gain_ranges[name].start()); @@ -270,7 +270,7 @@ xcvr2450::xcvr2450(ctor_args_t args) : xcvr_dboard_base(args){ .set("XCVR2450 TX"); this->get_tx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&xcvr2450::get_locked, this)); - BOOST_FOREACH(const std::string &name, xcvr_tx_gain_ranges.keys()){ + for(const std::string &name: xcvr_tx_gain_ranges.keys()){ this->get_tx_subtree()->create<double>("gains/"+name+"/value") .set_coercer(boost::bind(&xcvr2450::set_tx_gain, this, _1, name)) .set(xcvr_tx_gain_ranges[name].start()); diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index 346f39589..ddbbfaefb 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -87,10 +87,10 @@ public: //Initialize clocks and LO bool found_rate = false; - BOOST_FOREACH(double rate, _db_iface->get_clock_rates(dboard_iface::UNIT_TX)) { + for(double rate: _db_iface->get_clock_rates(dboard_iface::UNIT_TX)) { found_rate |= uhd::math::frequencies_are_equal(rate, TWINRX_DESIRED_REFERENCE_FREQ); } - BOOST_FOREACH(double rate, _db_iface->get_clock_rates(dboard_iface::UNIT_RX)) { + for(double rate: _db_iface->get_clock_rates(dboard_iface::UNIT_RX)) { found_rate |= uhd::math::frequencies_are_equal(rate, TWINRX_DESIRED_REFERENCE_FREQ); } if (not found_rate) { @@ -506,7 +506,7 @@ private: //Functions void _write_lo_spi(dboard_iface::unit_t unit, const std::vector<uint32_t> ®s) { - BOOST_FOREACH(uint32_t reg, regs) { + for(uint32_t reg: regs) { spi_config_t spi_config = spi_config_t(spi_config_t::EDGE_RISE); spi_config.use_custom_divider = true; spi_config.divider = 67; diff --git a/host/lib/usrp/dboard_eeprom.cpp b/host/lib/usrp/dboard_eeprom.cpp index 9c748f556..0136e1fcb 100644 --- a/host/lib/usrp/dboard_eeprom.cpp +++ b/host/lib/usrp/dboard_eeprom.cpp @@ -19,7 +19,6 @@ #include <uhd/usrp/dboard_eeprom.hpp> #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/lexical_cast.hpp> #include <algorithm> diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index 56cd08fd7..698799fbc 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -26,7 +26,6 @@ #include <boost/tuple/tuple.hpp> #include <boost/format.hpp> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/assign/list_of.hpp> using namespace uhd; @@ -156,7 +155,7 @@ void dboard_manager::register_dboard_restricted( std::string dboard_id_t::to_cname(void) const{ std::string cname; - BOOST_FOREACH(const dboard_key_t &key, get_id_to_args_map().keys()){ + for(const dboard_key_t &key: get_id_to_args_map().keys()){ if ( (not key.is_xcvr() and *this == key.xx_id()) or (key.is_xcvr() and (*this == key.rx_id() or *this == key.tx_id())) @@ -266,7 +265,7 @@ void dboard_manager_impl::init( ){ //find the dboard key matches for the dboard ids dboard_key_t rx_dboard_key, tx_dboard_key, xcvr_dboard_key; - BOOST_FOREACH(const dboard_key_t &key, get_id_to_args_map().keys()){ + for(const dboard_key_t &key: get_id_to_args_map().keys()){ if (key.is_xcvr()){ if (rx_dboard_id == key.rx_id() and tx_dboard_id == key.tx_id()) xcvr_dboard_key = key; if (rx_dboard_id == key.rx_id()) rx_dboard_key = key; //kept to handle warning @@ -322,7 +321,7 @@ void dboard_manager_impl::init( db_ctor_args.tx_container = db_ctor_args.rx_container; //Same TX and RX container //create the xcvr object for each subdevice - BOOST_FOREACH(const std::string &subdev, subdevs){ + for(const std::string &subdev: subdevs){ db_ctor_args.sd_name = subdev; db_ctor_args.rx_subtree = subtree->subtree("rx_frontends/" + db_ctor_args.sd_name); db_ctor_args.tx_subtree = subtree->subtree("tx_frontends/" + db_ctor_args.sd_name); @@ -373,7 +372,7 @@ void dboard_manager_impl::init( } //make the rx subdevs - BOOST_FOREACH(const std::string &subdev, rx_subdevs){ + for(const std::string &subdev: rx_subdevs){ db_ctor_args.sd_name = subdev; db_ctor_args.rx_subtree = subtree->subtree("rx_frontends/" + db_ctor_args.sd_name); _rx_dboards[subdev] = rx_dboard_ctor(&db_ctor_args); @@ -412,7 +411,7 @@ void dboard_manager_impl::init( } //make the tx subdevs - BOOST_FOREACH(const std::string &subdev, tx_subdevs){ + for(const std::string &subdev: tx_subdevs){ db_ctor_args.sd_name = subdev; db_ctor_args.tx_subtree = subtree->subtree("tx_frontends/" + db_ctor_args.sd_name); _tx_dboards[subdev] = tx_dboard_ctor(&db_ctor_args); @@ -436,11 +435,11 @@ void dboard_manager_impl::init( } void dboard_manager_impl::initialize_dboards(void) { - BOOST_FOREACH(dboard_base::sptr& _rx_container, _rx_containers) { + for(dboard_base::sptr& _rx_container: _rx_containers) { _rx_container->initialize(); } - BOOST_FOREACH(dboard_base::sptr& _tx_container, _tx_containers) { + for(dboard_base::sptr& _tx_container: _tx_containers) { _tx_container->initialize(); } } @@ -457,7 +456,7 @@ void dboard_manager_impl::set_nice_dboard_if(void){ ; //set nice settings on each unit - BOOST_FOREACH(dboard_iface::unit_t unit, units){ + for(dboard_iface::unit_t unit: units){ _iface->set_gpio_ddr(unit, 0x0000); //all inputs _iface->set_gpio_out(unit, 0x0000); //all low _iface->set_pin_ctrl(unit, 0x0000); //all gpio diff --git a/host/lib/usrp/device3/device3_impl.cpp b/host/lib/usrp/device3/device3_impl.cpp index 28b7bc34b..84b11ee51 100644 --- a/host/lib/usrp/device3/device3_impl.cpp +++ b/host/lib/usrp/device3/device3_impl.cpp @@ -70,7 +70,7 @@ void device3_impl::merge_channel_defs( // - All block indices that are in chan_ids may be overwritten in the channel definition // - If the channels in chan_ids are not yet in the property tree channel list, // they are appended. - BOOST_FOREACH(const std::string &chan_idx, curr_channels) { + for(const std::string &chan_idx: curr_channels) { if (_tree->exists(chans_root / chan_idx)) { rfnoc::block_id_t chan_block_id = _tree->access<rfnoc::block_id_t>(chans_root / chan_idx).get(); if (std::find(chan_ids.begin(), chan_ids.end(), chan_block_id) != chan_ids.end()) { @@ -147,7 +147,7 @@ void device3_impl::enumerate_rfnoc_blocks( } UHD_ASSERT_THROW(block_def); make_args.ctrl_ifaces[0] = ctrl; - BOOST_FOREACH(const size_t port_number, block_def->get_all_port_numbers()) { + for(const size_t port_number: block_def->get_all_port_numbers()) { if (port_number == 0) { // We've already set this up continue; } diff --git a/host/lib/usrp/device3/device3_io_impl.cpp b/host/lib/usrp/device3/device3_io_impl.cpp index 2f2e778c9..996399815 100644 --- a/host/lib/usrp/device3/device3_io_impl.cpp +++ b/host/lib/usrp/device3/device3_io_impl.cpp @@ -138,7 +138,7 @@ void generate_channel_list( } // Add all remaining args to all channel args - BOOST_FOREACH(device_addr_t &chan_arg, chan_args_) { + for(device_addr_t &chan_arg: chan_args_) { chan_arg = chan_arg.to_string() + "," + args.args.to_string(); } @@ -459,7 +459,7 @@ bool device3_impl::recv_async_msg( **********************************************************************/ void device3_impl::update_rx_streamers(double /* rate */) { - BOOST_FOREACH(const std::string &block_id, _rx_streamers.keys()) { + for(const std::string &block_id: _rx_streamers.keys()) { UHD_STREAMER_LOG() << "[Device3] updating RX streamer to " << block_id << std::endl; boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::recv_packet_streamer>(_rx_streamers[block_id].lock()); @@ -547,7 +547,7 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t &args_) // Find all upstream radio nodes and set their response in SID to the host std::vector<boost::shared_ptr<uhd::rfnoc::radio_ctrl> > upstream_radio_nodes = blk_ctrl->find_upstream_node<uhd::rfnoc::radio_ctrl>(); UHD_STREAMER_LOG() << "[RX Streamer] Number of upstream radio nodes: " << upstream_radio_nodes.size() << std::endl; - BOOST_FOREACH(const boost::shared_ptr<uhd::rfnoc::radio_ctrl> &node, upstream_radio_nodes) { + for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl> &node: upstream_radio_nodes) { node->sr_write(uhd::rfnoc::SR_RESP_OUT_DST_SID, xport.send_sid.get_src(), block_port); } @@ -661,7 +661,7 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t &args_) **********************************************************************/ void device3_impl::update_tx_streamers(double /* rate */) { - BOOST_FOREACH(const std::string &block_id, _tx_streamers.keys()) { + for(const std::string &block_id: _tx_streamers.keys()) { UHD_STREAMER_LOG() << "[Device3] updating TX streamer: " << block_id << std::endl; boost::shared_ptr<sph::send_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::send_packet_streamer>(_tx_streamers[block_id].lock()); @@ -822,7 +822,7 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t &args_) size_t radio_port = args.args.cast<size_t>("radio_port", 0); std::vector<boost::shared_ptr<uhd::rfnoc::radio_ctrl> > downstream_radio_nodes = blk_ctrl->find_downstream_node<uhd::rfnoc::radio_ctrl>(); UHD_STREAMER_LOG() << "[TX Streamer] Number of downstream radio nodes: " << downstream_radio_nodes.size() << std::endl; - BOOST_FOREACH(const boost::shared_ptr<uhd::rfnoc::radio_ctrl> &node, downstream_radio_nodes) { + for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl> &node: downstream_radio_nodes) { if (node->get_block_id() == radio_id) { node->sr_write(uhd::rfnoc::SR_RESP_IN_DST_SID, xport.send_sid.get_src(), radio_port); } @@ -836,7 +836,7 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t &args_) // Find all downstream radio nodes and set their response SID to the host std::vector<boost::shared_ptr<uhd::rfnoc::radio_ctrl> > downstream_radio_nodes = blk_ctrl->find_downstream_node<uhd::rfnoc::radio_ctrl>(); UHD_STREAMER_LOG() << "[TX Streamer] Number of downstream radio nodes: " << downstream_radio_nodes.size() << std::endl; - BOOST_FOREACH(const boost::shared_ptr<uhd::rfnoc::radio_ctrl> &node, downstream_radio_nodes) { + for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl> &node: downstream_radio_nodes) { node->sr_write(uhd::rfnoc::SR_RESP_IN_DST_SID, xport.send_sid.get_src(), block_port); } } diff --git a/host/lib/usrp/e100/clock_ctrl.cpp b/host/lib/usrp/e100/clock_ctrl.cpp index 0dbd6a5d3..b49b30a6a 100644 --- a/host/lib/usrp/e100/clock_ctrl.cpp +++ b/host/lib/usrp/e100/clock_ctrl.cpp @@ -23,7 +23,6 @@ #include <stdint.h> #include "e100_regs.hpp" //spi slave constants #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/thread/thread.hpp> #include <boost/math/common_factor_rt.hpp> //gcd @@ -521,7 +520,7 @@ private: ; //write initial register values and latch/update - BOOST_FOREACH(const range_t &range, ranges){ + for(const range_t &range: ranges){ for(uint16_t addr = range.first; addr <= range.second; addr++){ this->send_reg(addr); } diff --git a/host/lib/usrp/e100/e100_ctrl.cpp b/host/lib/usrp/e100/e100_ctrl.cpp index 4217286f8..777d1b5d5 100644 --- a/host/lib/usrp/e100/e100_ctrl.cpp +++ b/host/lib/usrp/e100/e100_ctrl.cpp @@ -27,7 +27,6 @@ #include <boost/thread/thread.hpp> //sleep #include <boost/thread/mutex.hpp> #include <boost/thread/condition_variable.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <fstream> diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp index 25c967cfa..41ba24d8f 100644 --- a/host/lib/usrp/e100/e100_impl.cpp +++ b/host/lib/usrp/e100/e100_impl.cpp @@ -269,7 +269,7 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ } if (_gps and _gps->gps_detected()) { - BOOST_FOREACH(const std::string &name, _gps->get_sensors()) + for(const std::string &name: _gps->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&gps_ctrl::get_sensor, _gps, name)); @@ -434,12 +434,12 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ //bind frontend corrections to the dboard freq props const fs_path db_tx_fe_path = mb_path / "dboards" / "A" / "tx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)){ + for(const std::string &name: _tree->list(db_tx_fe_path)){ _tree->access<double>(db_tx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&e100_impl::set_tx_fe_corrections, this, _1)); } const fs_path db_rx_fe_path = mb_path / "dboards" / "A" / "rx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)){ + for(const std::string &name: _tree->list(db_rx_fe_path)){ _tree->access<double>(db_rx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&e100_impl::set_rx_fe_corrections, this, _1)); } @@ -460,10 +460,10 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ .add_coerced_subscriber(boost::bind(&e100_clock_ctrl::set_fpga_clock_rate, _clock_ctrl, _1)); //reset cordic rates and their properties to zero - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "freq" / "value").set(0.0); } - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "tx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "tx_dsps")){ _tree->access<double>(mb_path / "tx_dsps" / name / "freq" / "value").set(0.0); } diff --git a/host/lib/usrp/e100/io_impl.cpp b/host/lib/usrp/e100/io_impl.cpp index ebed3614c..aedf79d5f 100644 --- a/host/lib/usrp/e100/io_impl.cpp +++ b/host/lib/usrp/e100/io_impl.cpp @@ -75,10 +75,10 @@ void e100_impl::update_rates(void){ _tree->access<double>(mb_path / "tick_rate").update(); //and now that the tick rate is set, init the host rates to something - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "rate" / "value").update(); } - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "tx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "tx_dsps")){ _tree->access<double>(mb_path / "tx_dsps" / name / "rate" / "value").update(); } } diff --git a/host/lib/usrp/e300/e300_common.cpp b/host/lib/usrp/e300/e300_common.cpp index 216713bc6..20cd4109f 100644 --- a/host/lib/usrp/e300/e300_common.cpp +++ b/host/lib/usrp/e300/e300_common.cpp @@ -26,6 +26,7 @@ #include "e300_common.hpp" #include <boost/filesystem.hpp> +#include <boost/noncopyable.hpp> #include <fstream> #include <string> diff --git a/host/lib/usrp/e300/e300_common.hpp b/host/lib/usrp/e300/e300_common.hpp index d9a0afd9e..c0cb9e2fd 100644 --- a/host/lib/usrp/e300/e300_common.hpp +++ b/host/lib/usrp/e300/e300_common.hpp @@ -18,6 +18,8 @@ #ifndef INCLUDED_E300_COMMON_HPP #define INCLUDED_E300_COMMON_HPP +#include <string> + namespace uhd { namespace usrp { namespace e300 { namespace common { diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 84f50c67b..64422a82b 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -130,7 +130,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint) if (hints.size() > 1) { device_addrs_t found_devices; std::string err_msg; - BOOST_FOREACH(const device_addr_t &hint_i, hints) + for(const device_addr_t &hint_i: hints) { device_addrs_t found_devices_i = e300_find(hint_i); if(found_devices_i.size() != 1) @@ -165,7 +165,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint) if (not loopback_only) { // if no address or node has been specified, send a broadcast if ((not hint.has_key("addr")) and (not hint.has_key("node"))) { - BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()) + for(const if_addrs_t &if_addrs: get_if_addrs()) { // avoid the loopback device if (is_loopback(if_addrs)) @@ -187,7 +187,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint) std::vector<std::string> ip_addrs = discover_ip_addrs( hint["addr"], E300_SERVER_I2C_PORT); - BOOST_FOREACH(const std::string &ip_addr, ip_addrs) + for(const std::string &ip_addr: ip_addrs) { device_addr_t new_addr; new_addr["type"] = "e3x0"; @@ -468,14 +468,14 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) // and do the misc mboard sensors //////////////////////////////////////////////////////////////////// _tree->create<int>(mb_path / "sensors"); - BOOST_FOREACH(const std::string &name, _sensor_manager->get_sensors()) + for(const std::string &name: _sensor_manager->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&e300_sensor_manager::get_sensor, _sensor_manager, name)); } #ifdef E300_GPSD if (_gps) { - BOOST_FOREACH(const std::string &name, _gps->get_sensors()) + for(const std::string &name: _gps->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&gpsd_iface::get_sensor, _gps, name)); @@ -511,7 +511,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) this->_setup_radio(instance); //now test each radio module's connection to the codec interface - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { _codec_mgr->loopback_self_test( boost::bind( @@ -524,7 +524,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) // internal gpios //////////////////////////////////////////////////////////////////// gpio_atr_3000::sptr fp_gpio = gpio_atr_3000::make(_radio_perifs[0].ctrl, radio::sr_addr(radio::FP_GPIO), radio::RB32_FP_GPIO); - BOOST_FOREACH(const gpio_attr_map_t::value_type attr, gpio_attr_map) + for(const gpio_attr_map_t::value_type attr: gpio_attr_map) { _tree->create<uint32_t>(mb_path / "gpio" / "INT0" / attr.second) .add_coerced_subscriber(boost::bind(&gpio_atr_3000::set_gpio_attr, fp_gpio, attr.first, _1)) @@ -625,11 +625,11 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) // subdev spec contains full width of selections subdev_spec_t rx_spec, tx_spec; - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) { rx_spec.push_back(subdev_spec_pair_t("A", fe)); } - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) { tx_spec.push_back(subdev_spec_pair_t("A", fe)); } @@ -696,7 +696,7 @@ double e300_impl::_set_tick_rate(const double rate) _tick_rate = _codec_ctrl->set_clock_rate(rate); UHD_MSG(status) << "Actually got clock rate " << _tick_rate/1e6 << " MHz\n"; - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { perif.time64->set_tick_rate(_tick_rate); perif.time64->self_test(); @@ -811,7 +811,7 @@ void e300_impl::_update_time_source(const std::string &source) void e300_impl::_set_time(const uhd::time_spec_t& t) { - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) perif.time64->set_time_sync(t); _misc.time_sync = 1; _update_gpio_state(); @@ -1037,7 +1037,7 @@ void e300_impl::_setup_radio(const size_t dspno) // create RF frontend interfacing //////////////////////////////////////////////////////////////////// static const std::vector<direction_t> dirs = boost::assign::list_of(RX_DIRECTION)(TX_DIRECTION); - BOOST_FOREACH(direction_t dir, dirs) { + for(direction_t dir: dirs) { const std::string x = (dir == RX_DIRECTION) ? "rx" : "tx"; const std::string key = boost::to_upper_copy(x) + std::string(((dspno == FE0)? "1" : "2")); const fs_path rf_fe_path diff --git a/host/lib/usrp/e300/e300_io_impl.cpp b/host/lib/usrp/e300/e300_io_impl.cpp index 2514b7f40..bcdb8077b 100644 --- a/host/lib/usrp/e300/e300_io_impl.cpp +++ b/host/lib/usrp/e300/e300_io_impl.cpp @@ -26,7 +26,6 @@ #include <boost/bind.hpp> #include <uhd/utils/tasks.hpp> #include <uhd/utils/log.hpp> -#include <boost/foreach.hpp> #include <boost/make_shared.hpp> using namespace uhd; @@ -43,7 +42,7 @@ static const uint32_t HW_SEQ_NUM_MASK = 0xfff; void e300_impl::_check_tick_rate_with_current_streamers(const double rate) { size_t max_tx_chan_count = 0, max_rx_chan_count = 0; - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { { boost::shared_ptr<sph::recv_packet_streamer> rx_streamer = @@ -73,7 +72,7 @@ void e300_impl::_update_tick_rate(const double rate) { _check_tick_rate_with_current_streamers(rate); - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::recv_packet_streamer>(perif.rx_streamer.lock()); @@ -81,7 +80,7 @@ void e300_impl::_update_tick_rate(const double rate) my_streamer->set_tick_rate(rate); perif.framer->set_tick_rate(_tick_rate); } - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { boost::shared_ptr<sph::send_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::send_packet_streamer>(perif.tx_streamer.lock()); diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index 447a13c33..b4b4ffa0f 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -31,7 +31,6 @@ #include <boost/thread/mutex.hpp> #include "boost/tuple/tuple.hpp" -#include "boost/foreach.hpp" using namespace uhd; using namespace boost::gregorian; @@ -181,7 +180,7 @@ private: boost::system_time time = boost::get_system_time(); // Update sentences with newly read data - BOOST_FOREACH(std::string key, keys) + for(std::string key: keys) { if (not msgs[key].empty()) { diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index 0e6cb8574..ecae5e56d 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -22,7 +22,6 @@ #include <boost/asio/ip/address_v4.hpp> #include <boost/assign/list_of.hpp> #include <boost/lexical_cast.hpp> -#include <boost/foreach.hpp> #include <algorithm> #include <iostream> #include <cstddef> diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 058925a9a..a86d05945 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -30,7 +30,6 @@ #include "legacy_compat.hpp" #include <boost/assign/list_of.hpp> #include <boost/thread.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/algorithm/string.hpp> #include <algorithm> @@ -190,7 +189,7 @@ static meta_range_t make_overall_tune_range( const double bw ){ meta_range_t range; - BOOST_FOREACH(const range_t &sub_range, fe_range){ + for(const range_t &sub_range: fe_range){ range.push_back(range_t( sub_range.start() + std::max(dsp_range.start(), -bw/2), sub_range.stop() + std::min(dsp_range.stop(), bw/2), @@ -873,7 +872,7 @@ public: std::vector<std::string> get_rx_lo_names(size_t chan = 0){ std::vector<std::string> lo_names; if (_tree->exists(rx_rf_fe_root(chan) / "los")) { - BOOST_FOREACH(const std::string &name, _tree->list(rx_rf_fe_root(chan) / "los")) { + for(const std::string &name: _tree->list(rx_rf_fe_root(chan) / "los")) { lo_names.push_back(name); } } @@ -887,7 +886,7 @@ public: //Special value ALL_LOS support atomically sets the source for all LOs _tree->access<std::string>(rx_rf_fe_root(chan) / "los" / ALL_LOS / "source" / "value").set(src); } else { - BOOST_FOREACH(const std::string &n, _tree->list(rx_rf_fe_root(chan) / "los")) { + for(const std::string &n: _tree->list(rx_rf_fe_root(chan) / "los")) { this->set_rx_lo_source(src, n, chan); } } @@ -950,7 +949,7 @@ public: //Special value ALL_LOS support atomically sets the source for all LOs _tree->access<bool>(rx_rf_fe_root(chan) / "los" / ALL_LOS / "export").set(enabled); } else { - BOOST_FOREACH(const std::string &n, _tree->list(rx_rf_fe_root(chan) / "los")) { + for(const std::string &n: _tree->list(rx_rf_fe_root(chan) / "los")) { this->set_rx_lo_export_enabled(enabled, n, chan); } } @@ -1536,12 +1535,12 @@ public: std::vector<std::string> banks; if (_tree->exists(mb_root(mboard) / "gpio")) { - BOOST_FOREACH(const std::string &name, _tree->list(mb_root(mboard) / "gpio")) + for(const std::string &name: _tree->list(mb_root(mboard) / "gpio")) { banks.push_back(name); } } - BOOST_FOREACH(const std::string &name, _tree->list(mb_root(mboard) / "dboards")) + for(const std::string &name: _tree->list(mb_root(mboard) / "dboards")) { banks.push_back("RX"+name); banks.push_back("TX"+name); @@ -1877,10 +1876,10 @@ private: mboard_chan_pair mcp = rx_chan_to_mcp(chan); const subdev_spec_pair_t spec = get_rx_subdev_spec(mcp.mboard).at(mcp.chan); gain_group::sptr gg = gain_group::make(); - BOOST_FOREACH(const std::string &name, _tree->list(mb_root(mcp.mboard) / "rx_codecs" / spec.db_name / "gains")){ + for(const std::string &name: _tree->list(mb_root(mcp.mboard) / "rx_codecs" / spec.db_name / "gains")){ gg->register_fcns("ADC-"+name, make_gain_fcns_from_subtree(_tree->subtree(mb_root(mcp.mboard) / "rx_codecs" / spec.db_name / "gains" / name)), 0 /* low prio */); } - BOOST_FOREACH(const std::string &name, _tree->list(rx_rf_fe_root(chan) / "gains")){ + for(const std::string &name: _tree->list(rx_rf_fe_root(chan) / "gains")){ gg->register_fcns(name, make_gain_fcns_from_subtree(_tree->subtree(rx_rf_fe_root(chan) / "gains" / name)), 1 /* high prio */); } return gg; @@ -1890,10 +1889,10 @@ private: mboard_chan_pair mcp = tx_chan_to_mcp(chan); const subdev_spec_pair_t spec = get_tx_subdev_spec(mcp.mboard).at(mcp.chan); gain_group::sptr gg = gain_group::make(); - BOOST_FOREACH(const std::string &name, _tree->list(mb_root(mcp.mboard) / "tx_codecs" / spec.db_name / "gains")){ + for(const std::string &name: _tree->list(mb_root(mcp.mboard) / "tx_codecs" / spec.db_name / "gains")){ gg->register_fcns("DAC-"+name, make_gain_fcns_from_subtree(_tree->subtree(mb_root(mcp.mboard) / "tx_codecs" / spec.db_name / "gains" / name)), 1 /* high prio */); } - BOOST_FOREACH(const std::string &name, _tree->list(tx_rf_fe_root(chan) / "gains")){ + for(const std::string &name: _tree->list(tx_rf_fe_root(chan) / "gains")){ gg->register_fcns(name, make_gain_fcns_from_subtree(_tree->subtree(tx_rf_fe_root(chan) / "gains" / name)), 0 /* low prio */); } return gg; @@ -1907,7 +1906,7 @@ private: size_t bytes_per_sample = convert::get_bytes_per_item(args.otw_format.empty() ? "sc16" : args.otw_format); double max_link_rate = 0; double sum_rate = 0; - BOOST_FOREACH(const size_t chan, args.channels) { + for(const size_t chan: args.channels) { mboard_chan_pair mcp = is_tx ? tx_chan_to_mcp(chan) : rx_chan_to_mcp(chan); if (_tree->exists(mb_root(mcp.mboard) / "link_max_rate")) { max_link_rate = std::max( diff --git a/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp b/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp index 2bcfb0394..ff4289922 100644 --- a/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp +++ b/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp @@ -21,7 +21,6 @@ #include <uhd/utils/safe_call.hpp> #include <stdint.h> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <stdexcept> #include <cmath> #include <cstdlib> @@ -60,7 +59,7 @@ public: _tick_rate = _codec_ctrl->set_clock_rate(rate); UHD_MSG(status) << "got " << _tick_rate/1e6 << " MHz\n"; - BOOST_FOREACH(time_core_3000::sptr& time_core, _time_cores) { + for(time_core_3000::sptr& time_core: _time_cores) { time_core->set_tick_rate(_tick_rate); time_core->self_test(); } diff --git a/host/lib/usrp/n230/n230_impl.cpp b/host/lib/usrp/n230/n230_impl.cpp index 015140fcc..325b90575 100644 --- a/host/lib/usrp/n230/n230_impl.cpp +++ b/host/lib/usrp/n230/n230_impl.cpp @@ -33,7 +33,6 @@ #include <uhd/usrp/dboard_eeprom.hpp> #include <uhd/usrp/gps_ctrl.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> #include <boost/algorithm/string.hpp> @@ -71,7 +70,7 @@ uhd::device_addrs_t n230_impl::n230_find(const uhd::device_addr_t &multi_dev_hin if (hints.size() > 1){ device_addrs_t found_devices; std::string error_msg; - BOOST_FOREACH(const device_addr_t &hint_i, hints){ + for(const device_addr_t &hint_i: hints){ device_addrs_t found_devices_i = n230_find(hint_i); if (found_devices_i.size() != 1) error_msg += str(boost::format( "Could not resolve device hint \"%s\" to a single device." @@ -98,7 +97,7 @@ uhd::device_addrs_t n230_impl::n230_find(const uhd::device_addr_t &multi_dev_hin //if no address was specified, send a broadcast on each interface if (not hint.has_key("addr")) { - BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()) { + for(const if_addrs_t &if_addrs: get_if_addrs()) { //avoid the loopback device if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue; @@ -119,7 +118,7 @@ uhd::device_addrs_t n230_impl::n230_find(const uhd::device_addr_t &multi_dev_hin usrp3::usrp3_fw_ctrl_iface::discover_devices( hint["addr"], BOOST_STRINGIZE(N230_FW_COMMS_UDP_PORT), N230_FW_PRODUCT_ID); - BOOST_FOREACH(const std::string& addr, discovered_addrs) + for(const std::string& addr: discovered_addrs) { device_addr_t new_addr; new_addr["type"] = "n230"; @@ -397,11 +396,11 @@ void n230_impl::_initialize_property_tree(const fs_path& mb_path) // Initialize subdev specs //------------------------------------------------------------------ subdev_spec_t rx_spec, tx_spec; - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) { rx_spec.push_back(subdev_spec_pair_t("A", fe)); } - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) { tx_spec.push_back(subdev_spec_pair_t("A", fe)); } @@ -437,7 +436,7 @@ void n230_impl::_initialize_property_tree(const fs_path& mb_path) //------------------------------------------------------------------ if (_resource_mgr->is_gpsdo_present()) { uhd::gps_ctrl::sptr gps_ctrl = _resource_mgr->get_gps_ctrl(); - BOOST_FOREACH(const std::string &name, gps_ctrl->get_sensors()) + for(const std::string &name: gps_ctrl->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&gps_ctrl::get_sensor, gps_ctrl, name)); @@ -499,7 +498,7 @@ void n230_impl::_initialize_radio_properties(const fs_path& mb_path, size_t inst //RF Frontend Interfacing static const std::vector<direction_t> data_directions = boost::assign::list_of(RX_DIRECTION)(TX_DIRECTION); - BOOST_FOREACH(direction_t direction, data_directions) { + for(direction_t direction: data_directions) { const std::string dir_str = (direction == RX_DIRECTION) ? "rx" : "tx"; const std::string key = boost::to_upper_copy(dir_str) + str(boost::format("%u") % (instance + 1)); const fs_path rf_fe_path = mb_path / "dboards" / "A" / (dir_str + "_frontends") / ((instance==0)?"A":"B"); diff --git a/host/lib/usrp/n230/n230_resource_manager.cpp b/host/lib/usrp/n230/n230_resource_manager.cpp index b96de542a..e9bb9c2c5 100644 --- a/host/lib/usrp/n230/n230_resource_manager.cpp +++ b/host/lib/usrp/n230/n230_resource_manager.cpp @@ -85,7 +85,7 @@ n230_resource_manager::n230_resource_manager( //Discover ethernet interfaces bool dual_eth_expected = (ip_addrs.size() > 1); - BOOST_FOREACH(const std::string& addr, ip_addrs) { + for(const std::string& addr: ip_addrs) { n230_eth_conn_t conn_iface; conn_iface.ip_addr = addr; diff --git a/host/lib/usrp/n230/n230_stream_manager.cpp b/host/lib/usrp/n230/n230_stream_manager.cpp index 0528212d0..7c936a184 100644 --- a/host/lib/usrp/n230/n230_stream_manager.cpp +++ b/host/lib/usrp/n230/n230_stream_manager.cpp @@ -24,7 +24,6 @@ #include <boost/bind.hpp> #include <uhd/utils/tasks.hpp> #include <uhd/utils/log.hpp> -#include <boost/foreach.hpp> #include <boost/make_shared.hpp> static const double N230_RX_SW_BUFF_FULL_FACTOR = 0.90; //Buffer should ideally be 90% full. diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index 6912afec8..e59160a71 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.cpp @@ -20,7 +20,6 @@ #include <boost/algorithm/string.hpp> //for split #include <boost/tokenizer.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <sstream> #include <vector> @@ -45,7 +44,7 @@ bool usrp::operator==(const subdev_spec_pair_t &lhs, const subdev_spec_pair_t &r } subdev_spec_t::subdev_spec_t(const std::string &markup){ - BOOST_FOREACH(const std::string &pair, pair_tokenizer(markup)){ + for(const std::string &pair: pair_tokenizer(markup)){ if (pair.empty()) continue; std::vector<std::string> db_sd; boost::split(db_sd, pair, boost::is_any_of(":")); switch(db_sd.size()){ @@ -62,7 +61,7 @@ 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 subdev_spec_pair_t &pair, *this){ + for(const subdev_spec_pair_t &pair: *this){ ss << boost::format( " Channel %d: Daughterboard %s, Subdevice %s" ) % (count++) % pair.db_name % pair.sd_name << std::endl; @@ -73,7 +72,7 @@ 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 subdev_spec_pair_t &pair, *this){ + for(const subdev_spec_pair_t &pair: *this){ markup += ((count++)? " " : "") + pair.db_name + ":" + pair.sd_name; } return markup; diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 920023dad..3e0b23973 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -439,7 +439,7 @@ void usrp1_impl::update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ //set the mux and set the number of rx channels std::vector<mapping_pair_t> mapping; - BOOST_FOREACH(const subdev_spec_pair_t &pair, spec){ + for(const subdev_spec_pair_t &pair: spec){ const std::string conn = _tree->access<std::string>(str(boost::format( "/mboards/0/dboards/%s/rx_frontends/%s/connection" ) % pair.db_name % pair.sd_name)).get(); @@ -459,7 +459,7 @@ void usrp1_impl::update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ //set the mux and set the number of tx channels std::vector<mapping_pair_t> mapping; - BOOST_FOREACH(const subdev_spec_pair_t &pair, spec){ + for(const subdev_spec_pair_t &pair: spec){ const std::string conn = _tree->access<std::string>(str(boost::format( "/mboards/0/dboards/%s/tx_frontends/%s/connection" ) % pair.db_name % pair.sd_name)).get(); @@ -548,10 +548,10 @@ double usrp1_impl::update_tx_samp_rate(size_t dspno, const double samp_rate){ void usrp1_impl::update_rates(void){ const fs_path mb_path = "/mboards/0"; this->update_tick_rate(_master_clock_rate); - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "rate" / "value").update(); } - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "tx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "tx_dsps")){ _tree->access<double>(mb_path / "tx_dsps" / name / "rate" / "value").update(); } } diff --git a/host/lib/usrp/usrp1/usrp1_calc_mux.hpp b/host/lib/usrp/usrp1/usrp1_calc_mux.hpp index 3577a8042..0ae1c822f 100644 --- a/host/lib/usrp/usrp1/usrp1_calc_mux.hpp +++ b/host/lib/usrp/usrp1/usrp1_calc_mux.hpp @@ -71,7 +71,7 @@ static uint32_t calc_rx_mux(const std::vector<mapping_pair_t> &mapping){ //calculate the channel flags int channel_flags = 0; size_t num_reals = 0, num_quads = 0; - BOOST_FOREACH(const mapping_pair_t &pair, uhd::reversed(mapping)){ + for(const mapping_pair_t &pair: uhd::reversed(mapping)){ const std::string name = pair.first, conn = pair.second; if (conn == "IQ" or conn == "QI") num_quads++; if (conn == "I" or conn == "Q") num_reals++; @@ -132,7 +132,7 @@ static uint32_t calc_tx_mux(const std::vector<mapping_pair_t> &mapping){ //calculate the channel flags int channel_flags = 0, chan = 0; uhd::dict<std::string, int> slot_to_chan_count = boost::assign::map_list_of("A", 0)("B", 0); - BOOST_FOREACH(const mapping_pair_t &pair, mapping){ + for(const mapping_pair_t &pair: mapping){ const std::string name = pair.first, conn = pair.second; //combine the channel flags: shift for slot A vs B diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 09352c5e0..8dee9b7e6 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -76,7 +76,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) //find the usrps and load firmware size_t found = 0; - BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) { + for(usb_device_handle::sptr handle: usb_device_handle::get_device_list(vid, pid)) { //extract the firmware path for the USRP1 std::string usrp1_fw_image; try{ @@ -104,7 +104,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) //search for the device until found or timeout while (boost::get_system_time() < timeout_time and usrp1_addrs.empty() and found != 0) { - BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) + for(usb_device_handle::sptr handle: usb_device_handle::get_device_list(vid, pid)) { usb_control::sptr control; try{control = usb_control::make(handle, 0);} @@ -159,7 +159,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ //locate the matching handle in the device list usb_device_handle::sptr handle; - BOOST_FOREACH(usb_device_handle::sptr dev_handle, device_list) { + for(usb_device_handle::sptr dev_handle: device_list) { if (dev_handle->get_serial() == device_addr["serial"]){ handle = dev_handle; break; @@ -251,7 +251,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ //////////////////////////////////////////////////////////////////// // create codec control objects //////////////////////////////////////////////////////////////////// - BOOST_FOREACH(const std::string &db, _dbc.keys()){ + for(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 fs_path rx_codec_path = mb_path / "rx_codecs" / db; const fs_path tx_codec_path = mb_path / "tx_codecs" / db; @@ -284,7 +284,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ .set(subdev_spec_t()) .add_coerced_subscriber(boost::bind(&usrp1_impl::update_tx_subdev_spec, this, _1)); - BOOST_FOREACH(const std::string &db, _dbc.keys()){ + for(const std::string &db: _dbc.keys()){ const fs_path rx_fe_path = mb_path / "rx_frontends" / db; _tree->create<std::complex<double> >(rx_fe_path / "dc_offset" / "value") .set_coercer(boost::bind(&usrp1_impl::set_rx_dc_offset, this, db, _1)) @@ -349,7 +349,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ //////////////////////////////////////////////////////////////////// // create dboard control objects //////////////////////////////////////////////////////////////////// - BOOST_FOREACH(const std::string &db, _dbc.keys()){ + for(const std::string &db: _dbc.keys()){ //read the dboard eeprom to extract the dboard ids dboard_eeprom_t rx_db_eeprom, tx_db_eeprom, gdb_eeprom; @@ -400,7 +400,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ this->update_rates(); //reset cordic rates and their properties to zero - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "freq" / "value").set(0.0); } diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 18c5c8bd3..1aa255f8d 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -31,7 +31,6 @@ #include <uhd/usrp/dboard_eeprom.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <uhd/transport/usb_zero_copy.hpp> -#include <boost/foreach.hpp> #include <boost/weak_ptr.hpp> #include <complex> @@ -158,7 +157,7 @@ private: void enable_tx(bool enb){ _tx_enabled = enb; _fx2_ctrl->usrp_tx_enable(enb); - BOOST_FOREACH(const std::string &key, _dbc.keys()) + for(const std::string &key: _dbc.keys()) { _dbc[key].codec->enable_tx_digital(enb); } diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp index a0e456708..043564727 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.cpp +++ b/host/lib/usrp/usrp2/codec_ctrl.cpp @@ -23,7 +23,6 @@ #include <uhd/utils/safe_call.hpp> #include <uhd/exception.hpp> #include <stdint.h> -#include <boost/foreach.hpp> using namespace uhd; diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp index 1dafe5721..49ad38eaf 100644 --- a/host/lib/usrp/usrp2/dboard_iface.cpp +++ b/host/lib/usrp/usrp2/dboard_iface.cpp @@ -134,7 +134,7 @@ usrp2_dboard_iface::usrp2_dboard_iface( //reset the aux dacs _dac_regs[UNIT_RX] = ad5623_regs_t(); _dac_regs[UNIT_TX] = ad5623_regs_t(); - BOOST_FOREACH(unit_t unit, _dac_regs.keys()){ + for(unit_t unit: _dac_regs.keys()){ _dac_regs[unit].data = 1; _dac_regs[unit].addr = ad5623_regs_t::ADDR_ALL; _dac_regs[unit].cmd = ad5623_regs_t::CMD_RESET; diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 224519944..3c10c6e79 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -231,7 +231,7 @@ void usrp2_impl::io_init(void){ _io_impl = UHD_PIMPL_MAKE(io_impl, ()); //init first so we dont have an access race - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ //init the tx xport and flow control monitor _io_impl->tx_xports.push_back(_mbc[mb].tx_dsp_xport); _io_impl->fc_mons.push_back(flow_control_monitor::sptr(new flow_control_monitor( @@ -241,14 +241,14 @@ void usrp2_impl::io_init(void){ } //allocate streamer weak ptrs containers - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ _mbc[mb].rx_streamers.resize(_mbc[mb].rx_dsps.size()); _mbc[mb].tx_streamers.resize(1/*known to be 1 dsp*/); } //create a new pirate thread for each zc if (yarr!!) size_t index = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ //spawn a new pirate to plunder the recv booty _io_impl->pirate_tasks.push_back(task::make(boost::bind( &usrp2_impl::io_impl::recv_pirate_loop, _io_impl.get(), @@ -261,7 +261,7 @@ void usrp2_impl::update_tick_rate(const double rate){ _io_impl->tick_rate = rate; //shadow for async msg //update the tick rate on all existing streamers -> thread safe - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ for (size_t i = 0; i < _mbc[mb].rx_streamers.size(); i++){ boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::recv_packet_streamer>(_mbc[mb].rx_streamers[i].lock()); @@ -298,15 +298,15 @@ void usrp2_impl::update_tx_samp_rate(const std::string &mb, const size_t dsp, co } void usrp2_impl::update_rates(void){ - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ 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 - BOOST_FOREACH(const std::string &name, _tree->list(root / "rx_dsps")){ + for(const std::string &name: _tree->list(root / "rx_dsps")){ _tree->access<double>(root / "rx_dsps" / name / "rate" / "value").update(); } - BOOST_FOREACH(const std::string &name, _tree->list(root / "tx_dsps")){ + for(const std::string &name: _tree->list(root / "tx_dsps")){ _tree->access<double>(root / "tx_dsps" / name / "rate" / "value").update(); } } @@ -330,7 +330,7 @@ void usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev //compute the new occupancy and resize _mbc[which_mb].rx_chan_occ = spec.size(); size_t nchan = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()) nchan += _mbc[mb].rx_chan_occ; + for(const std::string &mb: _mbc.keys()) nchan += _mbc[mb].rx_chan_occ; } void usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec){ @@ -346,7 +346,7 @@ void usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev //compute the new occupancy and resize _mbc[which_mb].tx_chan_occ = spec.size(); size_t nchan = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()) nchan += _mbc[mb].tx_chan_occ; + for(const std::string &mb: _mbc.keys()) nchan += _mbc[mb].tx_chan_occ; } /*********************************************************************** @@ -454,7 +454,7 @@ rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args_){ for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){ const size_t chan = args.channels[chan_i]; size_t num_chan_so_far = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ num_chan_so_far += _mbc[mb].rx_chan_occ; if (chan < num_chan_so_far){ const size_t dsp = chan + _mbc[mb].rx_chan_occ - num_chan_so_far; @@ -524,7 +524,7 @@ tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args_){ const size_t chan = args.channels[chan_i]; size_t num_chan_so_far = 0; size_t abs = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ num_chan_so_far += _mbc[mb].tx_chan_occ; if (chan < num_chan_so_far){ const size_t dsp = chan + _mbc[mb].tx_chan_occ - num_chan_so_far; diff --git a/host/lib/usrp/usrp2/n200_image_loader.cpp b/host/lib/usrp/usrp2/n200_image_loader.cpp index c68484600..01a8faa5e 100644 --- a/host/lib/usrp/usrp2/n200_image_loader.cpp +++ b/host/lib/usrp/usrp2/n200_image_loader.cpp @@ -225,7 +225,7 @@ static uhd::device_addr_t n200_find(const image_loader::image_loader_args_t &ima * this query. If the user supplied specific arguments that * led to a USRP2, throw an error. */ - BOOST_FOREACH(const uhd::device_addr_t &dev, found){ + for(const uhd::device_addr_t &dev: found){ rev_xport = udp_simple::make_connected( dev.get("addr"), BOOST_STRINGIZE(N200_UDP_FW_UPDATE_PORT) @@ -257,7 +257,7 @@ static uhd::device_addr_t n200_find(const image_loader::image_loader_args_t &ima std::string err_msg = "Could not resolve given args to a single N-Series device.\n" "Applicable devices:\n"; - BOOST_FOREACH(const uhd::device_addr_t &dev, n200_found){ + for(const uhd::device_addr_t &dev: n200_found){ err_msg += str(boost::format("* %s (addr=%s)\n") % dev.get("hw_rev") % dev.get("addr")); diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 021f0e3e5..100cec867 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -27,7 +27,6 @@ #include <uhd/utils/safe_call.hpp> #include <uhd/types/dict.hpp> #include <boost/thread.hpp> -#include <boost/foreach.hpp> #include <boost/asio.hpp> //used for htonl and ntohl #include <boost/assign/list_of.hpp> #include <boost/format.hpp> diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index ee2434fab..24756f0ef 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -29,7 +29,6 @@ #include <uhd/utils/byteswap.hpp> #include <uhd/utils/safe_call.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> #include <boost/assign/list_of.hpp> @@ -54,7 +53,7 @@ device_addrs_t usrp2_find(const device_addr_t &hint_){ if (hints.size() > 1){ device_addrs_t found_devices; std::string error_msg; - BOOST_FOREACH(const device_addr_t &hint_i, hints){ + for(const device_addr_t &hint_i: hints){ device_addrs_t found_devices_i = usrp2_find(hint_i); if (found_devices_i.size() != 1) error_msg += str(boost::format( "Could not resolve device hint \"%s\" to a single device." @@ -81,7 +80,7 @@ device_addrs_t usrp2_find(const device_addr_t &hint_){ //if no address was specified, send a broadcast on each interface if (not hint.has_key("addr")){ - BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()){ + for(const if_addrs_t &if_addrs: get_if_addrs()){ //avoid the loopback device if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue; @@ -284,7 +283,7 @@ static zero_copy_if::sptr make_xport( //only copy hints that contain the filter word device_addr_t filtered_hints; - BOOST_FOREACH(const std::string &key, hints.keys()){ + for(const std::string &key: hints.keys()){ if (key.find(filter) == std::string::npos) continue; filtered_hints[key] = hints[key]; } @@ -547,7 +546,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : } if (_mbc[mb].gps and _mbc[mb].gps->gps_detected()) { - BOOST_FOREACH(const std::string &name, _mbc[mb].gps->get_sensors()) + for(const std::string &name: _mbc[mb].gps->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&gps_ctrl::get_sensor, _mbc[mb].gps, name)); @@ -743,12 +742,12 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : //bind frontend corrections to the dboard freq props const fs_path db_tx_fe_path = mb_path / "dboards" / "A" / "tx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)){ + for(const std::string &name: _tree->list(db_tx_fe_path)){ _tree->access<double>(db_tx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&usrp2_impl::set_tx_fe_corrections, this, mb, _1)); } const fs_path db_rx_fe_path = mb_path / "dboards" / "A" / "rx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)){ + for(const std::string &name: _tree->list(db_rx_fe_path)){ _tree->access<double>(db_rx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&usrp2_impl::set_rx_fe_corrections, this, mb, _1)); } @@ -759,14 +758,14 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : //do some post-init tasks this->update_rates(); - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ fs_path root = "/mboards/" + mb; //reset cordic rates and their properties to zero - BOOST_FOREACH(const std::string &name, _tree->list(root / "rx_dsps")){ + for(const std::string &name: _tree->list(root / "rx_dsps")){ _tree->access<double>(root / "rx_dsps" / name / "freq" / "value").set(0.0); } - BOOST_FOREACH(const std::string &name, _tree->list(root / "tx_dsps")){ + for(const std::string &name: _tree->list(root / "tx_dsps")){ _tree->access<double>(root / "tx_dsps" / name / "freq" / "value").set(0.0); } @@ -787,7 +786,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : } usrp2_impl::~usrp2_impl(void){UHD_SAFE_CALL( - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ _mbc[mb].tx_dsp->set_updates(0, 0); } )} diff --git a/host/lib/usrp/usrp_c.cpp b/host/lib/usrp/usrp_c.cpp index 943f96db0..4d144fcaa 100644 --- a/host/lib/usrp/usrp_c.cpp +++ b/host/lib/usrp/usrp_c.cpp @@ -23,7 +23,6 @@ #include <uhd/error.h> #include <uhd/usrp/usrp.h> -#include <boost/foreach.hpp> #include <boost/thread/mutex.hpp> #include <string.h> @@ -259,7 +258,7 @@ uhd_error uhd_usrp_find( uhd::device_addrs_t devs = uhd::device::find(std::string(args), uhd::device::USRP); (*strings_out)->string_vector_cpp.clear(); - BOOST_FOREACH(const uhd::device_addr_t &dev, devs){ + for(const uhd::device_addr_t &dev: devs){ (*strings_out)->string_vector_cpp.push_back(dev.to_string()); } ) diff --git a/host/lib/usrp/x300/x300_adc_ctrl.cpp b/host/lib/usrp/x300/x300_adc_ctrl.cpp index fed2ffaf7..d9d0cb168 100644 --- a/host/lib/usrp/x300/x300_adc_ctrl.cpp +++ b/host/lib/usrp/x300/x300_adc_ctrl.cpp @@ -21,7 +21,6 @@ #include <uhd/utils/log.hpp> #include <uhd/utils/safe_call.hpp> #include <uhd/exception.hpp> -#include <boost/foreach.hpp> using namespace uhd; diff --git a/host/lib/usrp/x300/x300_dac_ctrl.cpp b/host/lib/usrp/x300/x300_dac_ctrl.cpp index 162eeb143..eb36f0798 100644 --- a/host/lib/usrp/x300/x300_dac_ctrl.cpp +++ b/host/lib/usrp/x300/x300_dac_ctrl.cpp @@ -22,7 +22,6 @@ #include <uhd/utils/log.hpp> #include <uhd/utils/safe_call.hpp> #include <uhd/exception.hpp> -#include <boost/foreach.hpp> #include <boost/thread/thread.hpp> //sleep #define X300_DAC_FRONTEND_SYNC_FAILURE_FATAL diff --git a/host/lib/usrp/x300/x300_dboard_iface.cpp b/host/lib/usrp/x300/x300_dboard_iface.cpp index 092c888b0..e492fe2b3 100644 --- a/host/lib/usrp/x300/x300_dboard_iface.cpp +++ b/host/lib/usrp/x300/x300_dboard_iface.cpp @@ -34,7 +34,7 @@ x300_dboard_iface::x300_dboard_iface(const x300_dboard_iface_config_t &config): //reset the aux dacs _dac_regs[UNIT_RX] = ad5623_regs_t(); _dac_regs[UNIT_TX] = ad5623_regs_t(); - BOOST_FOREACH(unit_t unit, _dac_regs.keys()) + for(unit_t unit: _dac_regs.keys()) { _dac_regs[unit].data = 1; _dac_regs[unit].addr = ad5623_regs_t::ADDR_ALL; diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp index a2cbcc908..593873569 100644 --- a/host/lib/usrp/x300/x300_fw_uart.cpp +++ b/host/lib/usrp/x300/x300_fw_uart.cpp @@ -22,7 +22,6 @@ #include <uhd/types/serial.hpp> #include <uhd/exception.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/thread/thread.hpp> using namespace uhd; @@ -65,7 +64,7 @@ struct x300_uart_iface : uart_iface void write_uart(const std::string &buff) { boost::mutex::scoped_lock(_write_mutex); - BOOST_FOREACH(const char ch, buff) + for(const char ch: buff) { this->putchar(ch); } diff --git a/host/lib/usrp/x300/x300_image_loader.cpp b/host/lib/usrp/x300/x300_image_loader.cpp index f08b21f9b..e8c2a1329 100644 --- a/host/lib/usrp/x300/x300_image_loader.cpp +++ b/host/lib/usrp/x300/x300_image_loader.cpp @@ -167,7 +167,7 @@ static void x300_setup_session(x300_session_t &session, std::string err_msg = "Could not resolve given args to a single X-Series device.\n" "Applicable devices:\n"; - BOOST_FOREACH(const uhd::device_addr_t &dev, devs){ + for(const uhd::device_addr_t &dev: devs){ std::string identifier = dev.has_key("addr") ? "addr" : "resource"; diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index edf254130..116e1e6eb 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -28,7 +28,6 @@ #include <uhd/utils/safe_call.hpp> #include <uhd/usrp/subdev_spec.hpp> #include <uhd/transport/if_addrs.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/make_shared.hpp> #include <boost/functional/hash.hpp> @@ -183,7 +182,7 @@ static device_addrs_t x300_find_pcie(const device_addr_t &hint, bool explicit_qu nirio_status status = niusrprio_session::enumerate(rpc_port_name, dev_info_vtr); if (explicit_query) nirio_status_to_exception(status, "x300_find_pcie: Error enumerating NI-RIO devices."); - BOOST_FOREACH(niusrprio_session::device_info &dev_info, dev_info_vtr) + for(niusrprio_session::device_info &dev_info: dev_info_vtr) { device_addr_t new_addr; new_addr["type"] = "x300"; @@ -278,7 +277,7 @@ device_addrs_t x300_find(const device_addr_t &hint_) { device_addrs_t found_devices; std::string error_msg; - BOOST_FOREACH(const device_addr_t &hint_i, hints) + for(const device_addr_t &hint_i: hints) { device_addrs_t found_devices_i = x300_find(hint_i); if (found_devices_i.size() != 1) error_msg += str(boost::format( @@ -322,7 +321,7 @@ device_addrs_t x300_find(const device_addr_t &hint_) if (!hint.has_key("resource")) { //otherwise, no address was specified, send a broadcast on each interface - BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()) + for(const if_addrs_t &if_addrs: get_if_addrs()) { //avoid the loopback device if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue; @@ -396,9 +395,9 @@ static void thread_msg_handler(uhd::msg::type_t type, const std::string &msg) if (msg == thread_final_msg) { - BOOST_FOREACH(const thread_map_t::value_type &thread_pair, thread_list) + for(const thread_map_t::value_type &thread_pair: thread_list) { - BOOST_FOREACH(const msg_pair_t &msg_pair, thread_pair.second) + for(const msg_pair_t &msg_pair: thread_pair.second) { // Forward the message to the default handler uhd::msg::default_msg_handler(msg_pair.first, msg_pair.second); @@ -469,7 +468,7 @@ void x300_impl::mboard_members_t::discover_eth( mb_eeprom_addrs.push_back(mb_eeprom[key]); } - BOOST_FOREACH(const std::string& addr, ip_addrs) { + for(const std::string& addr: ip_addrs) { x300_eth_conn_t conn_iface; conn_iface.addr = addr; conn_iface.type = X300_IFACE_NONE; @@ -626,7 +625,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) _tree->create<double>(mb_path / "link_max_rate").set(X300_MAX_RATE_PCIE); } - BOOST_FOREACH(const std::string &key, dev_addr.keys()) + for(const std::string &key: dev_addr.keys()) { if (key.find("recv") != std::string::npos) mb.recv_args[key] = dev_addr[key]; if (key.find("send") != std::string::npos) mb.send_args[key] = dev_addr[key]; @@ -932,7 +931,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) } if (mb.gps and mb.gps->gps_detected()) { - BOOST_FOREACH(const std::string &name, mb.gps->get_sensors()) + for(const std::string &name: mb.gps->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&gps_ctrl::get_sensor, mb.gps, name)); @@ -1015,7 +1014,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) radio_ids.resize(2); } - BOOST_FOREACH(const rfnoc::block_id_t &id, radio_ids) { + for(const rfnoc::block_id_t &id: radio_ids) { rfnoc::x300_radio_ctrl_impl::sptr radio(get_block_ctrl<rfnoc::x300_radio_ctrl_impl>(id)); mb.radios.push_back(radio); radio->setup_radio( @@ -1063,7 +1062,7 @@ x300_impl::~x300_impl(void) { try { - BOOST_FOREACH(mboard_members_t &mb, _mb) + for(mboard_members_t &mb: _mb) { //kill the claimer task and unclaim the device mb.claimer_task.reset(); @@ -1432,7 +1431,7 @@ void x300_impl::update_clock_source(mboard_members_t &mb, const std::string &sou } // Reset ADCs and DACs - BOOST_FOREACH(rfnoc::x300_radio_ctrl_impl::sptr r, mb.radios) { + for(rfnoc::x300_radio_ctrl_impl::sptr r: mb.radios) { r->reset_codec(); } } @@ -1464,7 +1463,7 @@ void x300_impl::update_time_source(mboard_members_t &mb, const std::string &sour void x300_impl::sync_times(mboard_members_t &mb, const uhd::time_spec_t& t) { std::vector<rfnoc::block_id_t> radio_ids = find_blocks<rfnoc::x300_radio_ctrl_impl>("Radio"); - BOOST_FOREACH(const rfnoc::block_id_t &id, radio_ids) { + for(const rfnoc::block_id_t &id: radio_ids) { get_block_ctrl<rfnoc::x300_radio_ctrl_impl>(id)->set_time_sync(t); } diff --git a/host/lib/usrp/x300/x300_io_impl.cpp b/host/lib/usrp/x300/x300_io_impl.cpp index 1584cee24..4dd9dce8a 100644 --- a/host/lib/usrp/x300/x300_io_impl.cpp +++ b/host/lib/usrp/x300/x300_io_impl.cpp @@ -26,7 +26,6 @@ #include <uhd/utils/tasks.hpp> #include <uhd/utils/log.hpp> #include <uhd/utils/msg.hpp> -#include <boost/foreach.hpp> #include <boost/make_shared.hpp> using namespace uhd; @@ -73,7 +72,7 @@ void x300_impl::post_streamer_hooks(direction_t dir) // Loop through all tx streamers. Find all radios connected to one // streamer. Sync those. - BOOST_FOREACH(const boost::weak_ptr<uhd::tx_streamer> &streamer_w, _tx_streamers.vals()) { + for(const boost::weak_ptr<uhd::tx_streamer> &streamer_w: _tx_streamers.vals()) { const boost::shared_ptr<sph::send_packet_streamer> streamer = boost::dynamic_pointer_cast<sph::send_packet_streamer>(streamer_w.lock()); if (not streamer) { diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 9bf61f998..31a977884 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -82,7 +82,7 @@ UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(x300_radio_ctrl) if (_radio_type==PRIMARY) { _fp_gpio = gpio_atr::gpio_atr_3000::make(ctrl, regs::sr_addr(regs::FP_GPIO), regs::RB_FP_GPIO); - BOOST_FOREACH(const gpio_atr::gpio_attr_map_t::value_type attr, gpio_atr::gpio_attr_map) { + for(const gpio_atr::gpio_attr_map_t::value_type attr: gpio_atr::gpio_attr_map) { _tree->create<uint32_t>(fs_path("gpio") / "FP0" / attr.second) .set(0) .add_coerced_subscriber(boost::bind(&gpio_atr::gpio_atr_3000::set_gpio_attr, _fp_gpio, attr.first, _1)); @@ -149,7 +149,7 @@ x300_radio_ctrl_impl::~x300_radio_ctrl_impl() _tree->remove(_root_path / "rx_fe_corrections"); _tree->remove(_root_path / "tx_fe_corrections"); if (_radio_type==PRIMARY) { - BOOST_FOREACH(const gpio_atr::gpio_attr_map_t::value_type attr, gpio_atr::gpio_attr_map) { + for(const gpio_atr::gpio_attr_map_t::value_type attr: gpio_atr::gpio_attr_map) { _tree->remove(fs_path("gpio") / "FP0" / attr.second); } _tree->remove(fs_path("gpio") / "FP0" / "READBACK"); @@ -380,7 +380,7 @@ void x300_radio_ctrl_impl::setup_radio( ); size_t rx_chan = 0, tx_chan = 0; - BOOST_FOREACH(const std::string& fe, _db_manager->get_rx_frontends()) { + for(const std::string& fe: _db_manager->get_rx_frontends()) { if (rx_chan >= _get_num_radios()) { break; } @@ -393,7 +393,7 @@ void x300_radio_ctrl_impl::setup_radio( _rx_fe_map[rx_chan].core->set_fe_connection(usrp::fe_connection_t(conn, if_freq)); rx_chan++; } - BOOST_FOREACH(const std::string& fe, _db_manager->get_tx_frontends()) { + for(const std::string& fe: _db_manager->get_tx_frontends()) { if (tx_chan >= _get_num_radios()) { break; } diff --git a/host/lib/usrp_clock/multi_usrp_clock.cpp b/host/lib/usrp_clock/multi_usrp_clock.cpp index 71521190e..4477b045e 100644 --- a/host/lib/usrp_clock/multi_usrp_clock.cpp +++ b/host/lib/usrp_clock/multi_usrp_clock.cpp @@ -23,7 +23,6 @@ #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> using namespace uhd; diff --git a/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp b/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp index b0d24deec..d18f94278 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp @@ -25,7 +25,6 @@ #include <boost/assign/list_of.hpp> #include <boost/asio.hpp> #include <boost/lexical_cast.hpp> -#include <boost/foreach.hpp> #include <iostream> diff --git a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp index d3502113e..f317106a3 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp @@ -140,7 +140,7 @@ static void octoclock_setup_session(octoclock_session_t &session, std::string err_msg = "Could not resolve given args to a single OctoClock device.\n" "Applicable devices:\n"; - BOOST_FOREACH(const uhd::device_addr_t &dev, devs){ + for(const uhd::device_addr_t &dev: devs){ std::string name = (dev["type"] == "octoclock") ? str(boost::format("OctoClock r%d") % dev.get("revision","4")) : "OctoClock Bootloader"; diff --git a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp index 4da9db19f..1bd798bae 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp @@ -21,7 +21,6 @@ #include <boost/assign.hpp> #include <stdint.h> #include <boost/filesystem.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/thread.hpp> @@ -57,7 +56,7 @@ device_addrs_t octoclock_find(const device_addr_t &hint){ if (hints.size() > 1){ device_addrs_t found_devices; std::string error_msg; - BOOST_FOREACH(const device_addr_t &hint_i, hints){ + for(const device_addr_t &hint_i: hints){ device_addrs_t found_devices_i = octoclock_find(hint_i); if (found_devices_i.size() != 1) error_msg += str(boost::format( "Could not resolve device hint \"%s\" to a single device." @@ -84,7 +83,7 @@ device_addrs_t octoclock_find(const device_addr_t &hint){ //If no address was specified, send a broadcast on each interface if (not _hint.has_key("addr")){ - BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()){ + for(const if_addrs_t &if_addrs: get_if_addrs()){ //avoid the loopback device if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue; @@ -275,7 +274,7 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ _oc_dict[oc].gps = gps_ctrl::make(octoclock_make_uart_iface(_oc_dict[oc].gpsdo_xport, _proto_ver)); if(_oc_dict[oc].gps and _oc_dict[oc].gps->gps_detected()){ - BOOST_FOREACH(const std::string &name, _oc_dict[oc].gps->get_sensors()){ + for(const std::string &name: _oc_dict[oc].gps->get_sensors()){ _tree->create<sensor_value_t>(oc_path / "sensors" / name) .set_publisher(boost::bind(&gps_ctrl::get_sensor, _oc_dict[oc].gps, name)); } @@ -324,7 +323,7 @@ void octoclock_impl::_set_eeprom(const std::string &oc, const octoclock_eeprom_t * what it currently has in the EEPROM, so store the relevant values * from the user's input and send that instead. */ - BOOST_FOREACH(const std::string &key, oc_eeprom.keys()){ + for(const std::string &key: oc_eeprom.keys()){ if(_oc_dict[oc].eeprom.has_key(key)) _oc_dict[oc].eeprom[key] = oc_eeprom[key]; } _oc_dict[oc].eeprom.commit(); diff --git a/host/lib/usrp_clock/usrp_clock_c.cpp b/host/lib/usrp_clock/usrp_clock_c.cpp index 220112f37..274eba5d1 100644 --- a/host/lib/usrp_clock/usrp_clock_c.cpp +++ b/host/lib/usrp_clock/usrp_clock_c.cpp @@ -22,7 +22,6 @@ #include <uhd/usrp_clock/usrp_clock.h> -#include <boost/foreach.hpp> #include <boost/thread/mutex.hpp> #include <string.h> @@ -64,7 +63,7 @@ uhd_error uhd_usrp_clock_find( uhd::device_addrs_t devs = uhd::device::find(std::string(args), uhd::device::CLOCK); devices_out->string_vector_cpp.clear(); - BOOST_FOREACH(const uhd::device_addr_t &dev, devs){ + for(const uhd::device_addr_t &dev: devs){ devices_out->string_vector_cpp.push_back(dev.to_string()); } ) diff --git a/host/lib/utils/csv.cpp b/host/lib/utils/csv.cpp index 2ffa70196..e0cadcb96 100644 --- a/host/lib/utils/csv.cpp +++ b/host/lib/utils/csv.cpp @@ -16,7 +16,6 @@ // #include <uhd/utils/csv.hpp> -#include <boost/foreach.hpp> using namespace uhd; @@ -29,7 +28,7 @@ csv::rows_type csv::to_rows(std::istream &input){ bool in_quote = false; char last_ch, next_ch = ' '; //for each character in the line - BOOST_FOREACH(char ch, line){ + for(char ch: line){ last_ch = next_ch; next_ch = ch; //catch a quote character and change the state diff --git a/host/lib/utils/gain_group.cpp b/host/lib/utils/gain_group.cpp index 71caf33be..be5b55444 100644 --- a/host/lib/utils/gain_group.cpp +++ b/host/lib/utils/gain_group.cpp @@ -20,7 +20,6 @@ #include <uhd/types/dict.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/exception.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <algorithm> #include <vector> @@ -73,7 +72,7 @@ public: if (not name.empty()) return _name_to_fcns.get(name).get_range(); double overall_min = 0, overall_max = 0, overall_step = 0; - BOOST_FOREACH(const gain_fcns_t &fcns, get_all_fcns()){ + for(const gain_fcns_t &fcns: get_all_fcns()){ const gain_range_t range = fcns.get_range(); overall_min += range.start(); overall_max += range.stop(); @@ -88,7 +87,7 @@ public: if (not name.empty()) return _name_to_fcns.get(name).get_value(); double overall_gain = 0; - BOOST_FOREACH(const gain_fcns_t &fcns, get_all_fcns()){ + for(const gain_fcns_t &fcns: get_all_fcns()){ overall_gain += fcns.get_value(); } return overall_gain; @@ -102,7 +101,7 @@ public: //get the max step size among the gains double max_step = 0; - BOOST_FOREACH(const gain_fcns_t &fcns, all_fcns){ + for(const gain_fcns_t &fcns: all_fcns){ max_step = std::max(max_step, fcns.get_range().step()); } @@ -111,7 +110,7 @@ public: //distribute power according to priority (round to max step) double gain_left_to_distribute = gain; - BOOST_FOREACH(const gain_fcns_t &fcns, all_fcns){ + for(const gain_fcns_t &fcns: all_fcns){ const gain_range_t range = fcns.get_range(); gain_bucket.push_back(floor_step(uhd::clip( gain_left_to_distribute, range.start(), range.stop() @@ -135,7 +134,7 @@ public: //distribute the remainder (less than max step) //fill in the largest step sizes first that are less than the remainder - BOOST_FOREACH(size_t i, indexes_step_size_dec){ + for(size_t i: indexes_step_size_dec){ const gain_range_t range = all_fcns.at(i).get_range(); double additional_gain = floor_step(uhd::clip( gain_bucket.at(i) + gain_left_to_distribute, range.start(), range.stop() @@ -173,7 +172,7 @@ private: //! get the gain function sets in order (highest priority first) std::vector<gain_fcns_t> get_all_fcns(void){ std::vector<gain_fcns_t> all_fcns; - BOOST_FOREACH(size_t key, uhd::sorted(_registry.keys())){ + for(size_t key: uhd::sorted(_registry.keys())){ const std::vector<gain_fcns_t> &fcns = _registry[key]; all_fcns.insert(all_fcns.begin(), fcns.begin(), fcns.end()); } diff --git a/host/lib/utils/load_modules.cpp b/host/lib/utils/load_modules.cpp index aba3adeed..3ef3c418c 100644 --- a/host/lib/utils/load_modules.cpp +++ b/host/lib/utils/load_modules.cpp @@ -19,7 +19,6 @@ #include <uhd/utils/static.hpp> #include <uhd/exception.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/filesystem.hpp> #include <iostream> #include <string> @@ -102,7 +101,7 @@ static void load_module_path(const fs::path &path){ * Load all the modules given in the module paths. */ UHD_STATIC_BLOCK(load_modules){ - BOOST_FOREACH(const fs::path &path, uhd::get_module_paths()){ + for(const fs::path &path: uhd::get_module_paths()){ load_module_path(path); } } diff --git a/host/lib/utils/msg.cpp b/host/lib/utils/msg.cpp index d9d2fb66a..9a125515d 100644 --- a/host/lib/utils/msg.cpp +++ b/host/lib/utils/msg.cpp @@ -19,7 +19,6 @@ #include <uhd/utils/log.hpp> #include <uhd/utils/static.hpp> #include <boost/thread/mutex.hpp> -#include <boost/foreach.hpp> #include <boost/tokenizer.hpp> #include <sstream> #include <iostream> @@ -35,7 +34,7 @@ static void msg_to_cout(const std::string &msg){ std::stringstream ss; static bool just_had_a_newline = true; - BOOST_FOREACH(char ch, msg){ + for(char ch: msg){ if (just_had_a_newline){ just_had_a_newline = false; ss << "-- "; @@ -53,7 +52,7 @@ static void msg_to_cerr(const std::string &title, const std::string &msg){ std::stringstream ss; ss << std::endl << title << ":" << std::endl; - BOOST_FOREACH(const std::string &line, tokenizer(msg, "\n")){ + for(const std::string &line: tokenizer(msg, "\n")){ ss << " " << line << std::endl; } diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index 38839c8d4..5d53f95bd 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -22,7 +22,6 @@ #include <boost/algorithm/string.hpp> #include <boost/bind.hpp> #include <boost/filesystem.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/regex.hpp> #include <boost/tokenizer.hpp> @@ -98,7 +97,7 @@ static std::vector<std::string> get_env_paths(const std::string &var_name){ //convert to full filesystem path, filter blank paths if (var_value.empty()) return paths; - BOOST_FOREACH(const std::string &path_string, path_tokenizer(var_value)){ + for(const std::string &path_string: path_tokenizer(var_value)){ if (path_string.empty()) continue; paths.push_back(fs::system_complete(path_string).string()); } @@ -190,7 +189,7 @@ std::vector<fs::path> uhd::get_module_paths(void){ std::vector<fs::path> paths; std::vector<std::string> env_paths = get_env_paths("UHD_MODULE_PATH"); - BOOST_FOREACH(std::string &str_path, env_paths) { + for(std::string &str_path: env_paths) { paths.push_back(str_path); } @@ -272,7 +271,7 @@ std::string uhd::get_images_dir(const std::string &search_paths) { /* We will start by looking for a path indicated by the `UHD_IMAGES_DIR` * environment variable. */ std::vector<std::string> env_paths = get_env_paths("UHD_IMAGES_DIR"); - BOOST_FOREACH(possible_dir, env_paths) { + for(auto possible_dir: env_paths) { if (fs::is_directory(fs::path(possible_dir))) { return possible_dir; } @@ -293,7 +292,7 @@ std::string uhd::get_images_dir(const std::string &search_paths) { std::vector<std::string> search_paths_vector; boost::split(search_paths_vector, _search_paths, boost::is_any_of(",;")); - BOOST_FOREACH(std::string& search_path, search_paths_vector) { + for(std::string& search_path: search_paths_vector) { boost::algorithm::trim(search_path); if (search_path.empty()) continue; diff --git a/host/tests/addr_test.cpp b/host/tests/addr_test.cpp index 61bb6d049..92863e44f 100644 --- a/host/tests/addr_test.cpp +++ b/host/tests/addr_test.cpp @@ -20,7 +20,6 @@ #include <uhd/types/device_addr.hpp> #include <uhd/usrp/dboard_id.hpp> #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <algorithm> #include <iostream> diff --git a/host/tests/blockdef_test.cpp b/host/tests/blockdef_test.cpp index 11ddc4b59..5ca8a2472 100644 --- a/host/tests/blockdef_test.cpp +++ b/host/tests/blockdef_test.cpp @@ -21,7 +21,6 @@ #include <boost/assign/list_of.hpp> #include <boost/test/unit_test.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <uhd/rfnoc/blockdef.hpp> using namespace uhd::rfnoc; diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp index dd04dcafc..b4a616133 100644 --- a/host/tests/convert_test.cpp +++ b/host/tests/convert_test.cpp @@ -17,7 +17,6 @@ #include <uhd/convert.hpp> #include <boost/test/unit_test.hpp> -#include <boost/foreach.hpp> #include <stdint.h> #include <boost/assign/list_of.hpp> #include <complex> @@ -75,7 +74,7 @@ static void test_convert_types_sc16( ){ //fill the input samples std::vector<sc16_t> input(nsamps), output(nsamps); - BOOST_FOREACH(sc16_t &in, input) in = sc16_t( + for(sc16_t &in: input) in = sc16_t( short((float((std::rand())/(double(RAND_MAX)/2)) - 1)*32767/extra_div), short((float((std::rand())/(double(RAND_MAX)/2)) - 1)*32767/extra_div) ); @@ -126,7 +125,7 @@ static void test_convert_types_for_floats( //fill the input samples std::vector<data_type> input(nsamps), output(nsamps); - BOOST_FOREACH(data_type &in, input) in = data_type( + for(data_type &in: input) in = data_type( ((std::rand()/(value_type(RAND_MAX)/2)) - 1)*float(extra_scale), ((std::rand()/(value_type(RAND_MAX)/2)) - 1)*float(extra_scale) ); @@ -145,7 +144,7 @@ static void test_convert_types_for_floats( ; //loopback foreach prio combo (generic vs best) - BOOST_FOREACH(const int_pair_t &prio, prios){ + for(const int_pair_t &prio: prios){ loopback(nsamps, in_id, out_id, input, output, prio.first, prio.second); for (size_t i = 0; i < nsamps; i++){ MY_CHECK_CLOSE(input[i].real(), output[i].real(), value_type(1./(1 << 14))); @@ -284,7 +283,7 @@ BOOST_AUTO_TEST_CASE(test_convert_types_fc32_to_sc16){ const size_t nsamps = 13; std::vector<fc32_t> input(nsamps); - BOOST_FOREACH(fc32_t &in, input) in = fc32_t( + for(fc32_t &in: input) in = fc32_t( (std::rand()/(RAND_MAX/2.0)) - 1, (std::rand()/(RAND_MAX/2.0)) - 1 ); @@ -329,7 +328,7 @@ BOOST_AUTO_TEST_CASE(test_convert_types_sc16_to_fc32){ const size_t nsamps = 13; std::vector<sc16_t> input(nsamps); - BOOST_FOREACH(sc16_t &in, input) in = sc16_t( + for(sc16_t &in: input) in = sc16_t( std::rand()-(RAND_MAX/2), std::rand()-(RAND_MAX/2) ); @@ -424,9 +423,9 @@ static void test_convert_types_u8( ){ //fill the input samples std::vector<uint8_t> input(nsamps), output(nsamps); - BOOST_FOREACH(uint8_t &in, input) in = uint8_t(std::rand() & 0xFF); + for(uint8_t &in: input) in = uint8_t(std::rand() & 0xFF); //uint32_t d = 48; - //BOOST_FOREACH(uint8_t &in, input) in = d++; + //for(uint8_t &in: input) in = d++; //run the loopback and test convert::id_type in_id = id; @@ -464,7 +463,7 @@ static void test_convert_types_s8( ){ //fill the input samples std::vector<int8_t> input(nsamps), output(nsamps); - BOOST_FOREACH(int8_t &in, input) in = int8_t(std::rand() & 0xFF); + for(int8_t &in: input) in = int8_t(std::rand() & 0xFF); //run the loopback and test convert::id_type in_id = id; @@ -502,7 +501,7 @@ static void test_convert_types_s16( ){ //fill the input samples std::vector<int16_t> input(nsamps), output(nsamps); - BOOST_FOREACH(int16_t &in, input) in = int16_t(std::rand() & 0xFFFF); + for(int16_t &in: input) in = int16_t(std::rand() & 0xFFFF); //run the loopback and test convert::id_type in_id = id; @@ -540,7 +539,7 @@ static void test_convert_types_fc32( ){ //fill the input samples std::vector< std::complex<float> > input(nsamps), output(nsamps); - BOOST_FOREACH(fc32_t &in, input) in = fc32_t( + for(fc32_t &in: input) in = fc32_t( (std::rand()/float(RAND_MAX/2)) - 1, (std::rand()/float(RAND_MAX/2)) - 1 ); @@ -581,7 +580,7 @@ static void test_convert_types_f32( ){ //fill the input samples std::vector<float> input(nsamps), output(nsamps); - BOOST_FOREACH(float &in, input) in = float((float(std::rand())/float(RAND_MAX/2)) - 1); + for(float &in: input) in = float((float(std::rand())/float(RAND_MAX/2)) - 1); //run the loopback and test convert::id_type in_id = id; diff --git a/host/tests/graph_search_test.cpp b/host/tests/graph_search_test.cpp index 8c96bb954..d39f767e9 100644 --- a/host/tests/graph_search_test.cpp +++ b/host/tests/graph_search_test.cpp @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(test_linear_downstream_search) std::cout << "size: " << result.size() << std::endl; BOOST_CHECK_EQUAL(result.size(), 1); BOOST_CHECK_EQUAL(result[0]->get_test_id(), "node_B"); - BOOST_FOREACH(const result_node::sptr &node, result) { + for(const result_node::sptr &node: result) { std::cout << node->get_test_id() << std::endl; } } @@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(test_multi_iter_downstream_search) // This time, we search for result_node std::vector< result_node::sptr > result = node_A->find_downstream_node<result_node>(); BOOST_REQUIRE(result.size() == 4); - BOOST_FOREACH(const result_node::sptr &node, result) { + for(const result_node::sptr &node: result) { std::cout << node->get_test_id() << std::endl; } } @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(test_multi_iter_cycle_downstream_search) // This time, we search for result_node std::vector< result_node::sptr > result = node_A->find_downstream_node<result_node>(); BOOST_REQUIRE(result.size() == 4); - BOOST_FOREACH(const result_node::sptr &node, result) { + for(const result_node::sptr &node: result) { std::cout << node->get_test_id() << std::endl; } } diff --git a/host/tests/nocscript_expr_test.cpp b/host/tests/nocscript_expr_test.cpp index f82a613a3..31bbc8725 100644 --- a/host/tests/nocscript_expr_test.cpp +++ b/host/tests/nocscript_expr_test.cpp @@ -18,7 +18,6 @@ #include "../lib/rfnoc/nocscript/function_table.hpp" #include <boost/test/unit_test.hpp> #include <boost/test/floating_point_comparison.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/make_shared.hpp> #include <boost/format.hpp> diff --git a/host/tests/nocscript_ftable_test.cpp b/host/tests/nocscript_ftable_test.cpp index 283245132..546da0c2c 100644 --- a/host/tests/nocscript_ftable_test.cpp +++ b/host/tests/nocscript_ftable_test.cpp @@ -19,7 +19,6 @@ #include <boost/test/unit_test.hpp> #include <boost/test/floating_point_comparison.hpp> #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/make_shared.hpp> #include <algorithm> diff --git a/host/tests/nocscript_parser_test.cpp b/host/tests/nocscript_parser_test.cpp index a9c25977e..c21f40ad6 100644 --- a/host/tests/nocscript_parser_test.cpp +++ b/host/tests/nocscript_parser_test.cpp @@ -21,7 +21,6 @@ #include <boost/test/unit_test.hpp> #include <boost/test/floating_point_comparison.hpp> #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/make_shared.hpp> #include <algorithm> diff --git a/host/tests/subdev_spec_test.cpp b/host/tests/subdev_spec_test.cpp index aa0b9a119..2c4747fa9 100644 --- a/host/tests/subdev_spec_test.cpp +++ b/host/tests/subdev_spec_test.cpp @@ -17,7 +17,6 @@ #include <boost/test/unit_test.hpp> #include <uhd/usrp/subdev_spec.hpp> -#include <boost/foreach.hpp> #include <iostream> BOOST_AUTO_TEST_CASE(test_subdevice_spec){ diff --git a/host/tests/time_spec_test.cpp b/host/tests/time_spec_test.cpp index 76dfb1930..9ff89ab0e 100644 --- a/host/tests/time_spec_test.cpp +++ b/host/tests/time_spec_test.cpp @@ -17,7 +17,6 @@ #include <boost/test/unit_test.hpp> #include <uhd/types/time_spec.hpp> -#include <boost/foreach.hpp> #include <boost/thread.hpp> //sleep #include <iostream> #include <iomanip> diff --git a/host/utils/converter_benchmark.cpp b/host/utils/converter_benchmark.cpp index f6d7e9650..ba4819f49 100644 --- a/host/utils/converter_benchmark.cpp +++ b/host/utils/converter_benchmark.cpp @@ -354,7 +354,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) boost::is_any_of(","), // Split at , boost::token_compress_on // Avoid empty results ); - BOOST_FOREACH(const std::string &this_prio, prios_in_list) { + for(const std::string &this_prio: prios_in_list) { size_t prio_index = boost::lexical_cast<size_t>(this_prio); converter::sptr conv_for_prio = get_converter(converter_id, prio_index)(); // Can throw a uhd::key_error conv_list[prio_index] = conv_for_prio; @@ -384,7 +384,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) /// Final configurations to the converter: std::cout << "Configuring converters:" << std::endl; - BOOST_FOREACH(priority_type prio_i, conv_list.keys()) { + for(priority_type prio_i: conv_list.keys()) { std::cout << "* [" << prio_i << "]: "; configure_conv(conv_list[prio_i], in_type, out_type); } @@ -393,7 +393,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) std::cout << "{{{" << std::endl; if (not debug_mode) { std::cout << "prio,duration_ms,avg_duration_ms,n_samples,iterations" << std::endl; - BOOST_FOREACH(priority_type prio_i, conv_list.keys()) { + for(priority_type prio_i: conv_list.keys()) { double duration = run_benchmark( conv_list[prio_i], input_buf_refs, diff --git a/host/utils/uhd_find_devices.cpp b/host/utils/uhd_find_devices.cpp index 0ef1055cf..e74307695 100644 --- a/host/utils/uhd_find_devices.cpp +++ b/host/utils/uhd_find_devices.cpp @@ -55,14 +55,14 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ for (auto it = device_addrs.begin(); it != device_addrs.end(); ++it) { std::string serial = (*it)["serial"]; found_devices[serial] = device_multi_addrs_t(); - BOOST_FOREACH (std::string key, it->keys()) { + for(std::string key: it->keys()) { if (key != "serial") { found_devices[serial][key].insert(it->get(key)); } } for (auto sit = it + 1; sit != device_addrs.end();) { if ((*sit)["serial"] == serial) { - BOOST_FOREACH (std::string key, sit->keys()) { + for(std::string key: sit->keys()) { if (key != "serial") { found_devices[serial][key].insert(sit->get(key)); } diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 293632342..9b02022a9 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -28,7 +28,6 @@ #include <uhd/types/sensors.hpp> #include <boost/program_options.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <iostream> #include <sstream> #include <vector> @@ -44,7 +43,7 @@ static std::string make_border(const std::string &text){ std::vector<std::string> lines; boost::split(lines, text, boost::is_any_of("\n")); while (lines.back().empty()) lines.pop_back(); //strip trailing newlines if (lines.size()) lines[0] = " " + lines[0]; //indent the title line - BOOST_FOREACH(const std::string &line, lines){ + for(const std::string &line: lines){ ss << boost::format("| %s") % line << std::endl; } //ss << boost::format(" \\_____________________________________________________") << std::endl; @@ -62,7 +61,7 @@ static std::string get_dsp_pp_string(const std::string &type, property_tree::spt static std::string prop_names_to_pp_string(const std::vector<std::string> &prop_names){ std::stringstream ss; size_t count = 0; - BOOST_FOREACH(const std::string &prop_name, prop_names){ + for(const std::string &prop_name: prop_names){ ss << ((count++)? ", " : "") << prop_name; } return ss.str(); @@ -82,7 +81,7 @@ static std::string get_frontend_pp_string(const std::string &type, property_tree std::vector<std::string> gain_names = tree->list(path / "gains"); if (gain_names.size() == 0) ss << "Gain Elements: None" << std::endl; - BOOST_FOREACH(const std::string &name, gain_names){ + for(const std::string &name: gain_names){ meta_range_t gain_range = tree->access<meta_range_t>(path / "gains" / name / "range").get(); ss << boost::format("Gain range %s: %.1f to %.1f step %.1f dB") % name % gain_range.start() % gain_range.stop() % gain_range.step() << std::endl; } @@ -106,7 +105,7 @@ static std::string get_codec_pp_string(const std::string &type, property_tree::s ss << boost::format("Name: %s") % (tree->access<std::string>(path / "name").get()) << std::endl; std::vector<std::string> gain_names = tree->list(path / "gains"); if (gain_names.size() == 0) ss << "Gain Elements: None" << std::endl; - BOOST_FOREACH(const std::string &name, gain_names){ + for(const std::string &name: gain_names){ meta_range_t gain_range = tree->access<meta_range_t>(path / "gains" / name / "range").get(); ss << boost::format("Gain range %s: %.1f to %.1f step %.1f dB") % name % gain_range.start() % gain_range.stop() % gain_range.step() << std::endl; } @@ -129,7 +128,7 @@ static std::string get_dboard_pp_string(const std::string &type, property_tree:: if (not gdb_eeprom.serial.empty()) ss << boost::format("Serial: %s") % gdb_eeprom.serial << std::endl; } } - BOOST_FOREACH(const std::string &name, tree->list(path / (prefix + "_frontends"))){ + for(const std::string &name: tree->list(path / (prefix + "_frontends"))){ ss << make_border(get_frontend_pp_string(type, tree, path / (prefix + "_frontends") / name)); } ss << make_border(get_codec_pp_string(type, tree, path.branch_path().branch_path() / (prefix + "_codecs") / path.leaf())); @@ -140,7 +139,7 @@ static std::string get_dboard_pp_string(const std::string &type, property_tree:: static std::string get_rfnoc_pp_string(property_tree::sptr tree, const fs_path &path){ std::stringstream ss; ss << "RFNoC blocks on this device:" << std::endl << std::endl; - BOOST_FOREACH(const std::string &name, tree->list(path)){ + for(const std::string &name: tree->list(path)){ ss << "* " << name << std::endl; } return ss.str(); @@ -151,7 +150,7 @@ static std::string get_mboard_pp_string(property_tree::sptr tree, const fs_path ss << boost::format("Mboard: %s") % (tree->access<std::string>(path / "name").get()) << std::endl; //ss << std::endl; usrp::mboard_eeprom_t mb_eeprom = tree->access<usrp::mboard_eeprom_t>(path / "eeprom").get(); - BOOST_FOREACH(const std::string &key, mb_eeprom.keys()){ + for(const std::string &key: mb_eeprom.keys()){ if (not mb_eeprom[key].empty()) ss << boost::format("%s: %s") % key % mb_eeprom[key] << std::endl; } if (tree->exists(path / "fw_version")){ @@ -178,19 +177,19 @@ static std::string get_mboard_pp_string(property_tree::sptr tree, const fs_path } ss << "Sensors: " << prop_names_to_pp_string(tree->list(path / "sensors")) << std::endl; if (tree->exists(path / "rx_dsps")){ - BOOST_FOREACH(const std::string &name, tree->list(path / "rx_dsps")){ + for(const std::string &name: tree->list(path / "rx_dsps")){ ss << make_border(get_dsp_pp_string("RX", tree, path / "rx_dsps" / name)); } } - BOOST_FOREACH(const std::string &name, tree->list(path / "dboards")){ + for(const std::string &name: tree->list(path / "dboards")){ ss << make_border(get_dboard_pp_string("RX", tree, path / "dboards" / name)); } if (tree->exists(path / "tx_dsps")){ - BOOST_FOREACH(const std::string &name, tree->list(path / "tx_dsps")){ + for(const std::string &name: tree->list(path / "tx_dsps")){ ss << make_border(get_dsp_pp_string("TX", tree, path / "tx_dsps" / name)); } } - BOOST_FOREACH(const std::string &name, tree->list(path / "dboards")){ + for(const std::string &name: tree->list(path / "dboards")){ ss << make_border(get_dboard_pp_string("TX", tree, path / "dboards" / name)); } ss << make_border(get_rfnoc_pp_string(tree, path / "xbar")); @@ -206,7 +205,7 @@ static std::string get_device_pp_string(property_tree::sptr tree){ std::stringstream ss; ss << boost::format("Device: %s") % (tree->access<std::string>("/name").get()) << std::endl; //ss << std::endl; - BOOST_FOREACH(const std::string &name, tree->list("/mboards")){ + for(const std::string &name: tree->list("/mboards")){ ss << make_border(get_mboard_pp_string(tree, "/mboards/" + name)); } return ss.str(); @@ -214,7 +213,7 @@ static std::string get_device_pp_string(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)){ + for(const std::string &name: tree->list(path)){ print_tree(path / name, tree); } } @@ -257,7 +256,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ if (vm.count("vector")) { std::vector<std::string> str_vector = tree->access< std::vector<std::string> >(vm["string"].as<std::string>()).get(); std::cout << "("; - BOOST_FOREACH(const std::string &str, str_vector) { + for(const std::string &str: str_vector) { std::cout << str << ","; } std::cout << ")" << std::endl; |