aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-10-17 16:01:22 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:32 -0800
commit72b45bb8def087f2eff09ed671de788978853e2a (patch)
tree87fc86059b61e5dc43ba19332056075bef845f6d
parentd3a16b702230534f7265613a73204bdb051a458e (diff)
downloaduhd-72b45bb8def087f2eff09ed671de788978853e2a.tar.gz
uhd-72b45bb8def087f2eff09ed671de788978853e2a.tar.bz2
uhd-72b45bb8def087f2eff09ed671de788978853e2a.zip
uhd: Remove all usages of boost::tuple and friends
This replaces all of the following with standard C++ features: - boost::tuple - boost::make_tuple - boost::tuple::get - #include <boost/tuple/tuple.hpp> All usages were replaced with search-and-replace scripts (the usages of get could be automatically replaced with a vim macro, the rest was straightforward search-and-replace).
-rw-r--r--host/lib/device.cpp18
-rw-r--r--host/lib/usrp/b100/codec_ctrl.cpp6
-rw-r--r--host/lib/usrp/cores/rx_dsp_core_200.cpp5
-rw-r--r--host/lib/usrp/cores/rx_vita_core_3000.cpp6
-rw-r--r--host/lib/usrp/dboard/db_unknown.cpp6
-rw-r--r--host/lib/usrp/dboard_manager.cpp18
-rw-r--r--host/lib/usrp/gps_ctrl.cpp16
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.cpp6
8 files changed, 40 insertions, 41 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp
index c17713bbd..1749f4a60 100644
--- a/host/lib/device.cpp
+++ b/host/lib/device.cpp
@@ -16,11 +16,11 @@
#include <boost/format.hpp>
#include <boost/functional/hash.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/thread/mutex.hpp>
#include <future>
#include <memory>
+#include <tuple>
using namespace uhd;
@@ -70,7 +70,7 @@ static size_t hash_device_addr(
/***********************************************************************
* Registration
**********************************************************************/
-typedef boost::tuple<device::find_t, device::make_t, device::device_filter_t> dev_fcn_reg_t;
+typedef std::tuple<device::find_t, device::make_t, device::device_filter_t> dev_fcn_reg_t;
// instantiate the device function registry container
UHD_SINGLETON_FCN(std::vector<dev_fcn_reg_t>, get_dev_fcn_regs)
@@ -97,10 +97,10 @@ device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){
device_addrs_t device_addrs;
std::vector<std::future<device_addrs_t>> find_tasks;
for (const auto& fcn : get_dev_fcn_regs()) {
- if (filter == ANY or fcn.get<2>() == filter) {
+ if (filter == ANY or std::get<2>(fcn) == filter) {
find_tasks.emplace_back(std::async(std::launch::async,
[fcn, hint](){
- return fcn.get<0>()(hint);
+ return std::get<0>(fcn)(hint);
}
));
}
@@ -128,15 +128,15 @@ device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){
device::sptr device::make(const device_addr_t &hint, device_filter_t filter, size_t which){
boost::mutex::scoped_lock lock(_device_mutex);
- typedef boost::tuple<device_addr_t, make_t> dev_addr_make_t;
+ typedef std::tuple<device_addr_t, make_t> dev_addr_make_t;
std::vector<dev_addr_make_t> dev_addr_makers;
for(const dev_fcn_reg_t &fcn: get_dev_fcn_regs()){
try{
- if(filter == ANY or fcn.get<2>() == filter){
- for(device_addr_t dev_addr: fcn.get<0>()(hint)){
+ if(filter == ANY or std::get<2>(fcn) == filter){
+ for(device_addr_t dev_addr: std::get<0>(fcn)(hint)){
//append the discovered address and its factory function
- dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>()));
+ dev_addr_makers.push_back(dev_addr_make_t(dev_addr, std::get<1>(fcn)));
}
}
}
@@ -161,7 +161,7 @@ device::sptr device::make(const device_addr_t &hint, device_filter_t filter, siz
//create a unique hash for the device address
device_addr_t dev_addr; make_t maker;
- boost::tie(dev_addr, maker) = dev_addr_makers.at(which);
+ std::tie(dev_addr, maker) = dev_addr_makers.at(which);
size_t dev_hash = hash_device_addr(dev_addr);
UHD_LOGGER_TRACE("UHD") << boost::format("Device hash: %u") % dev_hash ;
diff --git a/host/lib/usrp/b100/codec_ctrl.cpp b/host/lib/usrp/b100/codec_ctrl.cpp
index 1dac58916..10cfa686a 100644
--- a/host/lib/usrp/b100/codec_ctrl.cpp
+++ b/host/lib/usrp/b100/codec_ctrl.cpp
@@ -13,10 +13,10 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/safe_call.hpp>
#include <stdint.h>
-#include <boost/tuple/tuple.hpp>
#include <boost/math/special_functions/round.hpp>
#include "b100_regs.hpp" //spi slave constants
#include <boost/assign/list_of.hpp>
+#include <tuple>
using namespace uhd;
@@ -229,7 +229,7 @@ void b100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts){
uint8_t dac_word = uhd::clip(boost::math::iround(volts*0xff/3.3), 0, 0xff);
//setup a lookup table for the aux dac params (reg ref, reg addr)
- typedef boost::tuple<uint8_t*, uint8_t> dac_params_t;
+ typedef std::tuple<uint8_t*, uint8_t> dac_params_t;
uhd::dict<aux_dac_t, dac_params_t> aux_dac_to_params = boost::assign::map_list_of
(AUX_DAC_A, dac_params_t(&_ad9862_regs.aux_dac_a, 36))
(AUX_DAC_B, dac_params_t(&_ad9862_regs.aux_dac_b, 37))
@@ -239,7 +239,7 @@ void b100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts){
//set the aux dac register
UHD_ASSERT_THROW(aux_dac_to_params.has_key(which));
uint8_t *reg_ref, reg_addr;
- boost::tie(reg_ref, reg_addr) = aux_dac_to_params[which];
+ std::tie(reg_ref, reg_addr) = aux_dac_to_params[which];
*reg_ref = dac_word;
this->send_reg(reg_addr);
}
diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp
index a87b92a50..700a3c207 100644
--- a/host/lib/usrp/cores/rx_dsp_core_200.cpp
+++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp
@@ -19,6 +19,7 @@
#include <cmath>
#include <chrono>
#include <thread>
+#include <tuple>
#define REG_DSP_RX_FREQ _dsp_base + 0
#define REG_DSP_RX_SCALE_IQ _dsp_base + 4
@@ -105,7 +106,7 @@ public:
_continuous_streaming = stream_cmd.stream_mode == stream_cmd_t::STREAM_MODE_START_CONTINUOUS;
//setup the mode to instruction flags
- typedef boost::tuple<bool, bool, bool, bool> inst_t;
+ typedef std::tuple<bool, bool, bool, bool> inst_t;
static const uhd::dict<stream_cmd_t::stream_mode_t, inst_t> mode_to_inst = boost::assign::map_list_of
//reload, chain, samps, stop
(stream_cmd_t::STREAM_MODE_START_CONTINUOUS, inst_t(true, true, false, false))
@@ -116,7 +117,7 @@ public:
//setup the instruction flag values
bool inst_reload, inst_chain, inst_samps, inst_stop;
- boost::tie(inst_reload, inst_chain, inst_samps, inst_stop) = mode_to_inst[stream_cmd.stream_mode];
+ std::tie(inst_reload, inst_chain, inst_samps, inst_stop) = mode_to_inst[stream_cmd.stream_mode];
//calculate the word from flags and length
uint32_t cmd_word = 0;
diff --git a/host/lib/usrp/cores/rx_vita_core_3000.cpp b/host/lib/usrp/cores/rx_vita_core_3000.cpp
index 764fc1334..166e0d83f 100644
--- a/host/lib/usrp/cores/rx_vita_core_3000.cpp
+++ b/host/lib/usrp/cores/rx_vita_core_3000.cpp
@@ -9,10 +9,10 @@
#include <uhd/utils/safe_call.hpp>
#include <uhdlib/usrp/cores/rx_vita_core_3000.hpp>
#include <boost/assign/list_of.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/date_time.hpp>
#include <thread>
#include <chrono>
+#include <tuple>
#define REG_FRAMER_MAXLEN _base + 4*4 + 0
#define REG_FRAMER_SID _base + 4*4 + 4
@@ -94,7 +94,7 @@ struct rx_vita_core_3000_impl : rx_vita_core_3000
_continuous_streaming = stream_cmd.stream_mode == stream_cmd_t::STREAM_MODE_START_CONTINUOUS;
//setup the mode to instruction flags
- typedef boost::tuple<bool, bool, bool, bool> inst_t;
+ typedef std::tuple<bool, bool, bool, bool> inst_t;
static const uhd::dict<stream_cmd_t::stream_mode_t, inst_t> mode_to_inst = boost::assign::map_list_of
//reload, chain, samps, stop
(stream_cmd_t::STREAM_MODE_START_CONTINUOUS, inst_t(true, true, false, false))
@@ -105,7 +105,7 @@ struct rx_vita_core_3000_impl : rx_vita_core_3000
//setup the instruction flag values
bool inst_reload, inst_chain, inst_samps, inst_stop;
- boost::tie(inst_reload, inst_chain, inst_samps, inst_stop) = mode_to_inst[stream_cmd.stream_mode];
+ std::tie(inst_reload, inst_chain, inst_samps, inst_stop) = mode_to_inst[stream_cmd.stream_mode];
//calculate the word from flags and length
uint32_t cmd_word = 0;
diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp
index cfa4e31fe..2640ad607 100644
--- a/host/lib/usrp/dboard/db_unknown.cpp
+++ b/host/lib/usrp/dboard/db_unknown.cpp
@@ -13,8 +13,8 @@
#include <uhd/usrp/dboard_manager.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/format.hpp>
-#include <boost/tuple/tuple.hpp>
#include <vector>
+#include <tuple>
using namespace uhd;
using namespace uhd::usrp;
@@ -24,7 +24,7 @@ using namespace boost::assign;
* Utility functions
**********************************************************************/
static void warn_if_old_rfx(const dboard_id_t &dboard_id, const std::string &xx){
- typedef boost::tuple<std::string, dboard_id_t, dboard_id_t> old_ids_t; //name, rx_id, tx_id
+ typedef std::tuple<std::string, dboard_id_t, dboard_id_t> old_ids_t; //name, rx_id, tx_id
static const std::vector<old_ids_t> old_rfx_ids = list_of
(old_ids_t("Flex 400 Classic", 0x0004, 0x0008))
(old_ids_t("Flex 900 Classic", 0x0005, 0x0009))
@@ -34,7 +34,7 @@ static void warn_if_old_rfx(const dboard_id_t &dboard_id, const std::string &xx)
;
for(const old_ids_t &old_id: old_rfx_ids){
std::string name; dboard_id_t rx_id, tx_id;
- boost::tie(name, rx_id, tx_id) = old_id;
+ std::tie(name, rx_id, tx_id) = old_id;
if (
(xx == "RX" and rx_id == dboard_id) or
(xx == "TX" and tx_id == dboard_id)
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index ca3612ad5..a4acf2aaf 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -12,10 +12,9 @@
#include <uhd/utils/static.hpp>
#include <uhd/exception.hpp>
#include <uhd/types/dict.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/format.hpp>
#include <functional>
-#include <boost/assign/list_of.hpp>
+#include <tuple>
using namespace uhd;
using namespace uhd::usrp;
@@ -72,7 +71,7 @@ bool operator==(const dboard_key_t &lhs, const dboard_key_t &rhs){
* storage and registering for dboards
**********************************************************************/
//dboard registry tuple: dboard constructor, canonical name, subdev names, container constructor
-typedef boost::tuple<dboard_manager::dboard_ctor_t, std::string, std::vector<std::string>, dboard_manager::dboard_ctor_t> args_t;
+typedef std::tuple<dboard_manager::dboard_ctor_t, std::string, std::vector<std::string>, dboard_manager::dboard_ctor_t> args_t;
//map a dboard id to a dboard constructor
typedef uhd::dict<dboard_key_t, args_t> id_to_args_map_t;
@@ -90,12 +89,11 @@ static void register_dboard_key(
if (dboard_key.is_xcvr()) throw uhd::key_error(str(boost::format(
"The dboard id pair [%s, %s] is already registered to %s."
- ) % dboard_key.rx_id().to_string() % dboard_key.tx_id().to_string() % get_id_to_args_map()[dboard_key].get<1>()));
+ ) % dboard_key.rx_id().to_string() % dboard_key.tx_id().to_string() % std::get<1>(get_id_to_args_map()[dboard_key])));
else throw uhd::key_error(str(boost::format(
"The dboard id %s is already registered to %s."
- ) % dboard_key.xx_id().to_string() % get_id_to_args_map()[dboard_key].get<1>()));
-
+ ) % dboard_key.xx_id().to_string() % std::get<1>(get_id_to_args_map()[dboard_key])));
}
get_id_to_args_map()[dboard_key] = args_t(db_subdev_ctor, name, subdev_names, db_container_ctor);
}
@@ -150,7 +148,7 @@ std::string dboard_id_t::to_cname(void) const{
(key.is_xcvr() and (*this == key.rx_id() or *this == key.tx_id()))
){
if (not cname.empty()) cname += ", ";
- cname += get_id_to_args_map()[key].get<1>();
+ cname += std::get<1>(get_id_to_args_map()[key]);
}
}
return (cname.empty())? "Unknown" : cname;
@@ -319,7 +317,7 @@ void dboard_manager_impl::init(
//extract data for the xcvr dboard key
dboard_ctor_t subdev_ctor; std::string name; std::vector<std::string> subdevs; dboard_ctor_t container_ctor;
- boost::tie(subdev_ctor, name, subdevs, container_ctor) = get_id_to_args_map()[xcvr_dboard_key];
+ std::tie(subdev_ctor, name, subdevs, container_ctor) = get_id_to_args_map()[xcvr_dboard_key];
//create the container class.
//a container class exists per N subdevs registered in a register_dboard* call
@@ -371,7 +369,7 @@ void dboard_manager_impl::init(
//extract data for the rx dboard key
dboard_ctor_t rx_dboard_ctor; std::string rx_name; std::vector<std::string> rx_subdevs; dboard_ctor_t rx_cont_ctor;
- boost::tie(rx_dboard_ctor, rx_name, rx_subdevs, rx_cont_ctor) = get_id_to_args_map()[rx_dboard_key];
+ std::tie(rx_dboard_ctor, rx_name, rx_subdevs, rx_cont_ctor) = get_id_to_args_map()[rx_dboard_key];
//create the container class.
//a container class exists per N subdevs registered in a register_dboard* call
@@ -410,7 +408,7 @@ void dboard_manager_impl::init(
//extract data for the tx dboard key
dboard_ctor_t tx_dboard_ctor; std::string tx_name; std::vector<std::string> tx_subdevs; dboard_ctor_t tx_cont_ctor;
- boost::tie(tx_dboard_ctor, tx_name, tx_subdevs, tx_cont_ctor) = get_id_to_args_map()[tx_dboard_key];
+ std::tie(tx_dboard_ctor, tx_name, tx_subdevs, tx_cont_ctor) = get_id_to_args_map()[tx_dboard_key];
//create the container class.
//a container class exists per N subdevs registered in a register_dboard* call
diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp
index f9e03b16a..07d7f4ec4 100644
--- a/host/lib/usrp/gps_ctrl.cpp
+++ b/host/lib/usrp/gps_ctrl.cpp
@@ -17,9 +17,9 @@
#include <regex>
#include <boost/thread/mutex.hpp>
#include <boost/date_time.hpp>
-#include <boost/tuple/tuple.hpp>
#include <ctime>
#include <string>
+#include <tuple>
#include <thread>
#include <chrono>
#include <stdint.h>
@@ -47,7 +47,7 @@ gps_ctrl::~gps_ctrl(void){
class gps_ctrl_impl : public gps_ctrl{
private:
- std::map<std::string, boost::tuple<std::string, boost::system_time, bool> > sentences;
+ std::map<std::string, std::tuple<std::string, boost::system_time, bool>> sentences;
boost::mutex cache_mutex;
boost::system_time _last_cache_update;
@@ -64,7 +64,7 @@ private:
update_cache();
//mark sentence as touched
if (sentences.find(which) != sentences.end())
- sentences[which].get<2>() = true;
+ std::get<2>(sentences[which]) = true;
}
while (1)
{
@@ -82,12 +82,12 @@ private:
{
age = milliseconds(max_age_ms);
} else {
- age = boost::get_system_time() - sentences[which].get<1>();
+ age = boost::get_system_time() - std::get<1>(sentences[which]);
}
- if (age < milliseconds(max_age_ms) and (not (wait_for_next and sentences[which].get<2>())))
+ if (age < milliseconds(max_age_ms) and (not (wait_for_next and std::get<2>(sentences[which]))))
{
- sentence = sentences[which].get<0>();
- sentences[which].get<2>() = true;
+ sentence = std::get<0>(sentences[which]);
+ std::get<2>(sentences[which]) = true;
}
} catch(std::exception &e) {
UHD_LOGGER_DEBUG("GPS") << "get_sentence: " << e.what();
@@ -183,7 +183,7 @@ private:
{
if (not msgs[key].empty())
{
- sentences[key] = boost::make_tuple(msgs[key], time, false);
+ sentences[key] = std::make_tuple(msgs[key], time, false);
}
}
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp
index bcb3a28d9..a06ded707 100644
--- a/host/lib/usrp/usrp1/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp1/codec_ctrl.cpp
@@ -15,11 +15,11 @@
#include <uhd/utils/byteswap.hpp>
#include <stdint.h>
#include <boost/format.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/assign/list_of.hpp>
#include <iomanip>
+#include <tuple>
using namespace uhd;
@@ -245,7 +245,7 @@ void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts)
uint8_t dac_word = uhd::clip(boost::math::iround(volts*0xff/3.3), 0, 0xff);
//setup a lookup table for the aux dac params (reg ref, reg addr)
- typedef boost::tuple<uint8_t*, uint8_t> dac_params_t;
+ typedef std::tuple<uint8_t*, uint8_t> dac_params_t;
uhd::dict<aux_dac_t, dac_params_t> aux_dac_to_params = boost::assign::map_list_of
(AUX_DAC_A, dac_params_t(&_ad9862_regs.aux_dac_a, 36))
(AUX_DAC_B, dac_params_t(&_ad9862_regs.aux_dac_b, 37))
@@ -255,7 +255,7 @@ void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts)
//set the aux dac register
UHD_ASSERT_THROW(aux_dac_to_params.has_key(which));
uint8_t *reg_ref, reg_addr;
- boost::tie(reg_ref, reg_addr) = aux_dac_to_params[which];
+ std::tie(reg_ref, reg_addr) = aux_dac_to_params[which];
*reg_ref = dac_word;
this->send_reg(reg_addr);
}