diff options
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/property_tree.ipp | 7 | ||||
-rw-r--r-- | host/include/uhd/types/dict.ipp | 22 | ||||
-rw-r--r-- | host/include/uhd/utils/assert_has.ipp | 3 | ||||
-rw-r--r-- | host/include/uhd/utils/soft_register.hpp | 21 |
4 files changed, 24 insertions, 29 deletions
diff --git a/host/include/uhd/property_tree.ipp b/host/include/uhd/property_tree.ipp index 3bae2a451..73b3c737a 100644 --- a/host/include/uhd/property_tree.ipp +++ b/host/include/uhd/property_tree.ipp @@ -10,7 +10,6 @@ #define INCLUDED_UHD_PROPERTY_TREE_IPP #include <uhd/exception.hpp> -#include <boost/foreach.hpp> #include <typeindex> #include <vector> #include <memory> @@ -81,8 +80,7 @@ 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 } } @@ -90,8 +88,7 @@ public: 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/types/dict.ipp b/host/include/uhd/types/dict.ipp index 5a5024fcc..336a7dca9 100644 --- a/host/include/uhd/types/dict.ipp +++ b/host/include/uhd/types/dict.ipp @@ -1,6 +1,7 @@ // // Copyright 2010-2011 Ettus Research LLC // Copyright 2018 Ettus Research, a National Instruments Company +// Copyright 2019 Ettus Research, a National Instruments Brand // // SPDX-License-Identifier: GPL-3.0-or-later // @@ -9,7 +10,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> @@ -51,7 +51,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; @@ -60,7 +60,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; @@ -68,7 +68,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; @@ -76,7 +76,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; @@ -84,7 +84,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); @@ -97,7 +97,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); @@ -105,7 +105,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())); @@ -117,7 +117,7 @@ namespace uhd{ if (this->size() != other.size()){ return false; } - BOOST_FOREACH(const pair_t& p, _map) { + for(const pair_t& p : _map) { if (not (other.has_key(p.first) and other.get(p.first) == p.second)){ return false; } @@ -146,7 +146,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") @@ -161,7 +161,7 @@ namespace uhd{ dict<Key, Val>::operator std::map<Key, Val>() const { std::map<Key, Val> new_map; - BOOST_FOREACH (const pair_t& p, _map) { + for (const pair_t& p : _map) { new_map[p.first] = p.second; } return new_map; diff --git a/host/include/uhd/utils/assert_has.ipp b/host/include/uhd/utils/assert_has.ipp index 6237e127a..a60697f72 100644 --- a/host/include/uhd/utils/assert_has.ipp +++ b/host/include/uhd/utils/assert_has.ipp @@ -12,7 +12,6 @@ #include <uhd/exception.hpp> #include <boost/format.hpp> #include <boost/lexical_cast.hpp> -#include <boost/foreach.hpp> namespace uhd{ @@ -24,7 +23,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 ba716b206..ee80caab3 100644 --- a/host/include/uhd/utils/soft_register.hpp +++ b/host/include/uhd/utils/soft_register.hpp @@ -12,7 +12,6 @@ #include <uhd/types/wb_iface.hpp> #include <uhd/utils/dirty_tracked.hpp> #include <stdint.h> -#include <boost/foreach.hpp> #include <uhd/utils/noncopyable.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/mutex.hpp> @@ -485,7 +484,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); } } @@ -498,7 +497,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(); } } @@ -511,7 +510,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(); } } @@ -537,7 +536,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; @@ -643,7 +642,7 @@ 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); @@ -653,7 +652,7 @@ public: 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()); } @@ -663,11 +662,11 @@ public: .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&) { @@ -685,11 +684,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()); } |