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/usrp1 | |
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/usrp1')
-rw-r--r-- | host/lib/usrp/usrp1/codec_ctrl.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/io_impl.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/soft_time_ctrl.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/soft_time_ctrl.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.hpp | 18 |
6 files changed, 28 insertions, 28 deletions
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 <uhd/types/serial.hpp> #include <uhd/types/ranges.hpp> #include <uhd/utils/noncopyable.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> /*! * The usrp1 codec control: @@ -20,7 +20,7 @@ */ class usrp1_codec_ctrl : uhd::noncopyable{ public: - typedef boost::shared_ptr<usrp1_codec_ctrl> sptr; + typedef std::shared_ptr<usrp1_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/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 <boost/thread/thread.hpp> #include <boost/bind.hpp> #include <boost/format.hpp> -#include <boost/make_shared.hpp> +#include <memory> #include <atomic> #include <chrono> #include <thread> @@ -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<usrp1_recv_packet_streamer> my_streamer = - boost::dynamic_pointer_cast<usrp1_recv_packet_streamer>(_rx_streamer.lock()); + std::shared_ptr<usrp1_recv_packet_streamer> my_streamer = + std::dynamic_pointer_cast<usrp1_recv_packet_streamer>(_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<usrp1_send_packet_streamer> my_streamer = - boost::dynamic_pointer_cast<usrp1_send_packet_streamer>(_tx_streamer.lock()); + std::shared_ptr<usrp1_send_packet_streamer> my_streamer = + std::dynamic_pointer_cast<usrp1_send_packet_streamer>(_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<usrp1_recv_packet_streamer> my_streamer = - boost::make_shared<usrp1_recv_packet_streamer>(spp, _soft_time_ctrl); + std::shared_ptr<usrp1_recv_packet_streamer> my_streamer = + std::make_shared<usrp1_recv_packet_streamer>(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<void(bool)> tx_fcn = boost::bind(&usrp1_impl::tx_stream_on_off, this, _1); - boost::shared_ptr<usrp1_send_packet_streamer> my_streamer = - boost::make_shared<usrp1_send_packet_streamer>(spp, _soft_time_ctrl, tx_fcn); + std::shared_ptr<usrp1_send_packet_streamer> my_streamer = + std::make_shared<usrp1_send_packet_streamer>(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 <uhdlib/utils/system_time.hpp> #include <uhd/utils/tasks.hpp> -#include <boost/make_shared.hpp> +#include <memory> #include <boost/thread/condition_variable.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <iostream> @@ -116,7 +116,7 @@ public: } void issue_stream_cmd(const stream_cmd_t &cmd){ - _cmd_queue.push_with_wait(boost::make_shared<stream_cmd_t>(cmd)); + _cmd_queue.push_with_wait(std::make_shared<stream_cmd_t>(cmd)); } void stream_on_off(bool enb){ @@ -190,7 +190,7 @@ public: } void recv_cmd_task(void){ //task is looped - boost::shared_ptr<stream_cmd_t> cmd; + std::shared_ptr<stream_cmd_t> 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<boost::shared_ptr<stream_cmd_t> > _cmd_queue; + bounded_buffer<std::shared_ptr<stream_cmd_t> > _cmd_queue; bounded_buffer<async_metadata_t> _async_msg_queue; bounded_buffer<rx_metadata_t> _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 <uhd/types/metadata.hpp> #include <uhd/transport/bounded_buffer.hpp> #include <uhd/utils/noncopyable.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <boost/function.hpp> namespace uhd{ namespace usrp{ @@ -27,7 +27,7 @@ namespace uhd{ namespace usrp{ */ class soft_time_ctrl : uhd::noncopyable{ public: - typedef boost::shared_ptr<soft_time_ctrl> sptr; + typedef std::shared_ptr<soft_time_ctrl> sptr; typedef boost::function<void(bool)> 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 <uhdlib/usrp/common/fx2_ctrl.hpp> #include <uhd/types/wb_iface.hpp> #include <uhd/types/serial.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <uhd/utils/noncopyable.hpp> #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<usrp1_iface> sptr; + typedef std::shared_ptr<usrp1_iface> 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 <uhd/device.hpp> #include <uhd/property_tree.hpp> -#include <uhd/utils/pimpl.hpp> +#include <uhd/transport/usb_zero_copy.hpp> #include <uhd/types/dict.hpp> #include <uhd/types/stream_cmd.hpp> +#include <uhd/usrp/dboard_eeprom.hpp> #include <uhd/usrp/dboard_id.hpp> +#include <uhd/usrp/dboard_manager.hpp> #include <uhd/usrp/mboard_eeprom.hpp> #include <uhd/usrp/subdev_spec.hpp> -#include <uhd/usrp/dboard_eeprom.hpp> -#include <uhd/usrp/dboard_manager.hpp> -#include <uhd/transport/usb_zero_copy.hpp> -#include <boost/weak_ptr.hpp> -#include <complex> +#include <uhd/utils/pimpl.hpp> #include <atomic> +#include <complex> +#include <memory> #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<uhd::rx_streamer> _rx_streamer; - boost::weak_ptr<uhd::tx_streamer> _tx_streamer; + std::weak_ptr<uhd::rx_streamer> _rx_streamer; + std::weak_ptr<uhd::tx_streamer> _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 &); |