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/utils/gain_group.cpp | |
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/utils/gain_group.cpp')
-rw-r--r-- | host/lib/utils/gain_group.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
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()); } |