uhd: Remove more superfluous includes

- Mostly boost includes
- In some cases, trivial boost::format() calls were removed to enable
  removing the corresponding header
This commit is contained in:
Martin Braun 2026-06-08 10:23:49 +02:00 committed by Martin Braun
parent 985f5e6eac
commit 675baa5387
37 changed files with 39 additions and 85 deletions

View File

@ -9,7 +9,6 @@
#include <uhd/utils/safe_main.hpp>
#include <uhd/utils/thread.hpp>
#include <boost/format.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/program_options.hpp>
#include <chrono>
#include <complex>

View File

@ -9,9 +9,7 @@
#include <uhd/utils/safe_main.hpp>
#include <uhd/utils/thread.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/program_options.hpp>
#include <boost/thread/thread.hpp>
#include <complex>
#include <csignal>
#include <iostream>
@ -133,8 +131,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
// create a usrp device
std::cout << std::endl;
std::cout << boost::format("Creating the usrp device with: %s...") % args
<< std::endl;
std::cout << "Creating the usrp device with: " << args << "..." << std::endl;
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
// Lock mboard clocks
@ -146,7 +143,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
if (vm.count("subdev"))
usrp->set_tx_subdev_spec(subdev);
std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl;
std::cout << "Using Device: " << usrp->get_pp_string() << std::endl;
// detect which channels to use
std::vector<std::string> channel_strings;
@ -161,9 +158,9 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
}
// set the tx sample rate
std::cout << boost::format("Setting TX Rate: %f Msps...") % (rate / 1e6) << std::endl;
std::cout << "Setting TX Rate: " << (rate / 1e6) << " Msps..." << std::endl;
usrp->set_tx_rate(rate);
std::cout << boost::format("Actual TX Rate: %f Msps...") % (usrp->get_tx_rate() / 1e6)
std::cout << "Actual TX Rate: " << (usrp->get_tx_rate() / 1e6) << " Msps..."
<< std::endl
<< std::endl;
@ -205,7 +202,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
<< std::endl;
}
std::cout << boost::format("Setting device timestamp to 0...") << std::endl;
std::cout << "Setting device timestamp to 0..." << std::endl;
usrp->set_time_now(uhd::time_spec_t(0.0));
// create a transmit streamer
@ -260,8 +257,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
}
if (verbose) {
std::cout << boost::format("Sent packet: %u samples") % num_tx_samps
<< std::endl;
std::cout << "Sent packet: " << num_tx_samps << " samples" << std::endl;
}
num_acc_samps += num_tx_samps;

View File

@ -8,9 +8,7 @@
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/utils/safe_main.hpp>
#include <uhd/utils/thread.hpp>
#include <boost/format.hpp>
#include <boost/program_options.hpp>
#include <boost/thread/thread.hpp>
#include <complex>
#include <iostream>
@ -97,23 +95,21 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
// create a usrp device
std::cout << std::endl;
std::cout << boost::format("Creating the usrp device with: %s...") % args
<< std::endl;
std::cout << "Creating the usrp device with: " << args << "..." << std::endl;
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl;
std::cout << "Using Device: " << usrp->get_pp_string() << std::endl;
// print the actual TX frequency
std::cout << boost::format("Actual TX Freq: %f MHz") % (usrp->get_tx_freq() / 1e06)
<< std::endl;
std::cout << "Actual TX Freq: " << (usrp->get_tx_freq() / 1e6) << " MHz" << std::endl;
// set the tx sample rate
std::cout << boost::format("Setting TX Rate: %f Msps...") % (rate / 1e6) << std::endl;
std::cout << "Setting TX Rate: " << (rate / 1e6) << " Msps..." << std::endl;
usrp->set_tx_rate(rate);
std::cout << boost::format("Actual TX Rate: %f Msps...") % (usrp->get_tx_rate() / 1e6)
std::cout << "Actual TX Rate: " << (usrp->get_tx_rate() / 1e6) << " Msps..."
<< std::endl
<< std::endl;
std::cout << boost::format("Setting device timestamp to 0...") << std::endl;
std::cout << "Setting device timestamp to 0..." << std::endl;
usrp->set_time_now(uhd::time_spec_t(0.0));
// create a transmit streamer
@ -148,8 +144,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
if (num_tx_samps < samps_to_send)
std::cerr << "Send timeout..." << std::endl;
if (verbose)
std::cout << boost::format("Sent packet: %u samples") % num_tx_samps
<< std::endl;
std::cout << "Sent packet: " << num_tx_samps << " samples" << std::endl;
num_acc_samps += num_tx_samps;
}

View File

@ -9,8 +9,6 @@
#include <uhd/image_loader.hpp>
#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <filesystem>
#include <iostream>
#include <map>
@ -54,9 +52,7 @@ bool uhd::image_loader::load(
std::string type = image_loader_args.args.get("type");
if (get_image_loaders().find(type) == get_image_loaders().end()) {
throw uhd::runtime_error(
str(boost::format(
"There is no image loader registered for given type \"%s\".")
% type));
"There is no image loader registered for given type \"" + type + "\".");
} else
return get_image_loaders().at(type)(image_loader_args);
} else {

View File

@ -13,7 +13,6 @@
#include <uhd/utils/math.hpp>
#include <uhdlib/usrp/common/ad9361_ctrl.hpp>
#include <stdint.h>
#include <boost/format.hpp>
#include <functional>
#include <memory>

View File

@ -16,7 +16,7 @@
#include <uhd/utils/log.hpp>
#include <uhdlib/utils/math.hpp>
#include <uhdlib/utils/narrow.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/format.hpp>
#include <functional>
#include <vector>

View File

@ -10,10 +10,10 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/math.hpp>
#include <uhd/utils/safe_call.hpp>
#include <boost/format.hpp>
#include <algorithm>
#include <cstdint>
#include <functional>
#include <memory>
#include <utility>
#include <vector>

View File

@ -11,7 +11,6 @@
#include <uhd/types/serial.hpp>
#include <uhd/types/wb_iface.hpp>
#include <uhd/utils/noncopyable.hpp>
#include <boost/utility.hpp>
#include <memory>
class i2c_core_200 : uhd::noncopyable, public uhd::i2c_iface

View File

@ -11,7 +11,6 @@
#include <uhd/types/time_spec.hpp>
#include <uhd/types/wb_iface.hpp>
#include <uhd/utils/noncopyable.hpp>
#include <boost/utility.hpp>
#include <memory>
#include <string>
#include <vector>

View File

@ -10,7 +10,6 @@
#include <uhd/config.hpp>
#include <uhd/types/wb_iface.hpp>
#include <uhd/utils/noncopyable.hpp>
#include <boost/utility.hpp>
#include <memory>
class user_settings_core_200 : uhd::noncopyable

View File

@ -9,7 +9,6 @@
#include <uhdlib/rfnoc/chdr_ctrl_endpoint.hpp>
#include <uhdlib/rfnoc/link_stream_manager.hpp>
#include <uhdlib/rfnoc/mgmt_portal.hpp>
#include <boost/format.hpp>
#include <map>
using namespace uhd;

View File

@ -2,7 +2,6 @@
#include "{lvbitx_classname}_lvbitx.hpp"
#include <uhd/utils/paths.hpp>
#include <boost/algorithm/string.hpp>
#include <filesystem>
#include <fstream>
#include <iostream>

View File

@ -7,7 +7,6 @@
#include <uhd/types/tune_request.h>
#include <uhd/types/tune_result.h>
#include <boost/format.hpp>
#include <cstdlib>
#include <cstring>
#include <iostream>

View File

@ -7,6 +7,7 @@
#include <uhd/utils/log.hpp>
#include <uhdlib/usrp/common/ad936x_manager.hpp>
#include <boost/format.hpp>
#include <boost/functional/hash.hpp>
#include <chrono>
#include <cmath>

View File

@ -8,7 +8,6 @@
#include <uhd/utils/log.hpp>
#include <uhdlib/usrp/common/io_service_args.hpp>
#include <uhdlib/usrp/constrained_device_args.hpp>
#include <boost/format.hpp>
#include <regex>
#include <string>

View File

@ -391,8 +391,8 @@ public:
const auto lock_status = (value_read == 0xFFFF);
UHD_LOG_TRACE("LMX2592",
str(boost::format("Read Lock status: 0x%04X")
% static_cast<unsigned int>(value_read)));
"Read Lock status: 0x" << std::hex << static_cast<unsigned int>(value_read)
<< std::dec);
return lock_status;
}

View File

@ -8,7 +8,6 @@
#include <uhd/exception.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhdlib/usrp/cores/time64_core_200.hpp>
#include <boost/math/special_functions/round.hpp>
#define REG_TIME64_TICKS_HI _base + 0
#define REG_TIME64_TICKS_LO _base + 4

View File

@ -7,7 +7,6 @@
#include "db_sbx_common.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/math/special_functions/round.hpp>
#include <functional>
using namespace uhd;
@ -50,8 +49,7 @@ void sbx_xcvr::cbx::write_lo_regs(
**********************************************************************/
double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq)
{
UHD_LOGGER_TRACE("CBX") << boost::format("CBX tune: target frequency %f MHz")
% (target_freq / 1e6);
UHD_LOG_TRACE("CBX", "CBX tune: target frequency " << (target_freq / 1e6) << " MHz");
// clip the input
target_freq = cbx_freq_range.clip(target_freq);

View File

@ -12,6 +12,7 @@
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/log.hpp>
#include <boost/format.hpp>
#include <cmath>
#include <functional>

View File

@ -63,8 +63,6 @@
#include <uhd/usrp/dboard_base.hpp>
#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <boost/format.hpp>
#include <boost/math/special_functions/round.hpp>
#include <functional>
#include <memory>

View File

@ -17,7 +17,6 @@
#include <uhd/usrp/dboard_manager.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/static.hpp>
#include <boost/format.hpp>
#include <functional>
using namespace uhd;
@ -82,8 +81,7 @@ wbx_simple::wbx_simple(ctor_args_t args) : wbx_base(args)
////////////////////////////////////////////////////////////////////
this->get_rx_subtree()->access<std::string>("name").set(
std::string(str(boost::format("%s+GDB")
% this->get_rx_subtree()->access<std::string>("name").get())));
this->get_rx_subtree()->access<std::string>("name").get() + "+GDB");
this->get_rx_subtree()
->create<std::string>("antenna/value")
.add_coerced_subscriber(
@ -97,8 +95,7 @@ wbx_simple::wbx_simple(ctor_args_t args) : wbx_base(args)
// Register TX properties
////////////////////////////////////////////////////////////////////
this->get_tx_subtree()->access<std::string>("name").set(
std::string(str(boost::format("%s+GDB")
% this->get_tx_subtree()->access<std::string>("name").get())));
this->get_tx_subtree()->access<std::string>("name").get() + "+GDB");
this->get_tx_subtree()
->create<std::string>("antenna/value")
.add_coerced_subscriber(

View File

@ -16,7 +16,6 @@
#include <uhd/utils/log.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/math/special_functions/round.hpp>
#include <functional>
using namespace uhd;

View File

@ -215,8 +215,7 @@ double wbx_base::wbx_version3::set_lo_freq(dboard_iface::unit_t unit, double tar
// clip to tuning range
target_freq = wbx_v3_freq_range.clip(target_freq);
UHD_LOGGER_TRACE("WBX") << boost::format("WBX tune: target frequency %f MHz")
% (target_freq / 1e6);
UHD_LOG_TRACE("WBX", "WBX tune: target frequency " << (target_freq / 1e6) << " MHz");
/*
* If the user sets 'mode_n=integer' in the tuning args, the user wishes to

View File

@ -227,8 +227,7 @@ double wbx_base::wbx_version4::set_lo_freq(dboard_iface::unit_t unit, double tar
// clip to tuning range
target_freq = wbx_v4_freq_range.clip(target_freq);
UHD_LOGGER_TRACE("WBX") << boost::format("WBX tune: target frequency %f MHz")
% (target_freq / 1e6);
UHD_LOG_TRACE("WBX", "WBX tune: target frequency " << (target_freq / 1e6) << " MHz");
/*
* If the user sets 'mode_n=integer' in the tuning args, the user wishes to

View File

@ -9,9 +9,6 @@
#include <uhd/types/sensors.hpp>
#include <uhd/utils/log.hpp>
#include <uhdlib/rfnoc/reg_iface_adapter.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/split.hpp>
#include <string>
#include <vector>
@ -38,10 +35,11 @@ void e3xx_radio_control_impl::_init_defaults()
const double block_args_mcr =
block_args.cast<double>("master_clock_rate", _master_clock_rate);
if (block_args_mcr != _master_clock_rate) {
throw uhd::runtime_error(
str(boost::format("Master clock rate mismatch. Device returns %f MHz, "
"but should have been %f MHz.")
% (_master_clock_rate / 1e6) % (block_args_mcr / 1e6)));
UHD_LOG_THROW(uhd::runtime_error,
get_unique_id(),
"Master clock rate mismatch. Device returns "
<< std::fixed << std::setprecision(6) << (_master_clock_rate / 1e6)
<< " MHz, but should have been " << (block_args_mcr / 1e6) << " MHz.");
}
RFNOC_LOG_DEBUG("Master Clock Rate is: " << (_master_clock_rate / 1e6) << " MHz.");
set_tick_rate(_master_clock_rate);

View File

@ -20,7 +20,6 @@
#include <uhdlib/usrp/dboard/fbx/fbx_constants.hpp>
#include <uhdlib/usrp/dboard/fbx/fbx_dboard.hpp>
#include <uhdlib/usrp/dboard/fbx/fbx_expert.hpp>
#include <boost/algorithm/string.hpp>
#include <sstream>
#include <vector>

View File

@ -9,6 +9,7 @@
#include "magnesium_radio_control.hpp"
#include <uhd/exception.hpp>
#include <uhd/utils/log.hpp>
#include <boost/format.hpp>
using namespace uhd;
using namespace uhd::usrp;

View File

@ -17,7 +17,6 @@
#include <uhd/utils/math.hpp>
#include <uhdlib/usrp/common/apply_corrections.hpp>
#include <uhdlib/utils/narrow.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <chrono>
#include <cmath>

View File

@ -5,16 +5,13 @@
// SPDX-License-Identifier: GPL-3.0-or-later
//
#ifndef INCLUDED_USRP2_FIFO_CTRL_HPP
#define INCLUDED_USRP2_FIFO_CTRL_HPP
#pragma once
#include <uhd/transport/zero_copy.hpp>
#include <uhd/types/serial.hpp>
#include <uhd/types/time_spec.hpp>
#include <uhd/types/wb_iface.hpp>
#include <boost/utility.hpp>
#include <memory>
#include <string>
/*!
* The usrp2 FIFO control class:
@ -31,5 +28,3 @@ public:
//! Set the tick rate (converting time into ticks)
virtual void set_tick_rate(const double rate) = 0;
};
#endif /* INCLUDED_USRP2_FIFO_CTRL_HPP */

View File

@ -13,7 +13,6 @@
#include <uhd/types/serial.hpp>
#include <uhd/types/wb_iface.hpp>
#include <uhd/usrp/mboard_eeprom.hpp>
#include <boost/utility.hpp>
#include <functional>
#include <memory>
#include <string>

View File

@ -944,9 +944,6 @@ meta_range_t usrp2_impl::get_tx_dsp_freq_range(const std::string& mb)
return meta_range_t(-dac_rate / 2, +dac_rate / 2, dsp_range_step);
}
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/sign.hpp>
void usrp2_impl::update_clock_source(const std::string& mb, const std::string& source)
{
// NOTICE: U2_REG_MISC_CTRL_CLOCK is on the wb clock, and cannot be set from fifo_ctrl

View File

@ -11,7 +11,6 @@
#include <uhd/config.hpp>
#include <uhd/types/serial.hpp>
#include <uhd/types/wb_iface.hpp>
#include <boost/utility.hpp>
#include <memory>
class x300_mb_eeprom_iface : public uhd::i2c_iface

View File

@ -419,10 +419,11 @@ void x400_radio_control_impl::_validate_master_clock_rate_args()
// configured to do.
const double master_clock_rate = _db_rpcc->get_master_clock_rate();
if (!uhd::math::frequencies_are_equal(get_rate(), master_clock_rate)) {
throw uhd::runtime_error(
str(boost::format("Master clock rate mismatch. Device returns %f MHz, "
"but should have been %f MHz.")
% (master_clock_rate / 1e6) % (get_rate() / 1e6)));
UHD_LOG_THROW(uhd::runtime_error,
get_unique_id(),
"Master clock rate mismatch. Device returns "
<< std::fixed << std::setprecision(6) << (master_clock_rate / 1e6)
<< " MHz, but should have been " << (get_rate() / 1e6) << " MHz.");
}
RFNOC_LOG_DEBUG("Master Clock Rate is: " << (master_clock_rate / 1e6) << " MHz.");
}

View File

@ -10,7 +10,6 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/thread.hpp>
#include <uhd/utils/thread_priority.h>
#include <boost/format.hpp>
#include <iostream>
uhd_error uhd_set_thread_priority(float priority, bool realtime)

View File

@ -8,7 +8,6 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/version.hpp>
#include <boost/version.hpp>
#include <iostream>
std::string uhd::get_version_string(void)
@ -24,4 +23,4 @@ std::string uhd::get_abi_string(void)
std::string uhd::get_component(void)
{
return "@UHD_COMPONENT@";
}
}

View File

@ -10,7 +10,6 @@
#include <uhd/utils/thread.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/thread/condition_variable.hpp>
#include <cmath>
#include <complex>
#include <csignal>

View File

@ -7,7 +7,7 @@
#include "usrp_cal_utils.hpp"
#include <uhd/utils/safe_main.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/format.hpp>
#include <boost/program_options.hpp>
#include <chrono>
#include <complex>