22 #ifndef INCLUDED_GR_SDR_SDR_HELPERS_H 23 #define INCLUDED_GR_SDR_SDR_HELPERS_H 25 #include <SoapySDR/Version.hpp> 26 #include <SoapySDR/Types.hpp> 28 #include <gnuradio/io_signature.h> 29 #include <boost/lexical_cast.hpp> 30 #include <boost/foreach.hpp> 37 if (SoapySDR::getABIVersion() == SOAPY_SDR_ABI_VERSION)
return;
39 ss << what <<
"() failed ABI check" << std::endl;
40 ss <<
" GNURadio Client ABI Version: " << SOAPY_SDR_ABI_VERSION << std::endl;
41 ss <<
" SoapySDR Library ABI Version: " << SoapySDR::getABIVersion() << std::endl;
42 ss <<
" Rebuild module against installed library..." << std::endl;
43 throw std::runtime_error(ss.str());
49 if (channels.empty()) channels.push_back(0);
52 bool isComplex =
false;
54 BOOST_FOREACH (
const char ch, format)
56 if (ch ==
'C') isComplex =
true;
57 if (std::isdigit(ch)) numStr += ch;
61 int bits = boost::lexical_cast<int>(numStr);
62 if (isComplex) bits *= 2;
63 return gr::io_signature::make(channels.size(), channels.size(), bits/8);
71 static std::vector<gr::sdr::range_t>
toRanges(
const std::vector<SoapySDR::Range> &ranges)
73 std::vector<gr::sdr::range_t> out;
74 BOOST_FOREACH (
const SoapySDR::Range &r, ranges) out.push_back(
toRange(r));
static gr::sdr::range_t toRange(const SoapySDR::Range &r)
Definition: sdr_helpers.h:66
static gr::io_signature::sptr stream_args_to_io_signature(const std::string &format, std::vector< size_t > &channels)
Definition: sdr_helpers.h:46
static void check_abi(const std::string &what)
Definition: sdr_helpers.h:35
static std::vector< gr::sdr::range_t > toRanges(const std::vector< SoapySDR::Range > &ranges)
Definition: sdr_helpers.h:71