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/transport | |
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/transport')
-rw-r--r-- | host/lib/transport/libusb1_base.cpp | 3 | ||||
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 7 | ||||
-rw-r--r-- | host/lib/transport/super_recv_packet_handler.hpp | 1 | ||||
-rw-r--r-- | host/lib/transport/super_send_packet_handler.hpp | 3 |
4 files changed, 5 insertions, 9 deletions
diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp index d04b679f8..720e54e4d 100644 --- a/host/lib/transport/libusb1_base.cpp +++ b/host/lib/transport/libusb1_base.cpp @@ -24,7 +24,6 @@ #include <uhd/types/serial.hpp> #include <boost/weak_ptr.hpp> #include <boost/thread/mutex.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <cstdlib> #include <iostream> @@ -227,7 +226,7 @@ public: std::string string_descriptor((char *)buff, size_t(ret)); byte_vector_t string_vec(string_descriptor.begin(), string_descriptor.end()); std::string out; - BOOST_FOREACH(uint8_t byte, string_vec){ + for(uint8_t byte: string_vec){ if (byte < 32 or byte > 127) return out; out += byte; } diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index c32b96b63..719893bcd 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -21,7 +21,6 @@ #include <uhd/transport/bounded_buffer.hpp> #include <uhd/utils/msg.hpp> #include <uhd/exception.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/function.hpp> #include <boost/bind.hpp> @@ -274,19 +273,19 @@ public: ~libusb_zero_copy_single(void) { //cancel all transfers - BOOST_FOREACH(libusb_transfer *lut, _all_luts) + for(libusb_transfer *lut: _all_luts) { libusb_cancel_transfer(lut); } //process all transfers until timeout occurs - BOOST_FOREACH(libusb_zero_copy_mb *mb, _enqueued) + for(libusb_zero_copy_mb *mb: _enqueued) { mb->wait_for_completion(0.01); } //free all transfers - BOOST_FOREACH(libusb_transfer *lut, _all_luts) + for(libusb_transfer *lut: _all_luts) { libusb_free_transfer(lut); } diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp index d34f222e8..161d921bc 100644 --- a/host/lib/transport/super_recv_packet_handler.hpp +++ b/host/lib/transport/super_recv_packet_handler.hpp @@ -30,7 +30,6 @@ #include <uhd/transport/vrt_if_packet.hpp> #include <uhd/transport/zero_copy.hpp> #include <boost/dynamic_bitset.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/format.hpp> #include <boost/bind.hpp> diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 0acc8df4b..09ae0c882 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -31,7 +31,6 @@ #include <uhd/transport/zero_copy.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/thread_time.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <iostream> #include <vector> @@ -382,7 +381,7 @@ private: if_packet_info.packet_count = _next_packet_seq; //get a buffer for each channel or timeout - BOOST_FOREACH(xport_chan_props_type &props, _props){ + for(xport_chan_props_type &props: _props){ if (not props.buff) props.buff = props.get_buff(timeout); if (not props.buff) return 0; //timeout } |