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/experts | |
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/experts')
-rw-r--r-- | host/lib/experts/expert_container.cpp | 17 | ||||
-rw-r--r-- | host/lib/experts/expert_nodes.hpp | 9 |
2 files changed, 12 insertions, 14 deletions
diff --git a/host/lib/experts/expert_container.cpp b/host/lib/experts/expert_container.cpp index 853e3e4b7..53995e5e3 100644 --- a/host/lib/experts/expert_container.cpp +++ b/host/lib/experts/expert_container.cpp @@ -19,7 +19,6 @@ #include <uhd/exception.hpp> #include <uhd/utils/msg.hpp> #include <boost/format.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/bind.hpp> #include <boost/make_shared.hpp> @@ -185,7 +184,7 @@ public: EX_LOG(1, "cycle check ... PASSED"); } else { EX_LOG(1, "cycle check ... ERROR!!!"); - BOOST_FOREACH(const std::string& e, back_edges) { + for(const std::string& e: back_edges) { EX_LOG(2, "back edge: " + e); } } @@ -193,7 +192,7 @@ public: //Test 2: Check data node input and output edges std::vector<std::string> data_node_issues; - BOOST_FOREACH(const vertex_map_t::value_type& v, _datanode_map) { + for(const vertex_map_t::value_type& v: _datanode_map) { size_t in_count = 0, out_count = 0; for (std::pair<edge_iter, edge_iter> ei = boost::edges(_expert_dag); ei.first != ei.second; @@ -238,7 +237,7 @@ public: EX_LOG(1, "data node check ... PASSED"); } else { EX_LOG(1, "data node check ... WARNING!"); - BOOST_FOREACH(const std::string& i, data_node_issues) { + for(const std::string& i: data_node_issues) { EX_LOG(2, i); } } @@ -246,7 +245,7 @@ public: //Test 3: Check worker node input and output edges std::vector<std::string> worker_issues; - BOOST_FOREACH(const vertex_map_t::value_type& v, _worker_map) { + for(const vertex_map_t::value_type& v: _worker_map) { size_t in_count = 0, out_count = 0; for (std::pair<edge_iter, edge_iter> ei = boost::edges(_expert_dag); ei.first != ei.second; @@ -268,7 +267,7 @@ public: EX_LOG(1, "worker check ... PASSED"); } else { EX_LOG(1, "worker check ... WARNING!"); - BOOST_FOREACH(const std::string& i, worker_issues) { + for(const std::string& i: worker_issues) { EX_LOG(2, i); } } @@ -347,7 +346,7 @@ protected: _worker_map.insert(vertex_map_t::value_type(worker->get_name(), gr_node)); //For each input, add an edge from the input to this node - BOOST_FOREACH(const std::string& node_name, worker->get_inputs()) { + for(const std::string& node_name: worker->get_inputs()) { vertex_map_t::const_iterator node = _datanode_map.find(node_name); if (node != _datanode_map.end()) { boost::add_edge((*node).second, gr_node, _expert_dag); @@ -358,7 +357,7 @@ protected: } //For each output, add an edge from this node to the output - BOOST_FOREACH(const std::string& node_name, worker->get_outputs()) { + for(const std::string& node_name: worker->get_outputs()) { vertex_map_t::const_iterator node = _datanode_map.find(node_name); if (node != _datanode_map.end()) { boost::add_edge(gr_node, (*node).second, _expert_dag); @@ -423,7 +422,7 @@ private: boost::depth_first_search(_expert_dag, boost::visitor(cdet_vis)); if (not back_edges.empty()) { std::string edges; - BOOST_FOREACH(const std::string& e, back_edges) { + for(const std::string& e: back_edges) { edges += "* " + e + ""; } throw uhd::runtime_error("Cannot resolve expert because it has at least one cycle!\n" diff --git a/host/lib/experts/expert_nodes.hpp b/host/lib/experts/expert_nodes.hpp index 6040cd19e..4a285cc80 100644 --- a/host/lib/experts/expert_nodes.hpp +++ b/host/lib/experts/expert_nodes.hpp @@ -23,7 +23,6 @@ #include <uhd/utils/dirty_tracked.hpp> #include <uhd/types/time_spec.hpp> #include <boost/function.hpp> -#include <boost/foreach.hpp> #include <boost/thread/recursive_mutex.hpp> #include <boost/thread.hpp> #include <boost/units/detail/utility.hpp> @@ -409,7 +408,7 @@ namespace uhd { namespace experts { // Worker node specific std::list<std::string> get_inputs() const { std::list<std::string> retval; - BOOST_FOREACH(data_accessor_t* acc, _inputs) { + for(data_accessor_t* acc: _inputs) { retval.push_back(acc->node().get_name()); } return retval; @@ -417,7 +416,7 @@ namespace uhd { namespace experts { std::list<std::string> get_outputs() const { std::list<std::string> retval; - BOOST_FOREACH(data_accessor_t* acc, _outputs) { + for(data_accessor_t* acc: _outputs) { retval.push_back(acc->node().get_name()); } return retval; @@ -442,14 +441,14 @@ namespace uhd { namespace experts { // Graph resolution specific virtual bool is_dirty() const { bool inputs_dirty = false; - BOOST_FOREACH(data_accessor_t* acc, _inputs) { + for(data_accessor_t* acc: _inputs) { inputs_dirty |= acc->node().is_dirty(); } return inputs_dirty; } virtual void mark_clean() { - BOOST_FOREACH(data_accessor_t* acc, _inputs) { + for(data_accessor_t* acc: _inputs) { acc->node().mark_clean(); } } |