summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-15 17:43:10 -0700
committerJosh Blum <josh@joshknows.com>2010-03-15 17:43:10 -0700
commitfc40ff2f1327d01c72c4d7dbc07a14e473251981 (patch)
treead7f1ed847d284c3982157e1c43a13773a6aca9c /host/lib/usrp
parente4997af8453980922b469e5d3b66a7b26910dad3 (diff)
downloaduhd-fc40ff2f1327d01c72c4d7dbc07a14e473251981.tar.gz
uhd-fc40ff2f1327d01c72c4d7dbc07a14e473251981.tar.bz2
uhd-fc40ff2f1327d01c72c4d7dbc07a14e473251981.zip
Replaced uses of wax:cast with the templated as method (like in boost program options).
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/dboard/basic.cpp16
-rw-r--r--host/lib/usrp/usrp2/dboard_impl.cpp4
-rw-r--r--host/lib/usrp/usrp2/dsp_impl.cpp24
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp26
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp2
5 files changed, 36 insertions, 36 deletions
diff --git a/host/lib/usrp/dboard/basic.cpp b/host/lib/usrp/dboard/basic.cpp
index e719950e8..095b77ce1 100644
--- a/host/lib/usrp/dboard/basic.cpp
+++ b/host/lib/usrp/dboard/basic.cpp
@@ -98,7 +98,7 @@ void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
boost::tie(key, name) = extract_named_prop(key_);
//handle the get request conditioned on the key
- switch(wax::cast<subdev_prop_t>(key)){
+ switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_NAME:
val = std::string(str(boost::format("%s:%s")
% dboard_id::to_string(get_rx_id())
@@ -159,14 +159,14 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){
boost::tie(key, name) = extract_named_prop(key_);
//handle the get request conditioned on the key
- switch(wax::cast<subdev_prop_t>(key)){
+ switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- ASSERT_THROW(wax::cast<gain_t>(val) == gain_t(0));
+ ASSERT_THROW(val.as<gain_t>() == gain_t(0));
return;
case SUBDEV_PROP_ANTENNA:
- ASSERT_THROW(wax::cast<std::string>(val) == std::string(""));
+ ASSERT_THROW(val.as<std::string>() == std::string(""));
return;
case SUBDEV_PROP_ENABLED:
@@ -207,7 +207,7 @@ void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
boost::tie(key, name) = extract_named_prop(key_);
//handle the get request conditioned on the key
- switch(wax::cast<subdev_prop_t>(key)){
+ switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_NAME:
val = dboard_id::to_string(get_tx_id());
return;
@@ -265,14 +265,14 @@ void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){
boost::tie(key, name) = extract_named_prop(key_);
//handle the get request conditioned on the key
- switch(wax::cast<subdev_prop_t>(key)){
+ switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- ASSERT_THROW(wax::cast<gain_t>(val) == gain_t(0));
+ ASSERT_THROW(val.as<gain_t>() == gain_t(0));
return;
case SUBDEV_PROP_ANTENNA:
- ASSERT_THROW(wax::cast<std::string>(val) == std::string(""));
+ ASSERT_THROW(val.as<std::string>() == std::string(""));
return;
case SUBDEV_PROP_ENABLED:
diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp
index da05c3241..6d957436e 100644
--- a/host/lib/usrp/usrp2/dboard_impl.cpp
+++ b/host/lib/usrp/usrp2/dboard_impl.cpp
@@ -71,7 +71,7 @@ void usrp2_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
boost::tie(key, name) = extract_named_prop(key_);
//handle the get request conditioned on the key
- switch(wax::cast<dboard_prop_t>(key)){
+ switch(key.as<dboard_prop_t>()){
case DBOARD_PROP_NAME:
val = std::string("usrp2 dboard (rx unit)");
return;
@@ -101,7 +101,7 @@ void usrp2_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
boost::tie(key, name) = extract_named_prop(key_);
//handle the get request conditioned on the key
- switch(wax::cast<dboard_prop_t>(key)){
+ switch(key.as<dboard_prop_t>()){
case DBOARD_PROP_NAME:
val = std::string("usrp2 dboard (tx unit)");
return;
diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp
index cb7f58ec8..7520c1757 100644
--- a/host/lib/usrp/usrp2/dsp_impl.cpp
+++ b/host/lib/usrp/usrp2/dsp_impl.cpp
@@ -102,7 +102,7 @@ void usrp2_impl::update_ddc_enabled(void){
void usrp2_impl::ddc_get(const wax::obj &key, wax::obj &val){
//handle the case where the key is an expected dsp property
if (key.type() == typeid(dsp_prop_t)){
- switch(wax::cast<dsp_prop_t>(key)){
+ switch(key.as<dsp_prop_t>()){
case DSP_PROP_NAME:
val = std::string("usrp2 ddc0");
return;
@@ -123,7 +123,7 @@ void usrp2_impl::ddc_get(const wax::obj &key, wax::obj &val){
}
//handle string-based properties specific to this dsp
- std::string key_name = wax::cast<std::string>(key);
+ std::string key_name = key.as<std::string>();
if (key_name == "rate"){
val = get_master_clock_freq();
return;
@@ -152,9 +152,9 @@ void usrp2_impl::ddc_get(const wax::obj &key, wax::obj &val){
void usrp2_impl::ddc_set(const wax::obj &key, const wax::obj &val){
//handle string-based properties specific to this dsp
- std::string key_name = wax::cast<std::string>(key);
+ std::string key_name = key.as<std::string>();
if (key_name == "decim"){
- size_t new_decim = wax::cast<size_t>(val);
+ size_t new_decim = val.as<size_t>();
assert_has(
_allowed_decim_and_interp_rates,
new_decim, "usrp2 decimation"
@@ -164,7 +164,7 @@ void usrp2_impl::ddc_set(const wax::obj &key, const wax::obj &val){
return;
}
else if (key_name == "freq"){
- freq_t new_freq = wax::cast<freq_t>(val);
+ freq_t new_freq = val.as<freq_t>();
ASSERT_THROW(new_freq <= get_master_clock_freq()/2.0);
ASSERT_THROW(new_freq >= -get_master_clock_freq()/2.0);
_ddc_freq = new_freq; //shadow
@@ -172,13 +172,13 @@ void usrp2_impl::ddc_set(const wax::obj &key, const wax::obj &val){
return;
}
else if (key_name == "enabled"){
- bool new_enabled = wax::cast<bool>(val);
+ bool new_enabled = val.as<bool>();
_ddc_enabled = new_enabled; //shadow
update_ddc_enabled();
return;
}
else if (key_name == "stream_at"){
- time_spec_t new_stream_at = wax::cast<time_spec_t>(val);
+ time_spec_t new_stream_at = val.as<time_spec_t>();
_ddc_stream_at = new_stream_at; //shadow
//update_ddc_enabled(); //dont update from here
return;
@@ -236,7 +236,7 @@ void usrp2_impl::update_duc_config(void){
void usrp2_impl::duc_get(const wax::obj &key, wax::obj &val){
//handle the case where the key is an expected dsp property
if (key.type() == typeid(dsp_prop_t)){
- switch(wax::cast<dsp_prop_t>(key)){
+ switch(key.as<dsp_prop_t>()){
case DSP_PROP_NAME:
val = std::string("usrp2 duc0");
return;
@@ -255,7 +255,7 @@ void usrp2_impl::duc_get(const wax::obj &key, wax::obj &val){
}
//handle string-based properties specific to this dsp
- std::string key_name = wax::cast<std::string>(key);
+ std::string key_name = key.as<std::string>();
if (key_name == "rate"){
val = get_master_clock_freq();
return;
@@ -280,9 +280,9 @@ void usrp2_impl::duc_get(const wax::obj &key, wax::obj &val){
void usrp2_impl::duc_set(const wax::obj &key, const wax::obj &val){
//handle string-based properties specific to this dsp
- std::string key_name = wax::cast<std::string>(key);
+ std::string key_name = key.as<std::string>();
if (key_name == "interp"){
- size_t new_interp = wax::cast<size_t>(val);
+ size_t new_interp = val.as<size_t>();
assert_has(
_allowed_decim_and_interp_rates,
new_interp, "usrp2 interpolation"
@@ -292,7 +292,7 @@ void usrp2_impl::duc_set(const wax::obj &key, const wax::obj &val){
return;
}
else if (key_name == "freq"){
- freq_t new_freq = wax::cast<freq_t>(val);
+ freq_t new_freq = val.as<freq_t>();
ASSERT_THROW(new_freq <= get_master_clock_freq()/2.0);
ASSERT_THROW(new_freq >= -get_master_clock_freq()/2.0);
_duc_freq = new_freq; //shadow
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index b66de8262..4b15c7f3e 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -91,7 +91,7 @@ void usrp2_impl::mboard_get(const wax::obj &key_, wax::obj &val){
//handle the other props
if (key.type() == typeid(std::string)){
- if (wax::cast<std::string>(key) == "mac-addr"){
+ if (key.as<std::string>() == "mac-addr"){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_GIVE_ME_YOUR_MAC_ADDR_BRO);
@@ -105,7 +105,7 @@ void usrp2_impl::mboard_get(const wax::obj &key_, wax::obj &val){
return;
}
- if (wax::cast<std::string>(key) == "ip-addr"){
+ if (key.as<std::string>() == "ip-addr"){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_GIVE_ME_YOUR_IP_ADDR_BRO);
@@ -121,7 +121,7 @@ void usrp2_impl::mboard_get(const wax::obj &key_, wax::obj &val){
}
//handle the get request conditioned on the key
- switch(wax::cast<mboard_prop_t>(key)){
+ switch(key.as<mboard_prop_t>()){
case MBOARD_PROP_NAME:
val = std::string("usrp2 mboard");
return;
@@ -208,11 +208,11 @@ void usrp2_impl::mboard_get(const wax::obj &key_, wax::obj &val){
void usrp2_impl::mboard_set(const wax::obj &key, const wax::obj &val){
//handle the other props
if (key.type() == typeid(std::string)){
- if (wax::cast<std::string>(key) == "mac-addr"){
+ if (key.as<std::string>() == "mac-addr"){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_HERE_IS_A_NEW_MAC_ADDR_BRO);
- mac_addr_t mac_addr(wax::cast<std::string>(val));
+ mac_addr_t mac_addr(val.as<std::string>());
std::memcpy(out_data.data.mac_addr, &mac_addr, sizeof(mac_addr_t));
//send and recv
@@ -221,11 +221,11 @@ void usrp2_impl::mboard_set(const wax::obj &key, const wax::obj &val){
return;
}
- if (wax::cast<std::string>(key) == "ip-addr"){
+ if (key.as<std::string>() == "ip-addr"){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_HERE_IS_A_NEW_IP_ADDR_BRO);
- out_data.data.ip_addr = htonl(boost::asio::ip::address_v4::from_string(wax::cast<std::string>(val)).to_ulong());
+ out_data.data.ip_addr = htonl(boost::asio::ip::address_v4::from_string(val.as<std::string>()).to_ulong());
//send and recv
usrp2_ctrl_data_t in_data = ctrl_send_and_recv(out_data);
@@ -235,10 +235,10 @@ void usrp2_impl::mboard_set(const wax::obj &key, const wax::obj &val){
}
//handle the get request conditioned on the key
- switch(wax::cast<mboard_prop_t>(key)){
+ switch(key.as<mboard_prop_t>()){
case MBOARD_PROP_PPS_SOURCE:{
- std::string name = wax::cast<std::string>(val);
+ std::string name = val.as<std::string>();
assert_has(_pps_source_dict.get_keys(), name, "usrp2 pps source");
_pps_source = name; //shadow
update_clock_config();
@@ -246,7 +246,7 @@ void usrp2_impl::mboard_set(const wax::obj &key, const wax::obj &val){
return;
case MBOARD_PROP_PPS_POLARITY:{
- std::string name = wax::cast<std::string>(val);
+ std::string name = val.as<std::string>();
assert_has(_pps_polarity_dict.get_keys(), name, "usrp2 pps polarity");
_pps_polarity = name; //shadow
update_clock_config();
@@ -254,7 +254,7 @@ void usrp2_impl::mboard_set(const wax::obj &key, const wax::obj &val){
return;
case MBOARD_PROP_REF_SOURCE:{
- std::string name = wax::cast<std::string>(val);
+ std::string name = val.as<std::string>();
assert_has(_ref_source_dict.get_keys(), name, "usrp2 reference source");
_ref_source = name; //shadow
update_clock_config();
@@ -262,12 +262,12 @@ void usrp2_impl::mboard_set(const wax::obj &key, const wax::obj &val){
return;
case MBOARD_PROP_TIME_NOW:{
- set_time_spec(wax::cast<time_spec_t>(val), true);
+ set_time_spec(val.as<time_spec_t>(), true);
return;
}
case MBOARD_PROP_TIME_NEXT_PPS:{
- set_time_spec(wax::cast<time_spec_t>(val), false);
+ set_time_spec(val.as<time_spec_t>(), false);
return;
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 850a738d4..22b7e109f 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -184,7 +184,7 @@ void usrp2_impl::get(const wax::obj &key_, wax::obj &val){
boost::tie(key, name) = extract_named_prop(key_);
//handle the get request conditioned on the key
- switch(wax::cast<device_prop_t>(key)){
+ switch(key.as<device_prop_t>()){
case DEVICE_PROP_NAME:
val = std::string("usrp2 device");
return;