diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-09-28 12:54:27 +0200 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 12:21:32 -0800 |
commit | fcc2e9c602a6103dfd0f75e035f614b177c5dc35 (patch) | |
tree | 8c6162ab134a79f343b8404f1d82b6bd9483d116 /host/lib | |
parent | 0c43030e71f4786bf1ba1b7f08abf6b3d019761f (diff) | |
download | uhd-fcc2e9c602a6103dfd0f75e035f614b177c5dc35.tar.gz uhd-fcc2e9c602a6103dfd0f75e035f614b177c5dc35.tar.bz2 uhd-fcc2e9c602a6103dfd0f75e035f614b177c5dc35.zip |
uhd: Replace boost::function with std::function
This is mostly a search-and-replace operation, with few exceptions:
- boost::function has a clear() method. In C++11, this is achieved by
assigning nullptr to the std::function object.
- The empty() method is replaced by std::function's bool() operator
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/convert/gen_convert_general.py | 1 | ||||
-rw-r--r-- | host/lib/experts/expert_container.cpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/experts/expert_nodes.hpp | 12 | ||||
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/adf435x.hpp | 4 | ||||
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/adf535x.hpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/lmx2592.hpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/max287x.hpp | 4 | ||||
-rw-r--r-- | host/lib/include/uhdlib/utils/ihex.hpp | 4 | ||||
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 6 | ||||
-rw-r--r-- | host/lib/transport/super_recv_packet_handler.hpp | 12 | ||||
-rw-r--r-- | host/lib/transport/super_send_packet_handler.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/io_impl.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/soft_time_ctrl.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 2 |
16 files changed, 35 insertions, 34 deletions
diff --git a/host/lib/convert/gen_convert_general.py b/host/lib/convert/gen_convert_general.py index 1b1106d4c..19d699cd2 100644 --- a/host/lib/convert/gen_convert_general.py +++ b/host/lib/convert/gen_convert_general.py @@ -20,6 +20,7 @@ TMPL_HEADER = """ #include "convert_common.hpp" #include <uhd/utils/byteswap.hpp> #include <algorithm> +#include <cstring> using namespace uhd::convert; diff --git a/host/lib/experts/expert_container.cpp b/host/lib/experts/expert_container.cpp index 33412cb6f..3a1e54ae4 100644 --- a/host/lib/experts/expert_container.cpp +++ b/host/lib/experts/expert_container.cpp @@ -10,7 +10,7 @@ #include <uhdlib/experts/expert_container.hpp> #include <boost/bind.hpp> #include <boost/format.hpp> -#include <boost/function.hpp> +#include <functional> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/depth_first_search.hpp> #include <boost/graph/graph_traits.hpp> diff --git a/host/lib/include/uhdlib/experts/expert_nodes.hpp b/host/lib/include/uhdlib/experts/expert_nodes.hpp index d1f38ac07..665c0e579 100644 --- a/host/lib/include/uhdlib/experts/expert_nodes.hpp +++ b/host/lib/include/uhdlib/experts/expert_nodes.hpp @@ -13,7 +13,7 @@ #include <uhd/utils/dirty_tracked.hpp> #include <uhd/utils/noncopyable.hpp> #include <uhd/types/time_spec.hpp> -#include <boost/function.hpp> +#include <functional> #include <boost/thread/recursive_mutex.hpp> #include <boost/thread.hpp> #include <boost/core/demangle.hpp> @@ -36,7 +36,7 @@ namespace uhd { namespace experts { */ class dag_vertex_t : private uhd::noncopyable { public: - typedef boost::function<void(std::string)> callback_func_t; + typedef std::function<void(std::string)> callback_func_t; virtual ~dag_vertex_t() {} @@ -195,11 +195,11 @@ namespace uhd { namespace experts { } virtual bool has_write_callback() const { - return not _wr_callback.empty(); + return bool(_wr_callback); } virtual void clear_write_callback() { - _wr_callback.clear(); + _wr_callback = nullptr; } virtual void set_read_callback(const callback_func_t& func) { @@ -207,11 +207,11 @@ namespace uhd { namespace experts { } virtual bool has_read_callback() const { - return not _rd_callback.empty(); + return bool(_rd_callback); } virtual void clear_read_callback() { - _rd_callback.clear(); + _rd_callback = nullptr; } boost::recursive_mutex* _callback_mutex; diff --git a/host/lib/include/uhdlib/usrp/common/adf435x.hpp b/host/lib/include/uhdlib/usrp/common/adf435x.hpp index 6f654bcbb..886c8d335 100644 --- a/host/lib/include/uhdlib/usrp/common/adf435x.hpp +++ b/host/lib/include/uhdlib/usrp/common/adf435x.hpp @@ -15,7 +15,7 @@ #include <uhd/types/ranges.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/utils/math.hpp> -#include <boost/function.hpp> +#include <functional> #include <boost/math/special_functions/round.hpp> #include <boost/thread.hpp> #include <vector> @@ -24,7 +24,7 @@ class adf435x_iface { public: typedef std::shared_ptr<adf435x_iface> sptr; - typedef boost::function<void(std::vector<uint32_t>)> write_fn_t; + typedef std::function<void(std::vector<uint32_t>)> write_fn_t; static sptr make_adf4350(write_fn_t write); static sptr make_adf4351(write_fn_t write); diff --git a/host/lib/include/uhdlib/usrp/common/adf535x.hpp b/host/lib/include/uhdlib/usrp/common/adf535x.hpp index bc3c445bb..c42f05b57 100644 --- a/host/lib/include/uhdlib/usrp/common/adf535x.hpp +++ b/host/lib/include/uhdlib/usrp/common/adf535x.hpp @@ -15,7 +15,7 @@ #include <uhd/utils/safe_call.hpp> #include <stdint.h> #include <boost/format.hpp> -#include <boost/function.hpp> +#include <functional> #include <algorithm> #include <iomanip> #include <utility> diff --git a/host/lib/include/uhdlib/usrp/common/lmx2592.hpp b/host/lib/include/uhdlib/usrp/common/lmx2592.hpp index a754fa63d..9ee3f944f 100644 --- a/host/lib/include/uhdlib/usrp/common/lmx2592.hpp +++ b/host/lib/include/uhdlib/usrp/common/lmx2592.hpp @@ -12,7 +12,7 @@ #include <uhd/utils/math.hpp> #include <uhd/utils/safe_call.hpp> #include <boost/format.hpp> -#include <boost/function.hpp> +#include <functional> #include <algorithm> #include <cstdint> #include <utility> diff --git a/host/lib/include/uhdlib/usrp/common/max287x.hpp b/host/lib/include/uhdlib/usrp/common/max287x.hpp index 51c22c5d8..08ee5b16d 100644 --- a/host/lib/include/uhdlib/usrp/common/max287x.hpp +++ b/host/lib/include/uhdlib/usrp/common/max287x.hpp @@ -17,7 +17,7 @@ #include <uhd/utils/math.hpp> #include <uhd/utils/safe_call.hpp> #include <boost/assign.hpp> -#include <boost/function.hpp> +#include <functional> #include <boost/math/special_functions/round.hpp> #include <vector> #include <chrono> @@ -32,7 +32,7 @@ class max287x_iface public: typedef std::shared_ptr<max287x_iface> sptr; - typedef boost::function<void(std::vector<uint32_t>)> write_fn; + typedef std::function<void(std::vector<uint32_t>)> write_fn; /** * LD Pin Modes diff --git a/host/lib/include/uhdlib/utils/ihex.hpp b/host/lib/include/uhdlib/utils/ihex.hpp index 4b1be77f1..9cb204280 100644 --- a/host/lib/include/uhdlib/utils/ihex.hpp +++ b/host/lib/include/uhdlib/utils/ihex.hpp @@ -9,7 +9,7 @@ #define INCLUDED_IHEX_READER_HPP #include <boost/bind.hpp> -#include <boost/function.hpp> +#include <functional> #include <stdint.h> #include <string> #include <vector> @@ -20,7 +20,7 @@ class ihex_reader { public: // Arguments are: lower address bits, upper address bits, buff, length - typedef boost::function<int(uint16_t,uint16_t,unsigned char*,uint16_t)> record_handle_type; + typedef std::function<int(uint16_t,uint16_t,unsigned char*,uint16_t)> record_handle_type; /* * \param ihex_filename Path to the *.ihx file diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index fbeddbcdd..356d247cb 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -15,7 +15,7 @@ #include <boost/bind.hpp> #include <boost/circular_buffer.hpp> #include <boost/format.hpp> -#include <boost/function.hpp> +#include <functional> #include <memory> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> @@ -115,7 +115,7 @@ class libusb_zero_copy_mb : public managed_buffer public: libusb_zero_copy_mb(libusb_transfer* lut, const size_t frame_size, - boost::function<void(libusb_zero_copy_mb*)> release_cb, + std::function<void(libusb_zero_copy_mb*)> release_cb, const bool is_recv, const std::string& name) : _release_cb(release_cb) @@ -192,7 +192,7 @@ public: } private: - boost::function<void(libusb_zero_copy_mb*)> _release_cb; + std::function<void(libusb_zero_copy_mb*)> _release_cb; const bool _is_recv; const std::string _name; libusb_context* _ctx; diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp index a09281459..b19b50b38 100644 --- a/host/lib/transport/super_recv_packet_handler.hpp +++ b/host/lib/transport/super_recv_packet_handler.hpp @@ -20,7 +20,7 @@ #include <uhd/utils/tasks.hpp> #include <boost/dynamic_bitset.hpp> #include <boost/format.hpp> -#include <boost/function.hpp> +#include <functional> #include <memory> #include <iostream> #include <vector> @@ -36,7 +36,7 @@ UHD_INLINE uint32_t get_context_code( return word0 & 0xff; } -typedef boost::function<void(void)> handle_overflow_type; +typedef std::function<void(void)> handle_overflow_type; static inline void handle_overflow_nop(void) {} /*********************************************************************** @@ -49,12 +49,12 @@ static inline void handle_overflow_nop(void) {} class recv_packet_handler { public: - typedef boost::function<managed_recv_buffer::sptr(double)> get_buff_type; - typedef boost::function<void(const size_t)> handle_flowctrl_type; + typedef std::function<managed_recv_buffer::sptr(double)> get_buff_type; + typedef std::function<void(const size_t)> handle_flowctrl_type; typedef std::function<void(const uint32_t*)> handle_flowctrl_ack_type; - typedef boost::function<void(const stream_cmd_t&)> issue_stream_cmd_type; + typedef std::function<void(const stream_cmd_t&)> issue_stream_cmd_type; typedef void (*vrt_unpacker_type)(const uint32_t*, vrt::if_packet_info_t&); - // typedef boost::function<void(const uint32_t *, vrt::if_packet_info_t &)> + // typedef std::function<void(const uint32_t *, vrt::if_packet_info_t &)> // vrt_unpacker_type; /*! diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 40ca2e414..21f7357c3 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -18,7 +18,7 @@ #include <uhd/utils/byteswap.hpp> #include <uhd/utils/tasks.hpp> #include <uhd/utils/thread.hpp> -#include <boost/function.hpp> +#include <functional> #include <chrono> #include <iostream> #include <thread> diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 3d45824e4..462f330e6 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -76,7 +76,7 @@ struct offset_send_buffer{ **********************************************************************/ class offset_managed_send_buffer : public managed_send_buffer{ public: - typedef boost::function<void(offset_send_buffer&, offset_send_buffer&, size_t)> commit_cb_type; + typedef std::function<void(offset_send_buffer&, offset_send_buffer&, size_t)> commit_cb_type; offset_managed_send_buffer(const commit_cb_type &commit_cb): _commit_cb(commit_cb) { @@ -366,7 +366,7 @@ private: **********************************************************************/ class usrp1_send_packet_streamer : public sph::send_packet_handler, public tx_streamer{ public: - usrp1_send_packet_streamer(const size_t max_num_samps, soft_time_ctrl::sptr stc, boost::function<void(bool)> tx_enb_fcn){ + usrp1_send_packet_streamer(const size_t max_num_samps, soft_time_ctrl::sptr stc, std::function<void(bool)> tx_enb_fcn){ _max_num_samps = max_num_samps; this->set_max_samples_per_packet(_max_num_samps); _stc = stc; @@ -419,7 +419,7 @@ public: private: size_t _max_num_samps; soft_time_ctrl::sptr _stc; - boost::function<void(bool)> _tx_enb_fcn; + std::function<void(bool)> _tx_enb_fcn; }; /*********************************************************************** @@ -687,7 +687,7 @@ tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args_){ const size_t spp = bpp/convert::get_bytes_per_item(args.otw_format); //make the new streamer given the samples per packet - boost::function<void(bool)> tx_fcn = boost::bind(&usrp1_impl::tx_stream_on_off, this, _1); + std::function<void(bool)> tx_fcn = boost::bind(&usrp1_impl::tx_stream_on_off, this, _1); std::shared_ptr<usrp1_send_packet_streamer> my_streamer = std::make_shared<usrp1_send_packet_streamer>(spp, _soft_time_ctrl, tx_fcn); diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.hpp b/host/lib/usrp/usrp1/soft_time_ctrl.hpp index 9143b6af2..48915499a 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.hpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.hpp @@ -14,7 +14,7 @@ #include <uhd/transport/bounded_buffer.hpp> #include <uhd/utils/noncopyable.hpp> #include <memory> -#include <boost/function.hpp> +#include <functional> namespace uhd{ namespace usrp{ @@ -28,7 +28,7 @@ namespace uhd{ namespace usrp{ class soft_time_ctrl : uhd::noncopyable{ public: typedef std::shared_ptr<soft_time_ctrl> sptr; - typedef boost::function<void(bool)> cb_fcn_type; + typedef std::function<void(bool)> cb_fcn_type; virtual ~soft_time_ctrl(void) = 0; diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index d965b4e24..efc0644db 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -113,7 +113,7 @@ private: boost::condition _fc_cond; seq_type _last_seq_out, _last_seq_ack; const seq_type _max_seqs_out; - boost::function<bool(void)> _ready_fcn; + std::function<bool(void)> _ready_fcn; }; /*********************************************************************** diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp index 2752d1a28..b602dab53 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -13,7 +13,7 @@ #include <uhd/usrp/mboard_eeprom.hpp> #include <memory> #include <boost/utility.hpp> -#include <boost/function.hpp> +#include <functional> #include "usrp2_regs.hpp" #include <uhd/types/wb_iface.hpp> #include <string> diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 14a3ae8d6..9e4e507de 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -33,7 +33,7 @@ #include <uhd/usrp/dboard_manager.hpp> #include <uhd/usrp/subdev_spec.hpp> #include <memory> -#include <boost/function.hpp> +#include <functional> #include <atomic> static const double USRP2_LINK_RATE_BPS = 1000e6/8; |