Replace BOOST_FOREACH with range-based for loops

Range-based for loops are available since C++11. Using them reduces
gr-osmosdr's dependence on Boost. Here I've done the replacement using a
global search-and-replace.

Signed-off-by: Eric Wild <ewild@sysmocom.de>
gr3.8
Clayton Smith 2 years ago committed by Eric Wild
parent 90c3d5b555
commit e5bee0820f
  1. 13
      lib/arg_helpers.h
  2. 9
      lib/bladerf/bladerf_common.cc
  3. 4
      lib/bladerf/bladerf_sink_c.cc
  4. 4
      lib/bladerf/bladerf_source_c.cc
  5. 39
      lib/device.cc
  6. 3
      lib/fcd/fcd_source_c.cc
  7. 13
      lib/ranges.cc
  8. 4
      lib/rfspace/rfspace_source_c.cc
  9. 82
      lib/sink_impl.cc
  10. 12
      lib/soapy/soapy_sink_c.cc
  11. 12
      lib/soapy/soapy_source_c.cc
  12. 108
      lib/source_impl.cc
  13. 15
      lib/uhd/uhd_sink_c.cc
  14. 15
      lib/uhd/uhd_source_c.cc

@ -29,7 +29,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <boost/foreach.hpp>
#include <ciso646>
typedef std::map< std::string, std::string > dict_t;
@ -38,7 +37,7 @@ typedef std::pair< std::string, std::string > pair_t;
inline std::string dict_to_args_string( const dict_t &d )
{
std::string out;
BOOST_FOREACH(const pair_t pair, d)
for (const pair_t pair : d)
{
if (not out.empty()) out += ",";
out += pair.first + "='" + pair.second + "'";
@ -54,7 +53,7 @@ inline std::vector< std::string > args_to_vector( const std::string &args )
typedef boost::tokenizer< boost::escaped_list_separator<char> > tokenizer_t;
tokenizer_t tokens(args, separator);
BOOST_FOREACH(std::string token, tokens)
for (std::string token : tokens)
result.push_back(token);
return result;
@ -68,7 +67,7 @@ inline std::vector< std::string > params_to_vector( const std::string &params )
typedef boost::tokenizer< boost::escaped_list_separator<char> > tokenizer_t;
tokenizer_t tokens(params, separator);
BOOST_FOREACH(std::string token, tokens)
for (std::string token : tokens)
result.push_back(token);
return result;
@ -98,7 +97,7 @@ inline dict_t params_to_dict( const std::string &params )
dict_t result;
std::vector< std::string > param_list = params_to_vector( params );
BOOST_FOREACH(std::string param, param_list)
for (std::string param : param_list)
{
pair_t pair = param_to_pair( param );
std::string value = pair.second;
@ -124,7 +123,7 @@ inline gr::io_signature::sptr args_to_io_signature( const std::string &args )
size_t dev_nchan = 0;
std::vector< std::string > arg_list = args_to_vector( args );
BOOST_FOREACH( std::string arg, arg_list )
for (std::string arg : arg_list)
{
if ( arg.find( "numchan=" ) == 0 ) // try to parse global nchan value
{
@ -141,7 +140,7 @@ inline gr::io_signature::sptr args_to_io_signature( const std::string &args )
// try to parse device specific nchan values, assume 1 channel if none given
BOOST_FOREACH( std::string arg, arg_list )
for (std::string arg : arg_list)
{
dict_t dict = params_to_dict(arg);
if (dict.count("nchan"))

@ -35,7 +35,6 @@
#include <string>
#include <boost/assign.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
@ -498,7 +497,7 @@ int bladerf_common::channel2rfport(bladerf_channel ch)
bladerf_channel bladerf_common::chan2channel(bladerf_direction direction,
size_t chan)
{
BOOST_FOREACH(bladerf_channel_map::value_type &i, _chanmap) {
for (bladerf_channel_map::value_type &i : _chanmap) {
bladerf_channel ch = i.first;
if (
(i.second == (int)chan) && (
@ -642,7 +641,7 @@ osmosdr::freq_range_t bladerf_common::filter_bandwidths(bladerf_channel ch)
0.75, 0.875, 1.25, 1.375, 1.5, 1.92, 2.5,
2.75, 3, 3.5, 4.375, 5, 6, 7, 10, 14;
BOOST_FOREACH( double half_bw, half_bandwidths )
for (double half_bw : half_bandwidths)
bandwidths += osmosdr::range_t( half_bw * 2e6 );
#else
@ -1136,7 +1135,7 @@ bladerf_sptr bladerf_common::get_cached_device(struct bladerf_devinfo devinfo)
int status;
struct bladerf_devinfo other_devinfo;
BOOST_FOREACH(std::weak_ptr<struct bladerf> dev, _devs) {
for (std::weak_ptr<struct bladerf> dev : _devs) {
status = bladerf_get_devinfo(bladerf_sptr(dev).get(), &other_devinfo);
if (status < 0) {
BLADERF_THROW_STATUS(status, "Failed to get devinfo for cached device");
@ -1199,7 +1198,7 @@ void bladerf_common::print_device_info()
bool bladerf_common::is_antenna_valid(bladerf_direction dir,
const std::string &antenna)
{
BOOST_FOREACH(std::string ant, get_antennas(dir)) {
for (std::string ant : get_antennas(dir)) {
if (antenna == ant) {
return true;
}

@ -96,7 +96,7 @@ bladerf_sink_c::bladerf_sink_c(const std::string &args) :
}
/* Initialize channel <-> antenna map */
BOOST_FOREACH(std::string ant, get_antennas()) {
for (std::string ant : get_antennas()) {
_chanmap[str2channel(ant)] = -1;
}
@ -329,7 +329,7 @@ int bladerf_sink_c::transmit_with_tags(int16_t const *samples,
}
}
BOOST_FOREACH(gr::tag_t tag, tags) {
for (gr::tag_t tag : tags) {
// Upon seeing an SOB tag, update our offset. We'll TX the start of the
// burst when we see an EOB or at the end of this function - whichever
// occurs first.

@ -144,7 +144,7 @@ bladerf_source_c::bladerf_source_c(const std::string &args) :
}
/* Initialize channel <-> antenna map */
BOOST_FOREACH(std::string ant, get_antennas()) {
for (std::string ant : get_antennas()) {
_chanmap[str2channel(ant)] = -1;
}
@ -180,7 +180,7 @@ bladerf_source_c::bladerf_source_c(const std::string &args) :
bool bladerf_source_c::is_antenna_valid(const std::string &antenna)
{
BOOST_FOREACH(std::string ant, get_antennas()) {
for (std::string ant : get_antennas()) {
if (antenna == ant) {
return true;
}

@ -20,7 +20,6 @@
#include <osmosdr/device.h>
#include <stdexcept>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <algorithm>
#include <mutex>
@ -108,7 +107,7 @@ device_t::device_t(const std::string &args)
{
dict_t dict = params_to_dict(args);
BOOST_FOREACH( dict_t::value_type &entry, dict )
for (dict_t::value_type &entry : dict)
(*this)[entry.first] = entry.second;
}
@ -118,7 +117,7 @@ std::string device_t::to_pp_string(void) const
std::stringstream ss;
ss << "Device Address:" << std::endl;
BOOST_FOREACH(const device_t::value_type &entry, *this) {
for (const device_t::value_type &entry : *this) {
ss << boost::format(" %s: %s") % entry.first % entry.second << std::endl;
}
return ss.str();
@ -128,7 +127,7 @@ std::string device_t::to_string(void) const
{
std::stringstream ss;
size_t count = 0;
BOOST_FOREACH(const device_t::value_type &entry, *this) {
for (const device_t::value_type &entry : *this) {
std::string value = entry.second;
if (value.find(" ") != std::string::npos)
value = "'" + value + "'";
@ -151,55 +150,55 @@ devices_t device::find(const device_t &hint)
devices_t devices;
#ifdef ENABLE_OSMOSDR
BOOST_FOREACH( std::string dev, osmosdr_src_c::get_devices() )
for (std::string dev : osmosdr_src_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_FCD
BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() )
for (std::string dev : fcd_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_RTL
BOOST_FOREACH( std::string dev, rtl_source_c::get_devices() )
for (std::string dev : rtl_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_UHD
BOOST_FOREACH( std::string dev, uhd_source_c::get_devices() )
for (std::string dev : uhd_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_MIRI
BOOST_FOREACH( std::string dev, miri_source_c::get_devices() )
for (std::string dev : miri_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_SDRPLAY
BOOST_FOREACH( std::string dev, sdrplay_source_c::get_devices() )
for (std::string dev : sdrplay_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_BLADERF
BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() )
for (std::string dev : bladerf_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_HACKRF
BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() )
for (std::string dev : hackrf_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_RFSPACE
BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices( fake ) )
for (std::string dev : rfspace_source_c::get_devices( fake ))
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_AIRSPY
BOOST_FOREACH( std::string dev, airspy_source_c::get_devices() )
for (std::string dev : airspy_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_AIRSPYHF
BOOST_FOREACH( std::string dev, airspyhf_source_c::get_devices() )
for (std::string dev : airspyhf_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_FREESRP
BOOST_FOREACH( std::string dev, freesrp_source_c::get_devices() )
for (std::string dev : freesrp_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_SOAPY
BOOST_FOREACH( std::string dev, soapy_source_c::get_devices() )
for (std::string dev : soapy_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
@ -208,15 +207,15 @@ devices_t device::find(const device_t &hint)
* in a graphical interface etc... */
#ifdef ENABLE_RTL_TCP
BOOST_FOREACH( std::string dev, rtl_tcp_source_c::get_devices( fake ) )
for (std::string dev : rtl_tcp_source_c::get_devices( fake ))
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_REDPITAYA
BOOST_FOREACH( std::string dev, redpitaya_source_c::get_devices( fake ) )
for (std::string dev : redpitaya_source_c::get_devices( fake ))
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_FILE
BOOST_FOREACH( std::string dev, file_source_c::get_devices( fake ) )
for (std::string dev : file_source_c::get_devices( fake ))
devices.push_back( device_t(dev) );
#endif

@ -23,7 +23,6 @@
#include <sstream>
#include <boost/assign.hpp>
#include <boost/foreach.hpp>
#include <gnuradio/io_signature.h>
@ -171,7 +170,7 @@ std::vector< std::string > fcd_source_c::get_devices()
int id = 0;
std::vector< std::string > devices;
BOOST_FOREACH( device_t dev, _get_devices() )
for (device_t dev : _get_devices())
{
std::string args = "fcd=" + boost::lexical_cast< std::string >( id++ );

@ -18,7 +18,6 @@
#include <osmosdr/ranges.h>
#include <stdexcept>
#include <boost/math/special_functions/round.hpp>
#include <boost/foreach.hpp>
#include <algorithm>
#include <sstream>
@ -102,7 +101,7 @@ meta_range_t::meta_range_t(
double meta_range_t::start(void) const{
check_meta_range_monotonic(*this);
double min_start = this->front().start();
BOOST_FOREACH(const range_t &r, (*this)){
for (const range_t &r : (*this)){
min_start = std::min(min_start, r.start());
}
return min_start;
@ -111,7 +110,7 @@ double meta_range_t::start(void) const{
double meta_range_t::stop(void) const{
check_meta_range_monotonic(*this);
double max_stop = this->front().stop();
BOOST_FOREACH(const range_t &r, (*this)){
for (const range_t &r : (*this)){
max_stop = std::max(max_stop, r.stop());
}
return max_stop;
@ -121,7 +120,7 @@ double meta_range_t::step(void) const{
check_meta_range_monotonic(*this);
std::vector<double> non_zero_steps;
range_t last = this->front();
BOOST_FOREACH(const range_t &r, (*this)){
for (const range_t &r : (*this)){
//steps at each range
if (r.step() > 0) non_zero_steps.push_back(r.step());
//and steps in-between ranges
@ -137,7 +136,7 @@ double meta_range_t::step(void) const{
double meta_range_t::clip(double value, bool clip_step) const{
check_meta_range_monotonic(*this);
double last_stop = this->front().stop();
BOOST_FOREACH(const range_t &r, (*this)){
for (const range_t &r : (*this)){
//in-between ranges, clip to nearest
if (value < r.start()){
return (std::abs(value - r.start()) < std::abs(value - last_stop))?
@ -157,7 +156,7 @@ double meta_range_t::clip(double value, bool clip_step) const{
std::vector<double> meta_range_t::values() const {
std::vector<double> values;
BOOST_FOREACH(const range_t &r, (*this)) {
for (const range_t &r : (*this)) {
if (r.start() != r.stop()) {
if ( r.step() == 0 ) {
values.push_back( r.start() );
@ -177,7 +176,7 @@ std::vector<double> meta_range_t::values() const {
const std::string meta_range_t::to_pp_string(void) const{
std::stringstream ss;
BOOST_FOREACH(const range_t &r, (*this)){
for (const range_t &r : (*this)){
ss << r.to_pp_string() << std::endl;
}
return ss.str();

@ -1296,7 +1296,7 @@ std::vector<std::string> rfspace_source_c::get_devices( bool fake )
std::vector < unit_t > units = discover_netsdr();
BOOST_FOREACH( unit_t u, units )
for (unit_t u : units)
{
// std::cerr << u.name << " " << u.sn << " " << u.addr << ":" << u.port
// << std::endl;
@ -1310,7 +1310,7 @@ std::vector<std::string> rfspace_source_c::get_devices( bool fake )
units = discover_sdr_iq();
BOOST_FOREACH( unit_t u, units )
for (unit_t u : units)
{
// std::cerr << u.name << " " << u.sn << " " << u.addr << ":" << u.port
// << std::endl;

@ -107,13 +107,13 @@ sink_impl::sink_impl( const std::string &args )
<< GR_OSMOSDR_VERSION << " (" << GR_OSMOSDR_LIBVER << ") "
<< "gnuradio " << gr::version() << std::endl;
std::cerr << "built-in sink types: ";
BOOST_FOREACH(std::string dev_type, dev_types)
for (std::string dev_type : dev_types)
std::cerr << dev_type << " ";
std::cerr << std::endl;
BOOST_FOREACH(std::string arg, arg_list) {
for (std::string arg : arg_list) {
dict_t dict = params_to_dict(arg);
BOOST_FOREACH(std::string dev_type, dev_types) {
for (std::string dev_type : dev_types) {
if ( dict.count( dev_type ) ) {
device_specified = true;
break;
@ -124,36 +124,36 @@ sink_impl::sink_impl( const std::string &args )
if ( ! device_specified ) {
std::vector< std::string > dev_list;
#ifdef ENABLE_UHD
BOOST_FOREACH( std::string dev, uhd_sink_c::get_devices() )
for (std::string dev : uhd_sink_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_BLADERF
BOOST_FOREACH( std::string dev, bladerf_sink_c::get_devices() )
for (std::string dev : bladerf_sink_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_HACKRF
BOOST_FOREACH( std::string dev, hackrf_sink_c::get_devices() )
for (std::string dev : hackrf_sink_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_SOAPY
BOOST_FOREACH( std::string dev, soapy_sink_c::get_devices() )
for (std::string dev : soapy_sink_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_REDPITAYA
BOOST_FOREACH( std::string dev, redpitaya_sink_c::get_devices() )
for (std::string dev : redpitaya_sink_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_FREESRP
BOOST_FOREACH( std::string dev, freesrp_sink_c::get_devices() )
for (std::string dev : freesrp_sink_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_FILE
BOOST_FOREACH( std::string dev, file_sink_c::get_devices() )
for (std::string dev : file_sink_c::get_devices())
dev_list.push_back( dev );
#endif
// std::cerr << std::endl;
// BOOST_FOREACH( std::string dev, dev_list )
// for (std::string dev : dev_list)
// std::cerr << "'" << dev << "'" << std::endl;
if ( dev_list.size() )
@ -162,12 +162,12 @@ sink_impl::sink_impl( const std::string &args )
throw std::runtime_error("No supported devices found (check the connection and/or udev rules).");
}
BOOST_FOREACH(std::string arg, arg_list) {
for (std::string arg : arg_list) {
dict_t dict = params_to_dict(arg);
// std::cerr << std::endl;
// BOOST_FOREACH( dict_t::value_type &entry, dict )
// for (dict_t::value_type &entry : dict)
// std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
sink_iface *iface = NULL;
@ -235,7 +235,7 @@ size_t sink_impl::get_num_channels()
{
size_t channels = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
channels += dev->get_num_channels();
return channels;
@ -263,7 +263,7 @@ double sink_impl::set_sample_rate(double rate)
if (_devs.empty())
throw std::runtime_error(NO_DEVICES_MSG);
#endif
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
sample_rate = dev->set_sample_rate(rate);
_sample_rate = sample_rate;
@ -288,7 +288,7 @@ double sink_impl::get_sample_rate()
osmosdr::freq_range_t sink_impl::get_freq_range( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_range( dev_chan );
@ -299,7 +299,7 @@ osmosdr::freq_range_t sink_impl::get_freq_range( size_t chan )
double sink_impl::set_center_freq( double freq, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _center_freq[ chan ] != freq ) {
@ -314,7 +314,7 @@ double sink_impl::set_center_freq( double freq, size_t chan )
double sink_impl::get_center_freq( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_center_freq( dev_chan );
@ -325,7 +325,7 @@ double sink_impl::get_center_freq( size_t chan )
double sink_impl::set_freq_corr( double ppm, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _freq_corr[ chan ] != ppm ) {
@ -340,7 +340,7 @@ double sink_impl::set_freq_corr( double ppm, size_t chan )
double sink_impl::get_freq_corr( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_corr( dev_chan );
@ -351,7 +351,7 @@ double sink_impl::get_freq_corr( size_t chan )
std::vector<std::string> sink_impl::get_gain_names( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_names( dev_chan );
@ -362,7 +362,7 @@ std::vector<std::string> sink_impl::get_gain_names( size_t chan )
osmosdr::gain_range_t sink_impl::get_gain_range( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( dev_chan );
@ -373,7 +373,7 @@ osmosdr::gain_range_t sink_impl::get_gain_range( size_t chan )
osmosdr::gain_range_t sink_impl::get_gain_range( const std::string & name, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( name, dev_chan );
@ -384,7 +384,7 @@ osmosdr::gain_range_t sink_impl::get_gain_range( const std::string & name, size_
bool sink_impl::set_gain_mode( bool automatic, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _gain_mode[ chan ] != automatic ) {
@ -402,7 +402,7 @@ bool sink_impl::set_gain_mode( bool automatic, size_t chan )
bool sink_impl::get_gain_mode( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_mode( dev_chan );
@ -413,7 +413,7 @@ bool sink_impl::get_gain_mode( size_t chan )
double sink_impl::set_gain( double gain, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _gain[ chan ] != gain ) {
@ -428,7 +428,7 @@ double sink_impl::set_gain( double gain, size_t chan )
double sink_impl::set_gain( double gain, const std::string & name, size_t chan)
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->set_gain( gain, name, dev_chan );
@ -439,7 +439,7 @@ double sink_impl::set_gain( double gain, const std::string & name, size_t chan)
double sink_impl::get_gain( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( dev_chan );
@ -450,7 +450,7 @@ double sink_impl::get_gain( size_t chan )
double sink_impl::get_gain( const std::string & name, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( name, dev_chan );
@ -461,7 +461,7 @@ double sink_impl::get_gain( const std::string & name, size_t chan )
double sink_impl::set_if_gain( double gain, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _if_gain[ chan ] != gain ) {
@ -476,7 +476,7 @@ double sink_impl::set_if_gain( double gain, size_t chan )
double sink_impl::set_bb_gain( double gain, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _bb_gain[ chan ] != gain ) {
@ -491,7 +491,7 @@ double sink_impl::set_bb_gain( double gain, size_t chan )
std::vector< std::string > sink_impl::get_antennas( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_antennas( dev_chan );
@ -502,7 +502,7 @@ std::vector< std::string > sink_impl::get_antennas( size_t chan )
std::string sink_impl::set_antenna( const std::string & antenna, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _antenna[ chan ] != antenna ) {
@ -517,7 +517,7 @@ std::string sink_impl::set_antenna( const std::string & antenna, size_t chan )
std::string sink_impl::get_antenna( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_antenna( dev_chan );
@ -528,7 +528,7 @@ std::string sink_impl::get_antenna( size_t chan )
void sink_impl::set_dc_offset( const std::complex<double> &offset, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
dev->set_dc_offset( offset, dev_chan );
@ -537,7 +537,7 @@ void sink_impl::set_dc_offset( const std::complex<double> &offset, size_t chan )
void sink_impl::set_iq_balance( const std::complex<double> &balance, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
dev->set_iq_balance( balance, dev_chan );
@ -546,7 +546,7 @@ void sink_impl::set_iq_balance( const std::complex<double> &balance, size_t chan
double sink_impl::set_bandwidth( double bandwidth, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _bandwidth[ chan ] != bandwidth || 0.0f == bandwidth ) {
@ -561,7 +561,7 @@ double sink_impl::set_bandwidth( double bandwidth, size_t chan )
double sink_impl::get_bandwidth( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_bandwidth( dev_chan );
@ -572,7 +572,7 @@ double sink_impl::get_bandwidth( size_t chan )
osmosdr::freq_range_t sink_impl::get_bandwidth_range( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_bandwidth_range( dev_chan );
@ -665,7 +665,7 @@ void sink_impl::set_time_now(const osmosdr::time_spec_t &time_spec, size_t mboar
void sink_impl::set_time_next_pps(const osmosdr::time_spec_t &time_spec)
{
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
{
dev->set_time_next_pps( time_spec );
}
@ -673,7 +673,7 @@ void sink_impl::set_time_next_pps(const osmosdr::time_spec_t &time_spec)
void sink_impl::set_time_unknown_pps(const osmosdr::time_spec_t &time_spec)
{
BOOST_FOREACH( sink_iface *dev, _devs )
for (sink_iface *dev : _devs)
{
dev->set_time_unknown_pps( time_spec );
}

@ -107,7 +107,7 @@ std::vector<std::string> soapy_sink_c::get_devices()
{
std::vector<std::string> result;
int i = 0;
BOOST_FOREACH(SoapySDR::Kwargs kw, SoapySDR::Device::enumerate())
for (SoapySDR::Kwargs kw : SoapySDR::Device::enumerate())
{
kw["soapy"] = boost::lexical_cast<std::string>(i++);
result.push_back(dict_to_args_string(kw));
@ -124,12 +124,12 @@ osmosdr::meta_range_t soapy_sink_c::get_sample_rates( void )
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_TX, 0))
for (const SoapySDR::Range &r : _device->getSampleRateRange(SOAPY_SDR_TX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_TX, 0))
for (const double rate : _device->listSampleRates(SOAPY_SDR_TX, 0))
{
result.push_back(osmosdr::range_t(rate));
}
@ -151,7 +151,7 @@ double soapy_sink_c::get_sample_rate( void )
osmosdr::freq_range_t soapy_sink_c::get_freq_range( size_t chan)
{
osmosdr::meta_range_t result;
BOOST_FOREACH(const SoapySDR::Range r, _device->getFrequencyRange(SOAPY_SDR_TX, 0))
for (const SoapySDR::Range r : _device->getFrequencyRange(SOAPY_SDR_TX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
@ -309,12 +309,12 @@ osmosdr::freq_range_t soapy_sink_c::get_bandwidth_range( size_t chan)
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
BOOST_FOREACH(const SoapySDR::Range &r, _device->getBandwidthRange(SOAPY_SDR_TX, 0))
for (const SoapySDR::Range &r : _device->getBandwidthRange(SOAPY_SDR_TX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_TX, 0))
for (const double bw : _device->listBandwidths(SOAPY_SDR_TX, 0))
{
result.push_back(osmosdr::range_t(bw));
}

@ -113,7 +113,7 @@ std::vector<std::string> soapy_source_c::get_devices()
{
std::vector<std::string> result;
int i = 0;
BOOST_FOREACH(SoapySDR::Kwargs kw, SoapySDR::Device::enumerate())
for (SoapySDR::Kwargs kw : SoapySDR::Device::enumerate())
{
kw["soapy"] = boost::lexical_cast<std::string>(i++);
result.push_back(dict_to_args_string(kw));
@ -130,12 +130,12 @@ osmosdr::meta_range_t soapy_source_c::get_sample_rates( void )
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_RX, 0))
for (const SoapySDR::Range &r : _device->getSampleRateRange(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_RX, 0))
for (const double rate : _device->listSampleRates(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(rate));
}
@ -157,7 +157,7 @@ double soapy_source_c::get_sample_rate( void )
osmosdr::freq_range_t soapy_source_c::get_freq_range( size_t chan )
{
osmosdr::meta_range_t result;
BOOST_FOREACH(const SoapySDR::Range r, _device->getFrequencyRange(SOAPY_SDR_RX, 0))
for (const SoapySDR::Range r : _device->getFrequencyRange(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
@ -338,12 +338,12 @@ osmosdr::freq_range_t soapy_source_c::get_bandwidth_range( size_t chan )
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
BOOST_FOREACH(const SoapySDR::Range &r, _device->getBandwidthRange(SOAPY_SDR_RX, 0))
for (const SoapySDR::Range &r : _device->getBandwidthRange(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
BOOST_FOREACH(const double bw, _device->listBandwidths(SOAPY_SDR_RX, 0))
for (const double bw : _device->listBandwidths(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(bw));
}

@ -177,7 +177,7 @@ source_impl::source_impl( const std::string &args )
<< GR_OSMOSDR_VERSION << " (" << GR_OSMOSDR_LIBVER << ") "
<< "gnuradio " << gr::version() << std::endl;
std::cerr << "built-in source types: ";
BOOST_FOREACH(std::string dev_type, dev_types)
for (std::string dev_type : dev_types)
std::cerr << dev_type << " ";
std::cerr << std::endl;
@ -188,9 +188,9 @@ source_impl::source_impl( const std::string &args )
dev_types.push_back("cloudiq");
#endif
BOOST_FOREACH(std::string arg, arg_list) {
for (std::string arg : arg_list) {
dict_t dict = params_to_dict(arg);
BOOST_FOREACH(std::string dev_type, dev_types) {
for (std::string dev_type : dev_types) {
if ( dict.count( dev_type ) ) {
device_specified = true;
break;
@ -201,64 +201,64 @@ source_impl::source_impl( const std::string &args )
if ( ! device_specified ) {
std::vector< std::string > dev_list;
#ifdef ENABLE_OSMOSDR
BOOST_FOREACH( std::string dev, osmosdr_src_c::get_devices() )
for (std::string dev : osmosdr_src_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_FCD
BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() )
for (std::string dev : fcd_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_RTL
BOOST_FOREACH( std::string dev, rtl_source_c::get_devices() )
for (std::string dev : rtl_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_UHD
BOOST_FOREACH( std::string dev, uhd_source_c::get_devices() )
for (std::string dev : uhd_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_MIRI
BOOST_FOREACH( std::string dev, miri_source_c::get_devices() )
for (std::string dev : miri_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_SDRPLAY
BOOST_FOREACH( std::string dev, sdrplay_source_c::get_devices() )
for (std::string dev : sdrplay_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_BLADERF
BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() )
for (std::string dev : bladerf_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_RFSPACE
BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices() )
for (std::string dev : rfspace_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_HACKRF
BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() )
for (std::string dev : hackrf_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_AIRSPY
BOOST_FOREACH( std::string dev, airspy_source_c::get_devices() )
for (std::string dev : airspy_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_AIRSPYHF
BOOST_FOREACH( std::string dev, airspyhf_source_c::get_devices() )
for (std::string dev : airspyhf_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_SOAPY
BOOST_FOREACH( std::string dev, soapy_source_c::get_devices() )
for (std::string dev : soapy_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_REDPITAYA
BOOST_FOREACH( std::string dev, redpitaya_source_c::get_devices() )
for (std::string dev : redpitaya_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_FREESRP
BOOST_FOREACH( std::string dev, freesrp_source_c::get_devices() )
for (std::string dev : freesrp_source_c::get_devices())
dev_list.push_back( dev );
#endif
// std::cerr << std::endl;
// BOOST_FOREACH( std::string dev, dev_list )
// for (std::string dev : dev_list)
// std::cerr << "'" << dev << "'" << std::endl;
if ( dev_list.size() )
@ -267,12 +267,12 @@ source_impl::source_impl( const std::string &args )
throw std::runtime_error("No supported devices found (check the connection and/or udev rules).");
}
BOOST_FOREACH(std::string arg, arg_list) {
for (std::string arg : arg_list) {
dict_t dict = params_to_dict(arg);
// std::cerr << std::endl;
// BOOST_FOREACH( dict_t::value_type &entry, dict )
// for (dict_t::value_type &entry : dict)
// std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
source_iface *iface = NULL;
@ -427,7 +427,7 @@ size_t source_impl::get_num_channels()
{
size_t channels = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
channels += dev->get_num_channels();
return channels;
@ -436,7 +436,7 @@ size_t source_impl::get_num_channels()
bool source_impl::seek( long seek_point, int whence, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->seek( seek_point, whence, dev_chan );
@ -466,12 +466,12 @@ double source_impl::set_sample_rate(double rate)
if (_devs.empty())
throw std::runtime_error(NO_DEVICES_MSG);
#endif
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
sample_rate = dev->set_sample_rate(rate);
#ifdef HAVE_IQBALANCE
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs ) {
for (source_iface *dev : _devs) {
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
if ( channel < _iq_opt.size() ) {
gr::iqbalance::optimize_c *opt = _iq_opt[channel];
@ -509,7 +509,7 @@ double source_impl::get_sample_rate()
osmosdr::freq_range_t source_impl::get_freq_range( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_range( dev_chan );
@ -520,7 +520,7 @@ osmosdr::freq_range_t source_impl::get_freq_range( size_t chan )
double source_impl::set_center_freq( double freq, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _center_freq[ chan ] != freq ) {
@ -535,7 +535,7 @@ double source_impl::set_center_freq( double freq, size_t chan )
double source_impl::get_center_freq( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_center_freq( dev_chan );
@ -546,7 +546,7 @@ double source_impl::get_center_freq( size_t chan )
double source_impl::set_freq_corr( double ppm, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _freq_corr[ chan ] != ppm ) {
@ -561,7 +561,7 @@ double source_impl::set_freq_corr( double ppm, size_t chan )
double source_impl::get_freq_corr( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_corr( dev_chan );
@ -572,7 +572,7 @@ double source_impl::get_freq_corr( size_t chan )
std::vector<std::string> source_impl::get_gain_names( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_names( dev_chan );
@ -583,7 +583,7 @@ std::vector<std::string> source_impl::get_gain_names( size_t chan )
osmosdr::gain_range_t source_impl::get_gain_range( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( dev_chan );
@ -594,7 +594,7 @@ osmosdr::gain_range_t source_impl::get_gain_range( size_t chan )
osmosdr::gain_range_t source_impl::get_gain_range( const std::string & name, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( name, dev_chan );
@ -605,7 +605,7 @@ osmosdr::gain_range_t source_impl::get_gain_range( const std::string & name, siz
bool source_impl::set_gain_mode( bool automatic, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _gain_mode[ chan ] != automatic ) {
@ -623,7 +623,7 @@ bool source_impl::set_gain_mode( bool automatic, size_t chan )
bool source_impl::get_gain_mode( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_mode( dev_chan );
@ -634,7 +634,7 @@ bool source_impl::get_gain_mode( size_t chan )
double source_impl::set_gain( double gain, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _gain[ chan ] != gain ) {
@ -649,7 +649,7 @@ double source_impl::set_gain( double gain, size_t chan )
double source_impl::set_gain( double gain, const std::string & name, size_t chan)
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->set_gain( gain, name, dev_chan );
@ -660,7 +660,7 @@ double source_impl::set_gain( double gain, const std::string & name, size_t chan
double source_impl::get_gain( size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( dev_chan );
@ -671,7 +671,7 @@ double source_impl::get_gain( size_t chan )
double source_impl::get_gain( const std::string & name, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( name, dev_chan );
@ -682,7 +682,7 @@ double source_impl::get_gain( const std::string & name, size_t chan )
double source_impl::set_if_gain( double gain, size_t chan )
{
size_t channel = 0;
BOOST_FOREACH( source_iface *dev, _devs )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( _if_gain[ chan ] != gain ) {
@ -697,7 +697,7 @@ double source_impl::set_if_gain( double gain, size_t chan )
double source_impl::set_bb_gain( double gain, size_t chan )
{