aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
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
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')
-rw-r--r--host/lib/gain_handler.cpp6
-rw-r--r--host/lib/simple_device.cpp54
-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
-rw-r--r--host/lib/wax.cpp6
8 files changed, 69 insertions, 69 deletions
diff --git a/host/lib/gain_handler.cpp b/host/lib/gain_handler.cpp
index 7eb87558c..847bc0528 100644
--- a/host/lib/gain_handler.cpp
+++ b/host/lib/gain_handler.cpp
@@ -48,7 +48,7 @@ private:
gain_t get_overall_gain_val(void);
gain_range_t get_overall_gain_range(void);
template <class T> T get_named_prop(const wax::obj &prop, const std::string &name){
- return wax::cast<T>(_link[named_prop_t(prop, name)]);
+ return _link[named_prop_t(prop, name)].as<T>();
}
};
@@ -85,7 +85,7 @@ gain_handler_impl::~gain_handler_impl(void){
}
prop_names_t gain_handler_impl::get_gain_names(void){
- return wax::cast<prop_names_t>(_link[_props.names]);
+ return _link[_props.names].as<prop_names_t>();
}
gain_t gain_handler_impl::get_overall_gain_val(void){
@@ -145,7 +145,7 @@ bool gain_handler_impl::intercept_set(const wax::obj &key_, const wax::obj &val)
//not a gain value key... dont handle
if (not _is_equal(key, _props.value)) return false;
- gain_t gain_val = wax::cast<gain_t>(val);
+ gain_t gain_val = val.as<gain_t>();
//not a wildcard... dont handle (but check name and range)
if (name != ""){
diff --git a/host/lib/simple_device.cpp b/host/lib/simple_device.cpp
index ac83ffaed..62a38cb79 100644
--- a/host/lib/simple_device.cpp
+++ b/host/lib/simple_device.cpp
@@ -42,15 +42,15 @@ static tune_result_t tune(
bool is_tx
){
wax::obj subdev_freq_proxy = subdev[SUBDEV_PROP_FREQ];
- bool subdev_quadrature = wax::cast<bool>(subdev[SUBDEV_PROP_QUADRATURE]);
- bool subdev_spectrum_inverted = wax::cast<bool>(subdev[SUBDEV_PROP_SPECTRUM_INVERTED]);
+ bool subdev_quadrature = subdev[SUBDEV_PROP_QUADRATURE].as<bool>();
+ bool subdev_spectrum_inverted = subdev[SUBDEV_PROP_SPECTRUM_INVERTED].as<bool>();
wax::obj dxc_freq_proxy = dxc[std::string("freq")];
- double dxc_sample_rate = wax::cast<double>(dxc[std::string("rate")]);
+ double dxc_sample_rate = dxc[std::string("rate")].as<double>();
// Ask the d'board to tune as closely as it can to target_freq+lo_offset
double target_inter_freq = target_freq + lo_offset;
subdev_freq_proxy = target_inter_freq;
- double actual_inter_freq = wax::cast<double>(subdev_freq_proxy);
+ double actual_inter_freq = subdev_freq_proxy.as<double>();
// Calculate the DDC setting that will downconvert the baseband from the
// daughterboard to our target frequency.
@@ -77,7 +77,7 @@ static tune_result_t tune(
target_dxc_freq *= (is_tx)? -1.0 : +1.0;
dxc_freq_proxy = target_dxc_freq;
- double actual_dxc_freq = wax::cast<double>(dxc_freq_proxy);
+ double actual_dxc_freq = dxc_freq_proxy.as<double>();
//return some kind of tune result tuple/struct
tune_result_t tune_result;
@@ -117,8 +117,8 @@ device_addr_t args_to_device_addr(const std::string &args){
static std::vector<double> get_xx_rates(wax::obj decerps, wax::obj rate){
std::vector<double> rates;
- BOOST_FOREACH(size_t decerp, wax::cast<std::vector<size_t> >(decerps)){
- rates.push_back(wax::cast<double>(rate)/decerp);
+ BOOST_FOREACH(size_t decerp, decerps.as<std::vector<size_t> >()){
+ rates.push_back(rate.as<double>()/decerp);
}
return rates;
}
@@ -146,7 +146,7 @@ public:
}
std::string get_name(void){
- return wax::cast<std::string>(_mboard[MBOARD_PROP_NAME]);
+ return _mboard[MBOARD_PROP_NAME].as<std::string>();
}
/*******************************************************************
@@ -157,21 +157,21 @@ public:
}
bool get_streaming(void){
- return wax::cast<bool>(_rx_ddc[std::string("enabled")]);
+ return _rx_ddc[std::string("enabled")].as<bool>();
}
/*******************************************************************
* RX methods
******************************************************************/
void set_rx_rate(double rate){
- double samp_rate = wax::cast<double>(_rx_ddc[std::string("rate")]);
+ double samp_rate = _rx_ddc[std::string("rate")].as<double>();
assert_has(get_rx_rates(), rate, "simple device rx rate");
_rx_ddc[std::string("decim")] = size_t(samp_rate/rate);
}
double get_rx_rate(void){
- double samp_rate = wax::cast<double>(_rx_ddc[std::string("rate")]);
- size_t decim = wax::cast<size_t>(_rx_ddc[std::string("decim")]);
+ double samp_rate = _rx_ddc[std::string("rate")].as<double>();
+ size_t decim = _rx_ddc[std::string("decim")].as<size_t>();
return samp_rate/decim;
}
@@ -182,7 +182,7 @@ public:
tune_result_t set_rx_freq(double target_freq){
double lo_offset = 0.0;
//if the local oscillator will be in the passband, use an offset
- if (wax::cast<bool>(_rx_subdev[SUBDEV_PROP_LO_INTERFERES])){
+ if (_rx_subdev[SUBDEV_PROP_LO_INTERFERES].as<bool>()){
lo_offset = get_rx_rate()*2.0;
}
return tune(target_freq, lo_offset, _rx_subdev, _rx_ddc, false/* not tx */);
@@ -191,7 +191,7 @@ public:
std::vector<double> get_rx_freq_range(void){
std::vector<double> range(2);
boost::tie(range[0], range[1]) = \
- wax::cast<freq_range_t>(_rx_subdev[SUBDEV_PROP_FREQ_RANGE]);
+ _rx_subdev[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>();
return range;
}
@@ -200,13 +200,13 @@ public:
}
float get_rx_gain(void){
- return wax::cast<gain_t>(_rx_subdev[SUBDEV_PROP_GAIN]);
+ return _rx_subdev[SUBDEV_PROP_GAIN].as<gain_t>();
}
std::vector<float> get_rx_gain_range(void){
std::vector<float> range(3);
boost::tie(range[0], range[1], range[2]) = \
- wax::cast<gain_range_t>(_rx_subdev[SUBDEV_PROP_GAIN_RANGE]);
+ _rx_subdev[SUBDEV_PROP_GAIN_RANGE].as<gain_range_t>();
return range;
}
@@ -215,25 +215,25 @@ public:
}
std::string get_rx_antenna(void){
- return wax::cast<std::string>(_rx_subdev[SUBDEV_PROP_ANTENNA]);
+ return _rx_subdev[SUBDEV_PROP_ANTENNA].as<std::string>();
}
std::vector<std::string> get_rx_antennas(void){
- return wax::cast<std::vector<std::string> >(_rx_subdev[SUBDEV_PROP_ANTENNA_NAMES]);
+ return _rx_subdev[SUBDEV_PROP_ANTENNA_NAMES].as<std::vector<std::string> >();
}
/*******************************************************************
* TX methods
******************************************************************/
void set_tx_rate(double rate){
- double samp_rate = wax::cast<double>(_tx_duc[std::string("rate")]);
+ double samp_rate = _tx_duc[std::string("rate")].as<double>();
assert_has(get_tx_rates(), rate, "simple device tx rate");
_tx_duc[std::string("interp")] = size_t(samp_rate/rate);
}
double get_tx_rate(void){
- double samp_rate = wax::cast<double>(_tx_duc[std::string("rate")]);
- size_t interp = wax::cast<size_t>(_tx_duc[std::string("interp")]);
+ double samp_rate = _tx_duc[std::string("rate")].as<double>();
+ size_t interp = _tx_duc[std::string("interp")].as<size_t>();
return samp_rate/interp;
}
@@ -244,7 +244,7 @@ public:
tune_result_t set_tx_freq(double target_freq){
double lo_offset = 0.0;
//if the local oscillator will be in the passband, use an offset
- if (wax::cast<bool>(_tx_subdev[SUBDEV_PROP_LO_INTERFERES])){
+ if (_tx_subdev[SUBDEV_PROP_LO_INTERFERES].as<bool>()){
lo_offset = get_tx_rate()*2.0;
}
return tune(target_freq, lo_offset, _tx_subdev, _tx_duc, true/* is tx */);
@@ -253,7 +253,7 @@ public:
std::vector<double> get_tx_freq_range(void){
std::vector<double> range(2);
boost::tie(range[0], range[1]) = \
- wax::cast<freq_range_t>(_tx_subdev[SUBDEV_PROP_FREQ_RANGE]);
+ _tx_subdev[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>();
return range;
}
@@ -262,13 +262,13 @@ public:
}
float get_tx_gain(void){
- return wax::cast<gain_t>(_tx_subdev[SUBDEV_PROP_GAIN]);
+ return _tx_subdev[SUBDEV_PROP_GAIN].as<gain_t>();
}
std::vector<float> get_tx_gain_range(void){
std::vector<float> range(3);
boost::tie(range[0], range[1], range[2]) = \
- wax::cast<gain_range_t>(_tx_subdev[SUBDEV_PROP_GAIN_RANGE]);
+ _tx_subdev[SUBDEV_PROP_GAIN_RANGE].as<gain_range_t>();
return range;
}
@@ -277,11 +277,11 @@ public:
}
std::string get_tx_antenna(void){
- return wax::cast<std::string>(_tx_subdev[SUBDEV_PROP_ANTENNA]);
+ return _tx_subdev[SUBDEV_PROP_ANTENNA].as<std::string>();
}
std::vector<std::string> get_tx_antennas(void){
- return wax::cast<std::vector<std::string> >(_tx_subdev[SUBDEV_PROP_ANTENNA_NAMES]);
+ return _tx_subdev[SUBDEV_PROP_ANTENNA_NAMES].as<std::vector<std::string> >();
}
private:
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;
diff --git a/host/lib/wax.cpp b/host/lib/wax.cpp
index 0348d9a66..0e2e82a3a 100644
--- a/host/lib/wax.cpp
+++ b/host/lib/wax.cpp
@@ -39,7 +39,7 @@ public:
wax::obj & operator()(void) const{
//recursively resolve link args to get at original pointer
if (_obj_ptr->type() == typeid(link_args_t)){
- return wax::cast<link_args_t>(*_obj_ptr)();
+ return _obj_ptr->as<link_args_t>()();
}
return *const_cast<wax::obj *>(_obj_ptr);
}
@@ -61,7 +61,7 @@ public:
_obj_link = obj_ptr->get_link();
}
wax::obj & operator()(void) const{
- return wax::cast<link_args_t>(_obj_link)();
+ return _obj_link.as<link_args_t>()();
}
const wax::obj & key(void) const{
return _key;
@@ -94,7 +94,7 @@ wax::obj wax::obj::operator[](const obj &key){
obj val = resolve();
//check if its a special link and call
if (val.type() == typeid(link_args_t)){
- return cast<link_args_t>(val)()[key];
+ return val.as<link_args_t>()()[key];
}
//unknown obj
throw std::runtime_error("cannot use [] on non wax::obj link");