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/usrp/common | |
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/usrp/common')
-rw-r--r-- | host/lib/usrp/common/ad936x_manager.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/common/apply_corrections.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/common/constrained_device_args.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/common/max287x.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/common/validate_subdev_spec.cpp | 9 |
6 files changed, 11 insertions, 15 deletions
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" |