From fcc2e9c602a6103dfd0f75e035f614b177c5dc35 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Sat, 28 Sep 2019 12:54:27 +0200 Subject: 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 --- host/lib/convert/gen_convert_general.py | 1 + host/lib/experts/expert_container.cpp | 2 +- host/lib/include/uhdlib/experts/expert_nodes.hpp | 12 ++++++------ host/lib/include/uhdlib/usrp/common/adf435x.hpp | 4 ++-- host/lib/include/uhdlib/usrp/common/adf535x.hpp | 2 +- host/lib/include/uhdlib/usrp/common/lmx2592.hpp | 2 +- host/lib/include/uhdlib/usrp/common/max287x.hpp | 4 ++-- host/lib/include/uhdlib/utils/ihex.hpp | 4 ++-- host/lib/transport/libusb1_zero_copy.cpp | 6 +++--- host/lib/transport/super_recv_packet_handler.hpp | 12 ++++++------ host/lib/transport/super_send_packet_handler.hpp | 2 +- host/lib/usrp/usrp1/io_impl.cpp | 8 ++++---- host/lib/usrp/usrp1/soft_time_ctrl.hpp | 4 ++-- host/lib/usrp/usrp2/io_impl.cpp | 2 +- host/lib/usrp/usrp2/usrp2_iface.hpp | 2 +- host/lib/usrp/usrp2/usrp2_impl.hpp | 2 +- 16 files changed, 35 insertions(+), 34 deletions(-) (limited to 'host/lib') 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 #include +#include 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 #include #include -#include +#include #include #include #include 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 #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ namespace uhd { namespace experts { */ class dag_vertex_t : private uhd::noncopyable { public: - typedef boost::function callback_func_t; + typedef std::function 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 #include #include -#include +#include #include #include #include @@ -24,7 +24,7 @@ class adf435x_iface { public: typedef std::shared_ptr sptr; - typedef boost::function)> write_fn_t; + typedef std::function)> 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 #include #include -#include +#include #include #include #include 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 #include #include -#include +#include #include #include #include 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 #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ class max287x_iface public: typedef std::shared_ptr sptr; - typedef boost::function)> write_fn; + typedef std::function)> 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 -#include +#include #include #include #include @@ -20,7 +20,7 @@ class ihex_reader { public: // Arguments are: lower address bits, upper address bits, buff, length - typedef boost::function record_handle_type; + typedef std::function 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 #include #include -#include +#include #include #include #include @@ -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 release_cb, + std::function release_cb, const bool is_recv, const std::string& name) : _release_cb(release_cb) @@ -192,7 +192,7 @@ public: } private: - boost::function _release_cb; + std::function _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 #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ UHD_INLINE uint32_t get_context_code( return word0 & 0xff; } -typedef boost::function handle_overflow_type; +typedef std::function 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 get_buff_type; - typedef boost::function handle_flowctrl_type; + typedef std::function get_buff_type; + typedef std::function handle_flowctrl_type; typedef std::function handle_flowctrl_ack_type; - typedef boost::function issue_stream_cmd_type; + typedef std::function issue_stream_cmd_type; typedef void (*vrt_unpacker_type)(const uint32_t*, vrt::if_packet_info_t&); - // typedef boost::function + // typedef std::function // 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 #include #include -#include +#include #include #include #include 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 commit_cb_type; + typedef std::function 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 tx_enb_fcn){ + usrp1_send_packet_streamer(const size_t max_num_samps, soft_time_ctrl::sptr stc, std::function 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 _tx_enb_fcn; + std::function _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 tx_fcn = boost::bind(&usrp1_impl::tx_stream_on_off, this, _1); + std::function tx_fcn = boost::bind(&usrp1_impl::tx_stream_on_off, this, _1); std::shared_ptr my_streamer = std::make_shared(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 #include #include -#include +#include namespace uhd{ namespace usrp{ @@ -28,7 +28,7 @@ namespace uhd{ namespace usrp{ class soft_time_ctrl : uhd::noncopyable{ public: typedef std::shared_ptr sptr; - typedef boost::function cb_fcn_type; + typedef std::function 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 _ready_fcn; + std::function _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 #include #include -#include +#include #include "usrp2_regs.hpp" #include #include 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 #include #include -#include +#include #include static const double USRP2_LINK_RATE_BPS = 1000e6/8; -- cgit v1.2.3