aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2017-02-09 23:19:55 -0800
committerMartin Braun <martin.braun@ettus.com>2017-02-10 16:44:33 -0800
commit26cc20847cde543e759aa5cee9a27eaa69c5dd9e (patch)
treeeee102333381e2313af59e725d6b7a06b665161f /host/lib/usrp/usrp2
parentf3a004faf7d50cbb5564f5e2f67f54ee07e051dd (diff)
downloaduhd-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/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp1
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp2
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp22
-rw-r--r--host/lib/usrp/usrp2/n200_image_loader.cpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp1
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp21
6 files changed, 24 insertions, 27 deletions
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);
}
)}