diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-06-27 19:06:50 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-06-29 13:40:07 -0700 |
commit | 47cdd6319c74a7b823843aad5ff3fa370ed1e6ef (patch) | |
tree | 216e88f36dbb5ba0b933f0a5ec3c2a151e972589 /host/lib/usrp | |
parent | 412a7053cc0698fd8e1a09d9c40ec2f96cf629af (diff) | |
download | uhd-47cdd6319c74a7b823843aad5ff3fa370ed1e6ef.tar.gz uhd-47cdd6319c74a7b823843aad5ff3fa370ed1e6ef.tar.bz2 uhd-47cdd6319c74a7b823843aad5ff3fa370ed1e6ef.zip |
uhd: Replaced many lexical_cast with appropriate C++11 equivalents
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/b100/b100_impl.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/common/constrained_device_args.hpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/dboard_eeprom.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/dboard_eeprom_c.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_eeprom_manager.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_sensor_manager.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_sysfs_hooks.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/gpsd_iface.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/mboard_eeprom.cpp | 16 | ||||
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/n230/n230_eeprom_manager.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/n230/n230_resource_manager.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/n230/n230_stream_manager.cpp | 16 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/clock_ctrl.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_fw_ctrl.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_io_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_ctrl_impl.hpp | 2 |
20 files changed, 52 insertions, 62 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp index 25f99e85e..27af43c48 100644 --- a/host/lib/usrp/b100/b100_impl.cpp +++ b/host/lib/usrp/b100/b100_impl.cpp @@ -29,7 +29,6 @@ #include <boost/assign/list_of.hpp> #include <boost/filesystem.hpp> #include <boost/thread/thread.hpp> -#include <boost/lexical_cast.hpp> #include <cstdio> #include <iostream> diff --git a/host/lib/usrp/common/constrained_device_args.hpp b/host/lib/usrp/common/constrained_device_args.hpp index 47c5f4cc0..42632d0dd 100644 --- a/host/lib/usrp/common/constrained_device_args.hpp +++ b/host/lib/usrp/common/constrained_device_args.hpp @@ -20,7 +20,6 @@ #include <uhd/types/device_addr.hpp> #include <uhd/exception.hpp> -#include <boost/lexical_cast.hpp> #include <boost/format.hpp> #include <boost/algorithm/string.hpp> #include <boost/assign/list_of.hpp> @@ -116,7 +115,7 @@ namespace usrp { } } inline virtual std::string to_string() const { - return key() + "=" + boost::lexical_cast<std::string>(get()); + return key() + "=" + std::to_string(get()); } private: data_t _value; @@ -192,7 +191,7 @@ namespace usrp { } inline void parse(const std::string& str_rep) { try { - _value = (boost::lexical_cast<int>(str_rep) != 0); + _value = (std::stoi(str_rep) != 0); } catch (std::exception& ex) { if (str_rep.empty()) { //If str_rep is empty then the device_addr was set @@ -250,7 +249,7 @@ namespace usrp { throw uhd::value_error(str(boost::format( "Invalid device arg value: %s (Minimum: %s, Maximum: %s)") % arg.to_string() % - boost::lexical_cast<std::string>(min) % boost::lexical_cast<std::string>(max))); + std::to_string(min) % std::to_string(max))); } } @@ -269,7 +268,7 @@ namespace usrp { if (!match) { std::string valid_values_str; for (size_t i = 0; i < valid_values.size(); i++) { - valid_values_str += ((i==0)?"":", ") + boost::lexical_cast<std::string>(valid_values[i]); + valid_values_str += ((i==0)?"":", ") + std::to_string(valid_values[i]); throw uhd::value_error(str(boost::format( "Invalid device arg value: %s (Valid: {%s})") % arg.to_string() % valid_values_str diff --git a/host/lib/usrp/dboard_eeprom.cpp b/host/lib/usrp/dboard_eeprom.cpp index 900d28e80..bff9f7a15 100644 --- a/host/lib/usrp/dboard_eeprom.cpp +++ b/host/lib/usrp/dboard_eeprom.cpp @@ -107,7 +107,7 @@ void dboard_eeprom_t::load(i2c_iface &iface, uint8_t addr){ | (uint16_t(bytes[DB_EEPROM_REV_MSB]) << 8) ; if (rev_num != 0 and rev_num != 0xffff){ - revision = boost::lexical_cast<std::string>(rev_num); + revision = std::to_string(rev_num); } }catch(const uhd::assertion_error &){ diff --git a/host/lib/usrp/dboard_eeprom_c.cpp b/host/lib/usrp/dboard_eeprom_c.cpp index e3ef4933f..5d617f941 100644 --- a/host/lib/usrp/dboard_eeprom_c.cpp +++ b/host/lib/usrp/dboard_eeprom_c.cpp @@ -18,8 +18,6 @@ #include <uhd/usrp/dboard_eeprom.h> #include <uhd/error.h> -#include <boost/lexical_cast.hpp> - #include <string.h> uhd_error uhd_dboard_eeprom_make( @@ -84,7 +82,7 @@ uhd_error uhd_dboard_eeprom_get_revision( int* revision_out ){ UHD_SAFE_C_SAVE_ERROR(h, - *revision_out = boost::lexical_cast<int>(h->dboard_eeprom_cpp.revision); + *revision_out = std::stoi(h->dboard_eeprom_cpp.revision); ) } @@ -93,7 +91,7 @@ uhd_error uhd_dboard_eeprom_set_revision( int revision ){ UHD_SAFE_C_SAVE_ERROR(h, - h->dboard_eeprom_cpp.revision = boost::lexical_cast<std::string>(revision); + h->dboard_eeprom_cpp.revision = std::to_string(revision); ) } diff --git a/host/lib/usrp/e300/e300_eeprom_manager.cpp b/host/lib/usrp/e300/e300_eeprom_manager.cpp index d43ca3d4c..f994ec996 100644 --- a/host/lib/usrp/e300/e300_eeprom_manager.cpp +++ b/host/lib/usrp/e300/e300_eeprom_manager.cpp @@ -67,9 +67,9 @@ const mboard_eeprom_t& e300_eeprom_manager::read_mb_eeprom(void) mb_eeprom_map_t &map = *map_ptr; - _mb_eeprom["product"] = boost::lexical_cast<std::string>( + _mb_eeprom["product"] = std::to_string( uhd::ntohx<uint16_t>(map.hw_product)); - _mb_eeprom["revision"] = boost::lexical_cast<std::string>( + _mb_eeprom["revision"] = std::to_string( uhd::ntohx<uint16_t>(map.hw_revision)); _mb_eeprom["serial"] = _bytes_to_string( map.serial, MB_SERIAL_LEN); @@ -101,7 +101,7 @@ const dboard_eeprom_t& e300_eeprom_manager::read_db_eeprom(void) _db_eeprom.id = uhd::usrp::dboard_id_t::from_uint16( uhd::ntohx<uint16_t>(map.hw_product)); - _db_eeprom.revision = boost::lexical_cast<std::string>( + _db_eeprom.revision = std::to_string( uhd::ntohx<uint16_t>(map.hw_revision)); _db_eeprom.serial = _bytes_to_string( map.serial, DB_SERIAL_LEN); diff --git a/host/lib/usrp/e300/e300_sensor_manager.cpp b/host/lib/usrp/e300/e300_sensor_manager.cpp index b96656e5e..52f888799 100644 --- a/host/lib/usrp/e300/e300_sensor_manager.cpp +++ b/host/lib/usrp/e300/e300_sensor_manager.cpp @@ -171,11 +171,11 @@ public: uhd::sensor_value_t get_mb_temp(void) { - double scale = boost::lexical_cast<double>( + double scale = std::stod( e300_get_sysfs_attr(E300_TEMP_SYSFS, "in_temp0_scale")); - unsigned long raw = boost::lexical_cast<unsigned long>( + unsigned long raw = std::stoul( e300_get_sysfs_attr(E300_TEMP_SYSFS, "in_temp0_raw")); - unsigned long offset = boost::lexical_cast<unsigned long>( + unsigned long offset = std::stoul( e300_get_sysfs_attr(E300_TEMP_SYSFS, "in_temp0_offset")); return sensor_value_t("temp", (raw + offset) * scale / 1000, "C"); } diff --git a/host/lib/usrp/e300/e300_sysfs_hooks.cpp b/host/lib/usrp/e300/e300_sysfs_hooks.cpp index bcfca8b92..08562f7d7 100644 --- a/host/lib/usrp/e300/e300_sysfs_hooks.cpp +++ b/host/lib/usrp/e300/e300_sysfs_hooks.cpp @@ -96,11 +96,11 @@ e300_fifo_config_t e300_read_sysfs(void) e300_fifo_config_t config; - config.buff_length = boost::lexical_cast<unsigned long>( + config.buff_length = std::stoul( e300_get_sysfs_attr(E300_AXI_FPGA_SYSFS, "buffer_length")); - config.ctrl_length = boost::lexical_cast<unsigned long>( + config.ctrl_length = std::stoul( e300_get_sysfs_attr(E300_AXI_FPGA_SYSFS, "control_length")); - config.phys_addr = boost::lexical_cast<unsigned long>( + config.phys_addr = std::stoul( e300_get_sysfs_attr(E300_AXI_FPGA_SYSFS, "phys_addr")); return config; diff --git a/host/lib/usrp/gpsd_iface.cpp b/host/lib/usrp/gpsd_iface.cpp index c5d4a1745..1955a4121 100644 --- a/host/lib/usrp/gpsd_iface.cpp +++ b/host/lib/usrp/gpsd_iface.cpp @@ -24,7 +24,6 @@ #include <stdint.h> #include "boost/date_time/gregorian/gregorian.hpp" #include <boost/format.hpp> -#include <boost/lexical_cast.hpp> #include <boost/thread/shared_mutex.hpp> #include <boost/thread.hpp> #include <boost/math/special_functions/fpclassify.hpp> diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index ecae5e56d..f7222426d 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -50,7 +50,7 @@ static byte_vector_t string_to_uint16_bytes(const std::string &num_str){ //! convert a byte vector read from eeprom to a string static std::string uint16_bytes_to_string(const byte_vector_t &bytes){ const uint16_t num = (uint16_t(bytes.at(0)) << 0) | (uint16_t(bytes.at(1)) << 8); - return (num == 0 or num == 0xffff)? "" : boost::lexical_cast<std::string>(num); + return (num == 0 or num == 0xffff)? "" : std::to_string(num); } /*********************************************************************** @@ -134,7 +134,7 @@ static void load_n100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ if (mb_eeprom["serial"].empty()){ byte_vector_t mac_addr_bytes = mac_addr_t::from_string(mb_eeprom["mac-addr"]).to_bytes(); unsigned serial = mac_addr_bytes.at(5) | (unsigned(mac_addr_bytes.at(4) & 0x0f) << 8); - mb_eeprom["serial"] = boost::lexical_cast<std::string>(serial); + mb_eeprom["serial"] = std::to_string(serial); } } @@ -417,7 +417,7 @@ static void load_b000(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ ); master_clock_rate = ntohl(master_clock_rate); if (master_clock_rate > 1e6 and master_clock_rate < 1e9){ - mb_eeprom["mcr"] = boost::lexical_cast<std::string>(master_clock_rate); + mb_eeprom["mcr"] = std::to_string(master_clock_rate); } else mb_eeprom["mcr"] = ""; } @@ -437,7 +437,7 @@ static void store_b000(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ //store the master clock rate as a 32-bit uint in Hz if (mb_eeprom.has_key("mcr")){ - uint32_t master_clock_rate = uint32_t(boost::lexical_cast<double>(mb_eeprom["mcr"])); + uint32_t master_clock_rate = uint32_t(std::stod(mb_eeprom["mcr"])); master_clock_rate = htonl(master_clock_rate); const byte_vector_t rate_bytes( reinterpret_cast<const uint8_t *>(&master_clock_rate), @@ -606,10 +606,10 @@ static void load_e100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ byte_vector_t map_bytes = iface.read_eeprom(E100_EEPROM_ADDR, 0, num_bytes); e100_eeprom_map map; std::memcpy(&map, &map_bytes[0], map_bytes.size()); - mb_eeprom["vendor"] = boost::lexical_cast<std::string>(uhd::ntohx(map.vendor)); - mb_eeprom["device"] = boost::lexical_cast<std::string>(uhd::ntohx(map.device)); - mb_eeprom["revision"] = boost::lexical_cast<std::string>(unsigned(map.revision)); - mb_eeprom["content"] = boost::lexical_cast<std::string>(unsigned(map.content)); + mb_eeprom["vendor"] = std::to_string(uhd::ntohx(map.vendor)); + mb_eeprom["device"] = std::to_string(uhd::ntohx(map.device)); + mb_eeprom["revision"] = std::to_string(unsigned(map.revision)); + mb_eeprom["content"] = std::to_string(unsigned(map.content)); #define load_e100_string_xx(key) mb_eeprom[#key] = bytes_to_string(iface.read_eeprom( \ E100_EEPROM_ADDR, offsetof(e100_eeprom_map, key), sizeof_member(e100_eeprom_map, key) \ diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 0910ad59d..3dcfe3bd9 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1763,7 +1763,7 @@ private: { try { - const std::string tree_path = "/mboards/" + boost::lexical_cast<std::string>(mboard); + const std::string tree_path = "/mboards/" + std::to_string(mboard); if (_tree->exists(tree_path)) { return tree_path; } else { @@ -1791,7 +1791,7 @@ private: try { - const std::string tree_path = mb_root(mcp.mboard) / "rx_dsps" / boost::lexical_cast<std::string>(mcp.chan); + const std::string tree_path = mb_root(mcp.mboard) / "rx_dsps" / mcp.chan; if (_tree->exists(tree_path)) { return tree_path; } else { @@ -1818,7 +1818,7 @@ private: } try { - const std::string tree_path = mb_root(mcp.mboard) / "tx_dsps" / boost::lexical_cast<std::string>(mcp.chan); + const std::string tree_path = mb_root(mcp.mboard) / "tx_dsps" / mcp.chan; if (_tree->exists(tree_path)) { return tree_path; } else { diff --git a/host/lib/usrp/n230/n230_eeprom_manager.cpp b/host/lib/usrp/n230/n230_eeprom_manager.cpp index c21eb9ddb..4a996ef61 100644 --- a/host/lib/usrp/n230/n230_eeprom_manager.cpp +++ b/host/lib/usrp/n230/n230_eeprom_manager.cpp @@ -68,9 +68,9 @@ const mboard_eeprom_t& n230_eeprom_manager::read_mb_eeprom() uint16_t ver_major = uhd::htonx<uint16_t>(map.data_version_major); uint16_t ver_minor = uhd::htonx<uint16_t>(map.data_version_minor); - _mb_eeprom["product"] = boost::lexical_cast<std::string>( + _mb_eeprom["product"] = std::to_string( uhd::htonx<uint16_t>(map.hw_product)); - _mb_eeprom["revision"] = boost::lexical_cast<std::string>( + _mb_eeprom["revision"] = std::to_string( uhd::htonx<uint16_t>(map.hw_revision)); //The revision_compat field does not exist in version 1.0 //EEPROM version 1.0 will only exist on HW revision 1 so it is safe to set @@ -78,7 +78,7 @@ const mboard_eeprom_t& n230_eeprom_manager::read_mb_eeprom() if (ver_major == 1 and ver_minor == 0) { _mb_eeprom["revision_compat"] = _mb_eeprom["revision"]; } else { - _mb_eeprom["revision_compat"] = boost::lexical_cast<std::string>( + _mb_eeprom["revision_compat"] = std::to_string( uhd::htonx<uint16_t>(map.hw_revision_compat)); } _mb_eeprom["serial"] = _bytes_to_string( diff --git a/host/lib/usrp/n230/n230_resource_manager.cpp b/host/lib/usrp/n230/n230_resource_manager.cpp index 61a80ae43..d454afd40 100644 --- a/host/lib/usrp/n230/n230_resource_manager.cpp +++ b/host/lib/usrp/n230/n230_resource_manager.cpp @@ -26,9 +26,7 @@ #include <uhd/utils/paths.hpp> #include <boost/format.hpp> #include <boost/thread.hpp> -#include <boost/lexical_cast.hpp> #include <boost/functional/hash.hpp> -#include <boost/lexical_cast.hpp> #include <boost/make_shared.hpp> #include "n230_fw_defs.h" #include "n230_fw_host_iface.h" @@ -419,7 +417,7 @@ transport::zero_copy_if::sptr n230_resource_manager::_create_transport( default_buff_args.num_send_frames = 32; transport::zero_copy_if::sptr xport = transport::udp_zero_copy::make( - eth_conn.ip_addr, boost::lexical_cast<std::string>(fpga::CVITA_UDP_PORT), + eth_conn.ip_addr, std::to_string(fpga::CVITA_UDP_PORT), default_buff_args, buff_params_out, buff_params); if (xport.get()) { diff --git a/host/lib/usrp/n230/n230_stream_manager.cpp b/host/lib/usrp/n230/n230_stream_manager.cpp index 95da2752e..0d5aa693f 100644 --- a/host/lib/usrp/n230/n230_stream_manager.cpp +++ b/host/lib/usrp/n230/n230_stream_manager.cpp @@ -80,13 +80,13 @@ rx_streamer::sptr n230_stream_manager::get_rx_stream(const uhd::stream_args_t &a //TODO: Propagate the device_args class into streamer in the future device_addr_t device_addr = args.args; if (not device_addr.has_key("recv_buff_size")) { - device_addr["recv_buff_size"] = boost::lexical_cast<std::string>(_dev_args.get_recv_buff_size()); + device_addr["recv_buff_size"] = std::to_string(_dev_args.get_recv_buff_size()); } if (not device_addr.has_key("recv_frame_size")) { - device_addr["recv_frame_size"] = boost::lexical_cast<std::string>(_dev_args.get_recv_frame_size()); + device_addr["recv_frame_size"] = std::to_string(_dev_args.get_recv_frame_size()); } if (not device_addr.has_key("num_recv_frames")) { - device_addr["num_recv_frames"] = boost::lexical_cast<std::string>(_dev_args.get_num_recv_frames()); + device_addr["num_recv_frames"] = std::to_string(_dev_args.get_num_recv_frames()); } transport::udp_zero_copy::buff_params buff_params_out; @@ -170,7 +170,7 @@ rx_streamer::sptr n230_stream_manager::get_rx_stream(const uhd::stream_args_t &a if (prop_tree) { //TODO: Update this to support multiple motherboards const fs_path mb_path = "/mboards/0"; - prop_tree->access<double>(mb_path / "rx_dsps" / boost::lexical_cast<std::string>(chan) / "rate" / "value").update(); + prop_tree->access<double>(mb_path / "rx_dsps" / std::to_string(chan) / "rate" / "value").update(); } } update_stream_states(); @@ -207,13 +207,13 @@ tx_streamer::sptr n230_stream_manager::get_tx_stream(const uhd::stream_args_t &a //TODO: Propagate the device_args class into streamer in the future device_addr_t device_addr = args.args; if (not device_addr.has_key("send_buff_size")) { - device_addr["send_buff_size"] = boost::lexical_cast<std::string>(_dev_args.get_send_buff_size()); + device_addr["send_buff_size"] = std::to_string(_dev_args.get_send_buff_size()); } if (not device_addr.has_key("send_frame_size")) { - device_addr["send_frame_size"] = boost::lexical_cast<std::string>(_dev_args.get_send_frame_size()); + device_addr["send_frame_size"] = std::to_string(_dev_args.get_send_frame_size()); } if (not device_addr.has_key("num_send_frames")) { - device_addr["num_send_frames"] = boost::lexical_cast<std::string>(_dev_args.get_num_send_frames()); + device_addr["num_send_frames"] = std::to_string(_dev_args.get_num_send_frames()); } transport::udp_zero_copy::buff_params buff_params_out; @@ -295,7 +295,7 @@ tx_streamer::sptr n230_stream_manager::get_tx_stream(const uhd::stream_args_t &a if (prop_tree) { //TODO: Update this to support multiple motherboards const fs_path mb_path = "/mboards/0"; - prop_tree->access<double>(mb_path / "tx_dsps" / boost::lexical_cast<std::string>(chan) / "rate" / "value").update(); + prop_tree->access<double>(mb_path / "tx_dsps" / std::to_string(chan) / "rate" / "value").update(); } } update_stream_states(); diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 7c479a447..92b7f5331 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -229,7 +229,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ _master_clock_rate = 64e6; if (device_addr.has_key("mcr")){ try{ - _master_clock_rate = boost::lexical_cast<double>(device_addr["mcr"]); + _master_clock_rate = std::stod(device_addr["mcr"]); } catch(const std::exception &e){ UHD_LOGGER_ERROR("USRP1") << "Error parsing FPGA clock rate from device address: " << e.what() ; @@ -237,7 +237,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ } else if (not mb_eeprom["mcr"].empty()){ try{ - _master_clock_rate = boost::lexical_cast<double>(mb_eeprom["mcr"]); + _master_clock_rate = std::stod(mb_eeprom["mcr"]); } catch(const std::exception &e){ UHD_LOGGER_ERROR("USRP1") << "Error parsing FPGA clock rate from EEPROM: " << e.what() ; diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp index c05453c40..4a15c641a 100644 --- a/host/lib/usrp/usrp2/clock_ctrl.cpp +++ b/host/lib/usrp/usrp2/clock_ctrl.cpp @@ -22,7 +22,6 @@ #include <uhd/utils/safe_call.hpp> #include <uhd/utils/assert_has.hpp> #include <stdint.h> -#include <boost/lexical_cast.hpp> #include <boost/math/special_functions/round.hpp> #include <iostream> diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 9ee13d289..573314339 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -29,7 +29,6 @@ #include <uhd/utils/byteswap.hpp> #include <uhd/utils/safe_call.hpp> #include <boost/format.hpp> -#include <boost/lexical_cast.hpp> #include <boost/bind.hpp> #include <boost/assign/list_of.hpp> #include <boost/asio/ip/address_v4.hpp> @@ -334,7 +333,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : if (not device_addr.has_key("send_buff_size")){ //The buffer should be the size of the SRAM on the device, //because we will never commit more than the SRAM can hold. - device_addr["send_buff_size"] = boost::lexical_cast<std::string>(USRP2_SRAM_BYTES); + device_addr["send_buff_size"] = std::to_string(USRP2_SRAM_BYTES); } device_addrs_t device_args = separate_device_addr(device_addr); @@ -353,8 +352,8 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : mtu.send_mtu = std::min(mtu.send_mtu, mtu_i.send_mtu); } - device_addr["recv_frame_size"] = boost::lexical_cast<std::string>(mtu.recv_mtu); - device_addr["send_frame_size"] = boost::lexical_cast<std::string>(mtu.send_mtu); + device_addr["recv_frame_size"] = std::to_string(mtu.recv_mtu); + device_addr["send_frame_size"] = std::to_string(mtu.send_mtu); UHD_LOGGER_INFO("USRP2") << boost::format("Current recv frame size: %d bytes") % mtu.recv_mtu; UHD_LOGGER_INFO("USRP2") << boost::format("Current send frame size: %d bytes") % mtu.send_mtu; @@ -375,7 +374,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : for (size_t mbi = 0; mbi < device_args.size(); mbi++){ const device_addr_t device_args_i = device_args[mbi]; - const std::string mb = boost::lexical_cast<std::string>(mbi); + const std::string mb = std::to_string(mbi); const std::string addr = device_args_i["addr"]; const fs_path mb_path = "/mboards/" + mb; diff --git a/host/lib/usrp/x300/x300_fw_ctrl.cpp b/host/lib/usrp/x300/x300_fw_ctrl.cpp index 38b7eb139..b8cb2075e 100644 --- a/host/lib/usrp/x300/x300_fw_ctrl.cpp +++ b/host/lib/usrp/x300/x300_fw_ctrl.cpp @@ -28,7 +28,6 @@ #include "x300_regs.hpp" #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/thread/thread.hpp> -#include <boost/lexical_cast.hpp> using namespace uhd; using namespace uhd::niusrprio; @@ -299,7 +298,7 @@ protected: virtual std::string __loc_info(void) { - return boost::lexical_cast<std::string>(_drv_proxy->get_interface_num()); + return std::to_string(_drv_proxy->get_interface_num()); } private: diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 4601b2789..40288b54c 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -524,7 +524,7 @@ void x300_impl::mboard_members_t::discover_eth( void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) { - const fs_path mb_path = "/mboards/"+boost::lexical_cast<std::string>(mb_i); + const fs_path mb_path = fs_path("/mboards") / mb_i; mboard_members_t &mb = _mb[mb_i]; mb.initialization_done = false; @@ -533,7 +533,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) ); const std::string thread_msg( "Thread ID " + thread_id + " for motherboard " - + boost::lexical_cast<std::string>(mb_i) + + std::to_string(mb_i) ); std::vector<std::string> eth_addrs; @@ -1204,7 +1204,7 @@ uhd::both_xports_t x300_impl::make_transport( * connection type.*/ size_t eth_data_rec_frame_size = 0; - fs_path mboard_path = fs_path("/mboards/"+boost::lexical_cast<std::string>(mb_index) / "link_max_rate"); + fs_path mboard_path = fs_path("/mboards") / mb_index / "link_max_rate"; if (mb.loaded_fpga_image == "HG") { size_t max_link_rate = 0; diff --git a/host/lib/usrp/x300/x300_io_impl.cpp b/host/lib/usrp/x300/x300_io_impl.cpp index eeff4091f..35d6f74f3 100644 --- a/host/lib/usrp/x300/x300_io_impl.cpp +++ b/host/lib/usrp/x300/x300_io_impl.cpp @@ -46,10 +46,10 @@ device_addr_t x300_impl::get_rx_hints(size_t mb_index) //For nirio, the buffer size is not configurable by the user #if defined(UHD_PLATFORM_MACOS) || defined(UHD_PLATFORM_BSD) //limit buffer resize on macos or it will error - rx_hints["recv_buff_size"] = boost::lexical_cast<std::string>(X300_RX_SW_BUFF_SIZE_ETH_MACOS); + rx_hints["recv_buff_size"] = std::to_string(X300_RX_SW_BUFF_SIZE_ETH_MACOS); #elif defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32) //set to half-a-second of buffering at max rate - rx_hints["recv_buff_size"] = boost::lexical_cast<std::string>(X300_RX_SW_BUFF_SIZE_ETH); + rx_hints["recv_buff_size"] = std::to_string(X300_RX_SW_BUFF_SIZE_ETH); #endif } } diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp index 9e3f298d8..50c3059d3 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp @@ -158,7 +158,7 @@ private: misc_ins_reg_t(): uhd::soft_reg64_ro_t(regs::RB_MISC_IO) { } } misc_ins_reg; - radio_regmap_t(int radio_num) : soft_regmap_t("radio" + boost::lexical_cast<std::string>(radio_num) + "_regmap") { + radio_regmap_t(int radio_num) : soft_regmap_t("radio" + std::to_string(radio_num) + "_regmap") { add_to_map(misc_outs_reg, "misc_outs_reg", PRIVATE); add_to_map(misc_ins_reg, "misc_ins_reg", PRIVATE); } |