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/lib/rfnoc | |
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/lib/rfnoc')
-rw-r--r-- | host/lib/rfnoc/block_ctrl_base.cpp | 29 | ||||
-rw-r--r-- | host/lib/rfnoc/blockdef_xml_impl.cpp | 33 | ||||
-rw-r--r-- | host/lib/rfnoc/duc_block_ctrl_impl.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/legacy_compat.cpp | 12 | ||||
-rw-r--r-- | host/lib/rfnoc/nocscript/expression.cpp | 7 | ||||
-rw-r--r-- | host/lib/rfnoc/nocscript/function_table.cpp | 1 | ||||
-rw-r--r-- | host/lib/rfnoc/radio_ctrl_impl.cpp | 3 | ||||
-rw-r--r-- | host/lib/rfnoc/rx_stream_terminator.cpp | 15 | ||||
-rw-r--r-- | host/lib/rfnoc/sink_block_ctrl_base.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/sink_node_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/source_block_ctrl_base.cpp | 4 | ||||
-rw-r--r-- | host/lib/rfnoc/source_node_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/tick_node_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/tx_stream_terminator.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/utils.hpp | 4 |
15 files changed, 57 insertions, 63 deletions
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; |