21 #ifndef INCLUDED_OSMOSDR_DEVICE_H
22 #define INCLUDED_OSMOSDR_DEVICE_H
26 #include <boost/noncopyable.hpp>
27 #include <boost/lexical_cast.hpp>
55 device_t(
const std::string &args =
"");
61 std::string to_pp_string(
void)
const;
68 std::string to_string(
void)
const;
78 template <
typename T> T
cast(
const std::string &key,
const T &def)
const
80 if (!this->count(key))
return def;
81 try {
return boost::lexical_cast<T>(this->at(key)); }
82 catch(
const boost::bad_lexical_cast &) {
83 throw std::runtime_error(
"cannot cast " + key +
" = " + this->at(key));