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/usrp1/codec_ctrl.hpp | 4 ++-- host/lib/usrp/usrp1/io_impl.cpp | 18 +++++++++--------- host/lib/usrp/usrp1/soft_time_ctrl.cpp | 8 ++++---- host/lib/usrp/usrp1/soft_time_ctrl.hpp | 4 ++-- host/lib/usrp/usrp1/usrp1_iface.hpp | 4 ++-- host/lib/usrp/usrp1/usrp1_impl.hpp | 18 +++++++++--------- 6 files changed, 28 insertions(+), 28 deletions(-) (limited to 'host/lib/usrp/usrp1') diff --git a/host/lib/usrp/usrp1/codec_ctrl.hpp b/host/lib/usrp/usrp1/codec_ctrl.hpp index dd038fb82..c03947673 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.hpp +++ b/host/lib/usrp/usrp1/codec_ctrl.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include /*! * The usrp1 codec control: @@ -20,7 +20,7 @@ */ class usrp1_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/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 3ccfa11c9..3d45824e4 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -508,8 +508,8 @@ double usrp1_impl::update_rx_samp_rate(size_t dspno, const double samp_rate){ this->restore_rx(s); //update the streamer if created - boost::shared_ptr my_streamer = - boost::dynamic_pointer_cast(_rx_streamer.lock()); + std::shared_ptr my_streamer = + std::dynamic_pointer_cast(_rx_streamer.lock()); if (my_streamer.get() != NULL){ my_streamer->set_samp_rate(_master_clock_rate / rate); } @@ -530,8 +530,8 @@ double usrp1_impl::update_tx_samp_rate(size_t dspno, const double samp_rate){ this->restore_tx(s); //update the streamer if created - boost::shared_ptr my_streamer = - boost::dynamic_pointer_cast(_tx_streamer.lock()); + std::shared_ptr my_streamer = + std::dynamic_pointer_cast(_tx_streamer.lock()); if (my_streamer.get() != NULL){ my_streamer->set_samp_rate(_master_clock_rate / rate); } @@ -631,8 +631,8 @@ rx_streamer::sptr usrp1_impl::get_rx_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, _soft_time_ctrl); + std::shared_ptr my_streamer = + std::make_shared(spp, _soft_time_ctrl); //init some streamer stuff my_streamer->set_tick_rate(_master_clock_rate); @@ -688,8 +688,8 @@ tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args_){ //make the new streamer given the samples per packet boost::function tx_fcn = boost::bind(&usrp1_impl::tx_stream_on_off, this, _1); - boost::shared_ptr my_streamer = - boost::make_shared(spp, _soft_time_ctrl, tx_fcn); + std::shared_ptr my_streamer = + std::make_shared(spp, _soft_time_ctrl, tx_fcn); //init some streamer stuff my_streamer->set_tick_rate(_master_clock_rate); diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp index 7f39caf8a..92031136d 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp @@ -8,7 +8,7 @@ #include "soft_time_ctrl.hpp" #include #include -#include +#include #include #include #include @@ -116,7 +116,7 @@ public: } void issue_stream_cmd(const stream_cmd_t &cmd){ - _cmd_queue.push_with_wait(boost::make_shared(cmd)); + _cmd_queue.push_with_wait(std::make_shared(cmd)); } void stream_on_off(bool enb){ @@ -190,7 +190,7 @@ public: } void recv_cmd_task(void){ //task is looped - boost::shared_ptr cmd; + std::shared_ptr cmd; if (_cmd_queue.pop_with_timed_wait(cmd, 0.25)) { recv_cmd_handle_cmd(*cmd); } @@ -213,7 +213,7 @@ private: size_t _nsamps_remaining; stream_cmd_t::stream_mode_t _stream_mode; time_spec_t _time_offset; - bounded_buffer > _cmd_queue; + bounded_buffer > _cmd_queue; bounded_buffer _async_msg_queue; bounded_buffer _inline_msg_queue; const cb_fcn_type _stream_on_off; diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.hpp b/host/lib/usrp/usrp1/soft_time_ctrl.hpp index 1422a5ced..9143b6af2 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.hpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.hpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include namespace uhd{ namespace usrp{ @@ -27,7 +27,7 @@ namespace uhd{ namespace usrp{ */ class soft_time_ctrl : uhd::noncopyable{ public: - typedef boost::shared_ptr sptr; + typedef std::shared_ptr sptr; typedef boost::function cb_fcn_type; virtual ~soft_time_ctrl(void) = 0; diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp index 4fb5cd4ee..b01b2d088 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.hpp +++ b/host/lib/usrp/usrp1/usrp1_iface.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #define SPI_ENABLE_FPGA 0x01 @@ -35,7 +35,7 @@ class usrp1_iface : public uhd::wb_iface, public uhd::i2c_iface, public uhd::spi_iface, uhd::noncopyable { public: - typedef boost::shared_ptr sptr; + typedef std::shared_ptr sptr; /*! * Make a new usrp1 interface with the control transport. diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 1cf8362e1..9e0a97f47 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -5,23 +5,23 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include "usrp1_iface.hpp" #include "codec_ctrl.hpp" #include "soft_time_ctrl.hpp" +#include "usrp1_iface.hpp" #include #include -#include +#include #include #include +#include #include +#include #include #include -#include -#include -#include -#include -#include +#include #include +#include +#include #ifndef INCLUDED_USRP1_IMPL_HPP #define INCLUDED_USRP1_IMPL_HPP @@ -89,8 +89,8 @@ private: double _master_clock_rate; //clock rate shadow //weak pointers to streamers for update purposes - boost::weak_ptr _rx_streamer; - boost::weak_ptr _tx_streamer; + std::weak_ptr _rx_streamer; + std::weak_ptr _tx_streamer; void set_mb_eeprom(const uhd::usrp::mboard_eeprom_t &); void set_db_eeprom(const std::string &, const std::string &, const uhd::usrp::dboard_eeprom_t &); -- cgit v1.2.3