diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/property_tree.ipp | 5 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/node_ctrl_base.ipp | 4 | ||||
-rw-r--r-- | host/include/uhd/types/dict.ipp | 17 | ||||
-rw-r--r-- | host/include/uhd/utils/assert_has.ipp | 3 | ||||
-rw-r--r-- | host/include/uhd/utils/soft_register.hpp | 23 |
5 files changed, 28 insertions, 24 deletions
diff --git a/host/include/uhd/property_tree.ipp b/host/include/uhd/property_tree.ipp index ef63ced24..6ed1056e6 100644 --- a/host/include/uhd/property_tree.ipp +++ b/host/include/uhd/property_tree.ipp @@ -19,6 +19,7 @@ #define INCLUDED_UHD_PROPERTY_TREE_IPP #include <uhd/exception.hpp> +#include <boost/foreach.hpp> #include <boost/scoped_ptr.hpp> #include <vector> @@ -71,14 +72,14 @@ public: void _set_coerced(const T &value){ init_or_set_value(_coerced_value, value); - for(typename property<T>::subscriber_type &csub: _coerced_subscribers){ + BOOST_FOREACH(typename property<T>::subscriber_type &csub, _coerced_subscribers){ csub(get_value_ref(_coerced_value)); //let errors propagate } } property<T> &set(const T &value){ init_or_set_value(_value, value); - for(typename property<T>::subscriber_type &dsub: _desired_subscribers){ + BOOST_FOREACH(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/rfnoc/node_ctrl_base.ipp b/host/include/uhd/rfnoc/node_ctrl_base.ipp index 2492031be..d300f72a7 100644 --- a/host/include/uhd/rfnoc/node_ctrl_base.ipp +++ b/host/include/uhd/rfnoc/node_ctrl_base.ipp @@ -45,7 +45,7 @@ namespace uhd { while (iters++ < MAX_ITER) { next_q.clear(); - for(const sptr &this_node: search_q) { + BOOST_FOREACH(const sptr &this_node, search_q) { // Add this node to the list of explored nodes explored.insert(this_node); // Create set of all child nodes of this_node that are not in explored: @@ -98,7 +98,7 @@ namespace uhd { std::vector< boost::shared_ptr<T> > descendant_rate_nodes = _find_child_node<T, downstream>(); value_type ret_val = NULL_VALUE; std::string first_node_id; - for(const boost::shared_ptr<T> &node: descendant_rate_nodes) { + BOOST_FOREACH(const boost::shared_ptr<T> &node, descendant_rate_nodes) { if (exclude_nodes.count(node)) { continue; } diff --git a/host/include/uhd/types/dict.ipp b/host/include/uhd/types/dict.ipp index b9d367a3c..5fd4b536e 100644 --- a/host/include/uhd/types/dict.ipp +++ b/host/include/uhd/types/dict.ipp @@ -19,6 +19,7 @@ #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> @@ -60,7 +61,7 @@ namespace uhd{ template <typename Key, typename Val> std::vector<Key> dict<Key, Val>::keys(void) const{ std::vector<Key> keys; - for(const pair_t &p: _map){ + BOOST_FOREACH(const pair_t &p, _map){ keys.push_back(p.first); } return keys; @@ -69,7 +70,7 @@ namespace uhd{ template <typename Key, typename Val> std::vector<Val> dict<Key, Val>::vals(void) const{ std::vector<Val> vals; - for(const pair_t &p: _map){ + BOOST_FOREACH(const pair_t &p, _map){ vals.push_back(p.second); } return vals; @@ -77,7 +78,7 @@ namespace uhd{ template <typename Key, typename Val> bool dict<Key, Val>::has_key(const Key &key) const{ - for(const pair_t &p: _map){ + BOOST_FOREACH(const pair_t &p, _map){ if (p.first == key) return true; } return false; @@ -85,7 +86,7 @@ namespace uhd{ template <typename Key, typename Val> const Val &dict<Key, Val>::get(const Key &key, const Val &other) const{ - for(const pair_t &p: _map){ + BOOST_FOREACH(const pair_t &p, _map){ if (p.first == key) return p.second; } return other; @@ -93,7 +94,7 @@ namespace uhd{ template <typename Key, typename Val> const Val &dict<Key, Val>::get(const Key &key) const{ - for(const pair_t &p: _map){ + BOOST_FOREACH(const pair_t &p, _map){ if (p.first == key) return p.second; } throw key_not_found<Key, Val>(key); @@ -106,7 +107,7 @@ namespace uhd{ template <typename Key, typename Val> const Val &dict<Key, Val>::operator[](const Key &key) const{ - for(const pair_t &p: _map){ + BOOST_FOREACH(const pair_t &p, _map){ if (p.first == key) return p.second; } throw key_not_found<Key, Val>(key); @@ -114,7 +115,7 @@ namespace uhd{ template <typename Key, typename Val> Val &dict<Key, Val>::operator[](const Key &key){ - for(pair_t &p: _map){ + BOOST_FOREACH(pair_t &p, _map){ if (p.first == key) return p.second; } _map.push_back(std::make_pair(key, Val())); @@ -137,7 +138,7 @@ namespace uhd{ template <typename Key, typename Val> void dict<Key, Val>::update(const dict<Key, Val> &new_dict, bool fail_on_conflict) { - for(const Key &key: new_dict.keys()) { + BOOST_FOREACH(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") diff --git a/host/include/uhd/utils/assert_has.ipp b/host/include/uhd/utils/assert_has.ipp index 6457cf2ee..974eea5a5 100644 --- a/host/include/uhd/utils/assert_has.ipp +++ b/host/include/uhd/utils/assert_has.ipp @@ -22,6 +22,7 @@ #include <uhd/exception.hpp> #include <boost/format.hpp> #include <boost/lexical_cast.hpp> +#include <boost/foreach.hpp> namespace uhd{ @@ -33,7 +34,7 @@ namespace uhd{ if (uhd::has(range, value)) return; std::string possible_values = ""; size_t i = 0; - for(const T &v: range){ + BOOST_FOREACH(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 d3a1e0943..2870ad595 100644 --- a/host/include/uhd/utils/soft_register.hpp +++ b/host/include/uhd/utils/soft_register.hpp @@ -27,6 +27,7 @@ #include <boost/thread/locks.hpp> #include <boost/unordered_map.hpp> #include <boost/tokenizer.hpp> +#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <list> @@ -478,7 +479,7 @@ public: */ void initialize(wb_iface& iface, bool sync = false) { boost::lock_guard<boost::mutex> lock(_mutex); - for(soft_register_base* reg: _reglist) { + BOOST_FOREACH(soft_register_base* reg, _reglist) { reg->initialize(iface, sync); } } @@ -490,7 +491,7 @@ public: */ void flush() { boost::lock_guard<boost::mutex> lock(_mutex); - for(soft_register_base* reg: _reglist) { + BOOST_FOREACH(soft_register_base* reg, _reglist) { reg->flush(); } } @@ -502,7 +503,7 @@ public: */ void refresh() { boost::lock_guard<boost::mutex> lock(_mutex); - for(soft_register_base* reg: _reglist) { + BOOST_FOREACH(soft_register_base* reg, _reglist) { reg->refresh(); } } @@ -526,7 +527,7 @@ public: */ virtual std::vector<std::string> enumerate() const { std::vector<std::string> temp; - for(const regmap_t::value_type& reg: _regmap) { + BOOST_FOREACH(const regmap_t::value_type& reg, _regmap) { temp.push_back(_name + "/" + reg.first); } return temp; @@ -622,8 +623,8 @@ public: { //Turn the slash separated path string into tokens std::list<std::string> tokens; - for( - const std::string& node: + BOOST_FOREACH( + const std::string& node, boost::tokenizer< boost::char_separator<char> >(path, boost::char_separator<char>("/"))) { tokens.push_back(node); @@ -632,7 +633,7 @@ public: (tokens.size() > 1 && _name == "")) { //If this is a top-level DB if (_name != "") tokens.pop_front(); if (tokens.size() == 2) { //2 tokens => regmap/register path - for(const soft_regmap_accessor_t* regmap: _regmaps) { + BOOST_FOREACH(const soft_regmap_accessor_t* regmap, _regmaps) { if (regmap->get_name() == tokens.front()) { return regmap->lookup(tokens.back()); } @@ -641,11 +642,11 @@ public: } else if (not _regmap_dbs.empty()) { //>2 tokens => <1 or more dbs>/regmap/register //Reconstruct path from tokens std::string newpath; - for(const std::string& node: tokens) { + BOOST_FOREACH(const std::string& node, tokens) { newpath += ("/" + node); } //Dispatch path to hierarchical DB - for(const soft_regmap_accessor_t* db: _regmap_dbs) { + BOOST_FOREACH(const soft_regmap_accessor_t* db, _regmap_dbs) { try { return db->lookup(newpath.substr(1)); } catch (std::exception&) { @@ -662,11 +663,11 @@ public: */ virtual std::vector<std::string> enumerate() const { std::vector<std::string> paths; - for(const soft_regmap_accessor_t* regmap: _regmaps) { + BOOST_FOREACH(const soft_regmap_accessor_t* regmap, _regmaps) { const std::vector<std::string>& regs = regmap->enumerate(); paths.insert(paths.end(), regs.begin(), regs.end()); } - for(const soft_regmap_accessor_t* db: _regmap_dbs) { + BOOST_FOREACH(const soft_regmap_accessor_t* db, _regmap_dbs) { const std::vector<std::string>& regs = db->enumerate(); paths.insert(paths.end(), regs.begin(), regs.end()); } |