From 1fe98e8701dd0b790b172762c3629db32956d1fc Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Sat, 28 Sep 2019 11:18:57 +0200 Subject: uhd: Replace usage of boost smart pointers with C++11 counterparts This removes the following Boost constructs: - boost::shared_ptr, boost::weak_ptr - boost::enable_shared_from_this - boost::static_pointer_cast, boost::dynamic_pointer_cast The appropriate includes were also removed. All C++11 versions of these require #include . Note that the stdlib and Boost versions have the exact same syntax, they only differ in the namespace (boost vs. std). The modifications were all done using sed, with the exception of boost::scoped_ptr, which was replaced by std::unique_ptr. References to boost::smart_ptr were also removed. boost::intrusive_ptr is not removed in this commit, since it does not have a 1:1 mapping to a C++11 construct. --- host/lib/usrp/b100/b100_impl.hpp | 8 ++++---- host/lib/usrp/b100/clock_ctrl.hpp | 4 ++-- host/lib/usrp/b100/codec_ctrl.hpp | 4 ++-- host/lib/usrp/b100/fifo_ctrl_excelsior.hpp | 4 ++-- host/lib/usrp/b100/io_impl.cpp | 22 +++++++++++----------- host/lib/usrp/b100/usb_zero_copy_wrapper.cpp | 10 +++++----- 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'host/lib/usrp/b100') diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp index 492db5740..bb72cd63e 100644 --- a/host/lib/usrp/b100/b100_impl.hpp +++ b/host/lib/usrp/b100/b100_impl.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include static const double B100_LINK_RATE_BPS = 256e6/5; //pratical link rate (< 480 Mbps) static const std::string B100_FW_FILE_NAME = "usrp_b100_fw.ihx"; @@ -112,14 +112,14 @@ private: //transports uhd::transport::zero_copy_if::sptr _ctrl_transport; uhd::transport::zero_copy_if::sptr _data_transport; - boost::shared_ptr _recv_demuxer; + std::shared_ptr _recv_demuxer; //dboard stuff uhd::usrp::dboard_manager::sptr _dboard_manager; bool _ignore_cal_file; - std::vector > _rx_streamers; - std::vector > _tx_streamers; + std::vector > _rx_streamers; + std::vector > _tx_streamers; void check_fw_compat(void); void check_fpga_compat(void); diff --git a/host/lib/usrp/b100/clock_ctrl.hpp b/host/lib/usrp/b100/clock_ctrl.hpp index a6f516e15..b208e8a0c 100644 --- a/host/lib/usrp/b100/clock_ctrl.hpp +++ b/host/lib/usrp/b100/clock_ctrl.hpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include /*! @@ -19,7 +19,7 @@ */ class b100_clock_ctrl : uhd::noncopyable{ public: - typedef boost::shared_ptr sptr; + typedef std::shared_ptr sptr; virtual ~b100_clock_ctrl(void) = 0; diff --git a/host/lib/usrp/b100/codec_ctrl.hpp b/host/lib/usrp/b100/codec_ctrl.hpp index 67a5f7e9c..5f77d00f9 100644 --- a/host/lib/usrp/b100/codec_ctrl.hpp +++ b/host/lib/usrp/b100/codec_ctrl.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include /*! * The B100 codec control: @@ -20,7 +20,7 @@ */ class b100_codec_ctrl : uhd::noncopyable{ public: - typedef boost::shared_ptr sptr; + typedef std::shared_ptr sptr; static const uhd::gain_range_t tx_pga_gain_range; static const uhd::gain_range_t rx_pga_gain_range; diff --git a/host/lib/usrp/b100/fifo_ctrl_excelsior.hpp b/host/lib/usrp/b100/fifo_ctrl_excelsior.hpp index 91c006a1a..27da0026c 100644 --- a/host/lib/usrp/b100/fifo_ctrl_excelsior.hpp +++ b/host/lib/usrp/b100/fifo_ctrl_excelsior.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ struct fifo_ctrl_excelsior_config class fifo_ctrl_excelsior : public uhd::timed_wb_iface, public uhd::spi_iface { public: - typedef boost::shared_ptr sptr; + typedef std::shared_ptr sptr; //! Make a new control object static sptr make( diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp index ed90b11ba..d3de1cca1 100644 --- a/host/lib/usrp/b100/io_impl.cpp +++ b/host/lib/usrp/b100/io_impl.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include using namespace uhd; using namespace uhd::usrp; @@ -38,22 +38,22 @@ void b100_impl::update_tick_rate(const double rate){ //update the tick rate on all existing streamers -> thread safe for (size_t i = 0; i < _rx_streamers.size(); i++){ - boost::shared_ptr my_streamer = - boost::dynamic_pointer_cast(_rx_streamers[i].lock()); + std::shared_ptr my_streamer = + std::dynamic_pointer_cast(_rx_streamers[i].lock()); if (my_streamer.get() == NULL) continue; my_streamer->set_tick_rate(rate); } for (size_t i = 0; i < _tx_streamers.size(); i++){ - boost::shared_ptr my_streamer = - boost::dynamic_pointer_cast(_tx_streamers[i].lock()); + std::shared_ptr my_streamer = + std::dynamic_pointer_cast(_tx_streamers[i].lock()); if (my_streamer.get() == NULL) continue; my_streamer->set_tick_rate(rate); } } void b100_impl::update_rx_samp_rate(const size_t dspno, const double rate){ - boost::shared_ptr my_streamer = - boost::dynamic_pointer_cast(_rx_streamers[dspno].lock()); + std::shared_ptr my_streamer = + std::dynamic_pointer_cast(_rx_streamers[dspno].lock()); if (my_streamer.get() == NULL) return; my_streamer->set_samp_rate(rate); @@ -62,8 +62,8 @@ void b100_impl::update_rx_samp_rate(const size_t dspno, const double rate){ } void b100_impl::update_tx_samp_rate(const size_t dspno, const double rate){ - boost::shared_ptr my_streamer = - boost::dynamic_pointer_cast(_tx_streamers[dspno].lock()); + std::shared_ptr my_streamer = + std::dynamic_pointer_cast(_tx_streamers[dspno].lock()); if (my_streamer.get() == NULL) return; my_streamer->set_samp_rate(rate); @@ -129,7 +129,7 @@ rx_streamer::sptr b100_impl::get_rx_stream(const uhd::stream_args_t &args_){ const size_t spp = unsigned(args.args.cast("spp", bpp/bpi)); //make the new streamer given the samples per packet - boost::shared_ptr my_streamer = boost::make_shared(spp); + std::shared_ptr my_streamer = std::make_shared(spp); //init some streamer stuff my_streamer->resize(args.channels.size()); @@ -188,7 +188,7 @@ tx_streamer::sptr b100_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::shared_ptr my_streamer = boost::make_shared(spp); + std::shared_ptr my_streamer = std::make_shared(spp); //init some streamer stuff my_streamer->resize(args.channels.size()); diff --git a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp index 54c367077..6303c301d 100644 --- a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp +++ b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -161,9 +161,9 @@ public: _next_recv_buff_index(0) { for (size_t i = 0; i < this->get_num_recv_frames(); i++){ - _mrb_pool.push_back(boost::make_shared()); + _mrb_pool.push_back(std::make_shared()); } - _the_only_msb = boost::make_shared(usb_zc, frame_boundary); + _the_only_msb = std::make_shared(usb_zc, frame_boundary); } managed_recv_buffer::sptr get_recv_buff(double timeout){ @@ -211,8 +211,8 @@ public: private: zero_copy_if::sptr _internal_zc; size_t _frame_boundary; - std::vector > _mrb_pool; - boost::shared_ptr _the_only_msb; + std::vector > _mrb_pool; + std::shared_ptr _the_only_msb; //state for last recv buffer to create multiple managed buffers managed_recv_buffer::sptr _last_recv_buff; -- cgit v1.2.3