aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/db_xcvr2450.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-25 22:05:50 -0700
committerJosh Blum <josh@joshknows.com>2010-04-25 22:05:50 -0700
commit61ec6711bb4bbae7a8a26cc631eeb88fb3e7d688 (patch)
tree12cfaf308bcbd779dd5a1254b12a6104088629cc /host/lib/usrp/dboard/db_xcvr2450.cpp
parentd1d6c859f0dbae5f044519d589d5ad3fcbb8643e (diff)
downloaduhd-61ec6711bb4bbae7a8a26cc631eeb88fb3e7d688.tar.gz
uhd-61ec6711bb4bbae7a8a26cc631eeb88fb3e7d688.tar.bz2
uhd-61ec6711bb4bbae7a8a26cc631eeb88fb3e7d688.zip
Work on exceptions.
Added props exception macro to make the set/get prop switch statements easier. Made use of boost throw exception macro for throw-site information in throw assert.
Diffstat (limited to 'host/lib/usrp/dboard/db_xcvr2450.cpp')
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 2c2843d3a..2052511f8 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -352,7 +352,8 @@ static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(float &gain){
gain = 5;
return max2829_regs_t::TX_BASEBAND_GAIN_5DB;
}
- ASSERT_THROW(false);
+ BOOST_THROW_EXCEPTION(std::runtime_error("should not get here"));
+ return max2829_regs_t::TX_BASEBAND_GAIN_0DB;
}
/*!
@@ -474,6 +475,8 @@ void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){
case SUBDEV_PROP_USE_LO_OFFSET:
val = false;
return;
+
+ default: UHD_THROW_PROP_WRITE_ONLY();
}
}
@@ -496,9 +499,7 @@ void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){
this->set_rx_ant(val.as<std::string>());
return;
- default: throw std::runtime_error(str(boost::format(
- "Error: trying to set read-only property on %s subdev"
- ) % dboard_id::to_string(get_rx_id())));
+ default: UHD_THROW_PROP_READ_ONLY();
}
}
@@ -564,6 +565,8 @@ void xcvr2450::tx_get(const wax::obj &key_, wax::obj &val){
case SUBDEV_PROP_USE_LO_OFFSET:
val = false;
return;
+
+ default: UHD_THROW_PROP_WRITE_ONLY();
}
}
@@ -586,8 +589,6 @@ void xcvr2450::tx_set(const wax::obj &key_, const wax::obj &val){
this->set_tx_ant(val.as<std::string>());
return;
- default: throw std::runtime_error(str(boost::format(
- "Error: trying to set read-only property on %s subdev"
- ) % dboard_id::to_string(get_tx_id())));
+ default: UHD_THROW_PROP_READ_ONLY();
}
}