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_clock/octoclock/octoclock_impl.cpp | 38 ++++++++++-------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'host/lib/usrp_clock') diff --git a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp index f3cf3f4ea..a1891c7bd 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp @@ -5,31 +5,25 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include - -#include -#include -#include -#include -#include -#include - +#include "octoclock_impl.hpp" +#include "common.h" +#include "octoclock_uart.hpp" #include #include -#include #include +#include #include #include #include #include -#include #include #include #include - -#include "octoclock_impl.hpp" -#include "octoclock_uart.hpp" -#include "common.h" +#include +#include +#include +#include +#include using namespace uhd; using namespace uhd::usrp_clock; @@ -232,21 +226,21 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ _oc_dict[oc].eeprom = octoclock_eeprom_t(_oc_dict[oc].ctrl_xport, _proto_ver); _tree->create(oc_path / "eeprom") .set(_oc_dict[oc].eeprom) - .add_coerced_subscriber(boost::bind(&octoclock_impl::_set_eeprom, this, oc, _1)); + .add_coerced_subscriber(std::bind(&octoclock_impl::_set_eeprom, this, oc, std::placeholders::_1)); //////////////////////////////////////////////////////////////////// // Initialize non-GPSDO sensors //////////////////////////////////////////////////////////////////// _tree->create(oc_path / "time") - .set_publisher(boost::bind(&octoclock_impl::_get_time, this, oc)); + .set_publisher(std::bind(&octoclock_impl::_get_time, this, oc)); _tree->create(oc_path / "sensors/ext_ref_detected") - .set_publisher(boost::bind(&octoclock_impl::_ext_ref_detected, this, oc)); + .set_publisher(std::bind(&octoclock_impl::_ext_ref_detected, this, oc)); _tree->create(oc_path / "sensors/gps_detected") - .set_publisher(boost::bind(&octoclock_impl::_gps_detected, this, oc)); + .set_publisher(std::bind(&octoclock_impl::_gps_detected, this, oc)); _tree->create(oc_path / "sensors/using_ref") - .set_publisher(boost::bind(&octoclock_impl::_which_ref, this, oc)); + .set_publisher(std::bind(&octoclock_impl::_which_ref, this, oc)); _tree->create(oc_path / "sensors/switch_pos") - .set_publisher(boost::bind(&octoclock_impl::_switch_pos, this, oc)); + .set_publisher(std::bind(&octoclock_impl::_switch_pos, this, oc)); //////////////////////////////////////////////////////////////////// // Check reference and GPSDO @@ -266,7 +260,7 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ if(_oc_dict[oc].gps and _oc_dict[oc].gps->gps_detected()){ for(const std::string &name: _oc_dict[oc].gps->get_sensors()){ _tree->create(oc_path / "sensors" / name) - .set_publisher(boost::bind(&gps_ctrl::get_sensor, _oc_dict[oc].gps, name)); + .set_publisher(std::bind(&gps_ctrl::get_sensor, _oc_dict[oc].gps, name)); } } else{ -- cgit v1.2.3