aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-08 13:01:49 -0700
committerJosh Blum <josh@joshknows.com>2010-07-08 13:01:49 -0700
commitda9d47011e02f2b18fccda00dbea0b9d9c0dc704 (patch)
tree1483f130c144acb8f89857401398b265c348cc8c /host/lib/usrp/usrp2
parentf6217746dce159085b9941a8fcc9f6407f7fdd5e (diff)
downloaduhd-da9d47011e02f2b18fccda00dbea0b9d9c0dc704.tar.gz
uhd-da9d47011e02f2b18fccda00dbea0b9d9c0dc704.tar.bz2
uhd-da9d47011e02f2b18fccda00dbea0b9d9c0dc704.zip
usrp2: added notes on multiple device network setup, improved warnings for buff size stuff
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 9d1ac991f..02f53bc69 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -127,14 +127,25 @@ static uhd::device_addrs_t usrp2_find(const device_addr_t &hint){
/***********************************************************************
* Make
**********************************************************************/
+template <typename out_type, typename in_type>
+out_type lexical_cast(const in_type &in){
+ try{
+ return boost::lexical_cast<out_type>(in);
+ }catch(...){
+ throw std::runtime_error(str(boost::format(
+ "failed to cast \"%s\" to type \"%s\""
+ ) % boost::lexical_cast<std::string>(in) % typeid(out_type).name()));
+ }
+}
+
static device::sptr usrp2_make(const device_addr_t &device_addr){
//extract the receive and send buffer sizes
size_t recv_buff_size = 0, send_buff_size= 0 ;
if (device_addr.has_key("recv_buff_size")){
- recv_buff_size = size_t(boost::lexical_cast<double>(device_addr["recv_buff_size"]));
+ recv_buff_size = size_t(lexical_cast<double>(device_addr["recv_buff_size"]));
}
if (device_addr.has_key("send_buff_size")){
- send_buff_size = size_t(boost::lexical_cast<double>(device_addr["send_buff_size"]));
+ send_buff_size = size_t(lexical_cast<double>(device_addr["send_buff_size"]));
}
//create a ctrl and data transport for each address