From d3a16b702230534f7265613a73204bdb051a458e Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 16 Oct 2019 16:21:19 -0700 Subject: uhd: Replace all occurrences of boost::bind with std::bind Note: Replacing everything with a lambda would be even better, but that can't be easily scripted so we'll do this as a first step to reduce the Boost footprint. This also removes occurences of #include , and makes sure all usages of std::bind have an #include . clang-format wasn't always applied to minimize the changeset in this commit, however, it was applied to the blocks of #includes. Due to conflicts with other Boost libraries, the placeholders _1, _2, etc. could not be directly used, but had to be explicitly called out (as std::placeholders::_1, etc.). This makes the use of std::bind even uglier, which serves as another reminder that using std::bind (and even more so, boost::bind) should be avoided. nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It was not possible to remove it by simply doing a search and replace, so it will be removed in a separate commit. --- host/lib/usrp/cores/radio_ctrl_core_3000.cpp | 2 +- host/lib/usrp/cores/rx_dsp_core_3000.cpp | 10 +++++----- host/lib/usrp/cores/rx_frontend_core_200.cpp | 10 +++++----- host/lib/usrp/cores/rx_frontend_core_3000.cpp | 8 ++++---- host/lib/usrp/cores/tx_dsp_core_3000.cpp | 10 +++++----- host/lib/usrp/cores/tx_frontend_core_200.cpp | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'host/lib/usrp/cores') diff --git a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp index fe4a01b35..15226e8c4 100644 --- a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp +++ b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include using namespace uhd; diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 46fce3f69..d9ad108aa 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -14,9 +14,9 @@ #include #include #include -#include //thread sleep #include #include +#include #define REG_DSP_RX_FREQ _dsp_base + 0 #define REG_DSP_RX_SCALE_IQ _dsp_base + 4 @@ -297,16 +297,16 @@ public: void populate_subtree(property_tree::sptr subtree) { subtree->create("rate/range") - .set_publisher(boost::bind(&rx_dsp_core_3000::get_host_rates, this)); + .set_publisher(std::bind(&rx_dsp_core_3000::get_host_rates, this)); subtree->create("rate/value") .set(DEFAULT_RATE) - .set_coercer(boost::bind(&rx_dsp_core_3000::set_host_rate, this, _1)); + .set_coercer(std::bind(&rx_dsp_core_3000::set_host_rate, this, std::placeholders::_1)); subtree->create("freq/value") .set(DEFAULT_CORDIC_FREQ) - .set_coercer(boost::bind(&rx_dsp_core_3000::set_freq, this, _1)) + .set_coercer(std::bind(&rx_dsp_core_3000::set_freq, this, std::placeholders::_1)) .set_publisher([this]() { return this->get_freq(); }); subtree->create("freq/range") - .set_publisher(boost::bind(&rx_dsp_core_3000::get_freq_range, this)); + .set_publisher(std::bind(&rx_dsp_core_3000::get_freq_range, this)); } private: diff --git a/host/lib/usrp/cores/rx_frontend_core_200.cpp b/host/lib/usrp/cores/rx_frontend_core_200.cpp index f0556e4b0..f30da9466 100644 --- a/host/lib/usrp/cores/rx_frontend_core_200.cpp +++ b/host/lib/usrp/cores/rx_frontend_core_200.cpp @@ -5,10 +5,10 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include #include +#include #include -#include +#include using namespace uhd; @@ -82,15 +82,15 @@ public: ; subtree->create >("dc_offset/value") .set(DEFAULT_DC_OFFSET_VALUE) - .set_coercer(boost::bind(&rx_frontend_core_200::set_dc_offset, this, _1)) + .set_coercer(std::bind(&rx_frontend_core_200::set_dc_offset, this, std::placeholders::_1)) ; subtree->create("dc_offset/enable") .set(DEFAULT_DC_OFFSET_ENABLE) - .add_coerced_subscriber(boost::bind(&rx_frontend_core_200::set_dc_offset_auto, this, _1)) + .add_coerced_subscriber(std::bind(&rx_frontend_core_200::set_dc_offset_auto, this, std::placeholders::_1)) ; subtree->create >("iq_balance/value") .set(DEFAULT_IQ_BALANCE_VALUE) - .add_coerced_subscriber(boost::bind(&rx_frontend_core_200::set_iq_balance, this, _1)) + .add_coerced_subscriber(std::bind(&rx_frontend_core_200::set_iq_balance, this, std::placeholders::_1)) ; } diff --git a/host/lib/usrp/cores/rx_frontend_core_3000.cpp b/host/lib/usrp/cores/rx_frontend_core_3000.cpp index dfaa4a76c..aa83b83c8 100644 --- a/host/lib/usrp/cores/rx_frontend_core_3000.cpp +++ b/host/lib/usrp/cores/rx_frontend_core_3000.cpp @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include using namespace uhd; @@ -177,15 +177,15 @@ public: .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX)); subtree->create>("dc_offset/value") .set(DEFAULT_DC_OFFSET_VALUE) - .set_coercer(boost::bind(&rx_frontend_core_3000::set_dc_offset, this, _1)); + .set_coercer(std::bind(&rx_frontend_core_3000::set_dc_offset, this, std::placeholders::_1)); subtree->create("dc_offset/enable") .set(DEFAULT_DC_OFFSET_ENABLE) .add_coerced_subscriber( - boost::bind(&rx_frontend_core_3000::set_dc_offset_auto, this, _1)); + std::bind(&rx_frontend_core_3000::set_dc_offset_auto, this, std::placeholders::_1)); subtree->create>("iq_balance/value") .set(DEFAULT_IQ_BALANCE_VALUE) .add_coerced_subscriber( - boost::bind(&rx_frontend_core_3000::set_iq_balance, this, _1)); + std::bind(&rx_frontend_core_3000::set_iq_balance, this, std::placeholders::_1)); } double get_output_rate() diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp index be7593841..c89b684fa 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp @@ -13,9 +13,9 @@ #include #include #include -#include //sleep #include #include +#include #define REG_DSP_TX_FREQ _dsp_base + 0 #define REG_DSP_TX_SCALE_IQ _dsp_base + 4 @@ -184,16 +184,16 @@ public: void populate_subtree(property_tree::sptr subtree) { subtree->create("rate/range") - .set_publisher(boost::bind(&tx_dsp_core_3000::get_host_rates, this)); + .set_publisher(std::bind(&tx_dsp_core_3000::get_host_rates, this)); subtree->create("rate/value") .set(DEFAULT_RATE) - .set_coercer(boost::bind(&tx_dsp_core_3000::set_host_rate, this, _1)); + .set_coercer(std::bind(&tx_dsp_core_3000::set_host_rate, this, std::placeholders::_1)); subtree->create("freq/value") .set(DEFAULT_CORDIC_FREQ) - .set_coercer(boost::bind(&tx_dsp_core_3000::set_freq, this, _1)) + .set_coercer(std::bind(&tx_dsp_core_3000::set_freq, this, std::placeholders::_1)) .set_publisher([this]() { return this->get_freq(); }); subtree->create("freq/range") - .set_publisher(boost::bind(&tx_dsp_core_3000::get_freq_range, this)); + .set_publisher(std::bind(&tx_dsp_core_3000::get_freq_range, this)); } private: diff --git a/host/lib/usrp/cores/tx_frontend_core_200.cpp b/host/lib/usrp/cores/tx_frontend_core_200.cpp index af40d4379..c02ce755a 100644 --- a/host/lib/usrp/cores/tx_frontend_core_200.cpp +++ b/host/lib/usrp/cores/tx_frontend_core_200.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include using namespace uhd; @@ -78,11 +78,11 @@ public: ; subtree->create< std::complex >("dc_offset/value") .set(DEFAULT_DC_OFFSET_VALUE) - .set_coercer(boost::bind(&tx_frontend_core_200::set_dc_offset, this, _1)) + .set_coercer(std::bind(&tx_frontend_core_200::set_dc_offset, this, std::placeholders::_1)) ; subtree->create< std::complex >("iq_balance/value") .set(DEFAULT_IQ_BALANCE_VALUE) - .add_coerced_subscriber(boost::bind(&tx_frontend_core_200::set_iq_balance, this, _1)) + .add_coerced_subscriber(std::bind(&tx_frontend_core_200::set_iq_balance, this, std::placeholders::_1)) ; } -- cgit v1.2.3