diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-09-28 11:18:57 +0200 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 12:21:32 -0800 |
commit | 1fe98e8701dd0b790b172762c3629db32956d1fc (patch) | |
tree | 7719e69633f9639f1dcdcf00ebf7db6c4cd6dda2 /host/lib/usrp/b100 | |
parent | 8541a9b397fb53034c37dd00289aa96def24d410 (diff) | |
download | uhd-1fe98e8701dd0b790b172762c3629db32956d1fc.tar.gz uhd-1fe98e8701dd0b790b172762c3629db32956d1fc.tar.bz2 uhd-1fe98e8701dd0b790b172762c3629db32956d1fc.zip |
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 <memory>.
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.
Diffstat (limited to 'host/lib/usrp/b100')
-rw-r--r-- | host/lib/usrp/b100/b100_impl.hpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/b100/clock_ctrl.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/b100/codec_ctrl.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/b100/fifo_ctrl_excelsior.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/b100/io_impl.cpp | 22 | ||||
-rw-r--r-- | host/lib/usrp/b100/usb_zero_copy_wrapper.cpp | 10 |
6 files changed, 26 insertions, 26 deletions
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 <uhdlib/usrp/cores/tx_dsp_core_200.hpp> #include <uhdlib/usrp/cores/time64_core_200.hpp> #include <uhdlib/usrp/cores/user_settings_core_200.hpp> -#include <boost/weak_ptr.hpp> +#include <memory> 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<uhd::usrp::recv_packet_demuxer_3000> _recv_demuxer; + std::shared_ptr<uhd::usrp::recv_packet_demuxer_3000> _recv_demuxer; //dboard stuff uhd::usrp::dboard_manager::sptr _dboard_manager; bool _ignore_cal_file; - std::vector<boost::weak_ptr<uhd::rx_streamer> > _rx_streamers; - std::vector<boost::weak_ptr<uhd::tx_streamer> > _tx_streamers; + std::vector<std::weak_ptr<uhd::rx_streamer> > _rx_streamers; + std::vector<std::weak_ptr<uhd::tx_streamer> > _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 <uhd/types/serial.hpp> #include <uhd/utils/noncopyable.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <vector> /*! @@ -19,7 +19,7 @@ */ class b100_clock_ctrl : uhd::noncopyable{ public: - typedef boost::shared_ptr<b100_clock_ctrl> sptr; + typedef std::shared_ptr<b100_clock_ctrl> 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 <uhd/types/serial.hpp> #include <uhd/types/ranges.hpp> #include <uhd/utils/noncopyable.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> /*! * The B100 codec control: @@ -20,7 +20,7 @@ */ class b100_codec_ctrl : uhd::noncopyable{ public: - typedef boost::shared_ptr<b100_codec_ctrl> sptr; + typedef std::shared_ptr<b100_codec_ctrl> 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 <uhd/types/metadata.hpp> #include <uhd/types/serial.hpp> #include <uhd/transport/zero_copy.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <boost/utility.hpp> #include <uhd/types/wb_iface.hpp> #include <string> @@ -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<fifo_ctrl_excelsior> sptr; + typedef std::shared_ptr<fifo_ctrl_excelsior> 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 <boost/format.hpp> #include <boost/bind.hpp> #include <boost/thread.hpp> -#include <boost/make_shared.hpp> +#include <memory> 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<sph::recv_packet_streamer> my_streamer = - boost::dynamic_pointer_cast<sph::recv_packet_streamer>(_rx_streamers[i].lock()); + std::shared_ptr<sph::recv_packet_streamer> my_streamer = + std::dynamic_pointer_cast<sph::recv_packet_streamer>(_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<sph::send_packet_streamer> my_streamer = - boost::dynamic_pointer_cast<sph::send_packet_streamer>(_tx_streamers[i].lock()); + std::shared_ptr<sph::send_packet_streamer> my_streamer = + std::dynamic_pointer_cast<sph::send_packet_streamer>(_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<sph::recv_packet_streamer> my_streamer = - boost::dynamic_pointer_cast<sph::recv_packet_streamer>(_rx_streamers[dspno].lock()); + std::shared_ptr<sph::recv_packet_streamer> my_streamer = + std::dynamic_pointer_cast<sph::recv_packet_streamer>(_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<sph::send_packet_streamer> my_streamer = - boost::dynamic_pointer_cast<sph::send_packet_streamer>(_tx_streamers[dspno].lock()); + std::shared_ptr<sph::send_packet_streamer> my_streamer = + std::dynamic_pointer_cast<sph::send_packet_streamer>(_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<double>("spp", bpp/bpi)); //make the new streamer given the samples per packet - boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::make_shared<sph::recv_packet_streamer>(spp); + std::shared_ptr<sph::recv_packet_streamer> my_streamer = std::make_shared<sph::recv_packet_streamer>(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<sph::send_packet_streamer> my_streamer = boost::make_shared<sph::send_packet_streamer>(spp); + std::shared_ptr<sph::send_packet_streamer> my_streamer = std::make_shared<sph::send_packet_streamer>(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 <uhd/utils/log.hpp> #include <uhd/utils/tasks.hpp> #include <uhdlib/utils/atomic.hpp> -#include <boost/make_shared.hpp> +#include <memory> #include <boost/thread/mutex.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/bind.hpp> @@ -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<usb_zero_copy_wrapper_mrb>()); + _mrb_pool.push_back(std::make_shared<usb_zero_copy_wrapper_mrb>()); } - _the_only_msb = boost::make_shared<usb_zero_copy_wrapper_msb>(usb_zc, frame_boundary); + _the_only_msb = std::make_shared<usb_zero_copy_wrapper_msb>(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<boost::shared_ptr<usb_zero_copy_wrapper_mrb> > _mrb_pool; - boost::shared_ptr<usb_zero_copy_wrapper_msb> _the_only_msb; + std::vector<std::shared_ptr<usb_zero_copy_wrapper_mrb> > _mrb_pool; + std::shared_ptr<usb_zero_copy_wrapper_msb> _the_only_msb; //state for last recv buffer to create multiple managed buffers managed_recv_buffer::sptr _last_recv_buff; |