18 #ifndef INCLUDED_UHD_TYPES_DEVICE_ADDR_HPP
19 #define INCLUDED_UHD_TYPES_DEVICE_ADDR_HPP
23 #include <boost/lexical_cast.hpp>
59 std::string to_pp_string(
void)
const;
66 std::string to_string(
void)
const;
76 template <
typename T> T
cast(
const std::string &key,
const T &def)
const{
77 if (not this->has_key(key))
return def;
79 return boost::lexical_cast<T>((*this)[key]);
81 catch(
const boost::bad_lexical_cast &){
82 throw std::runtime_error(
"cannot cast " + key +
" = " + (*
this)[key]);