hackrf: replace boost::assign with C++11

Since GNU Radio is gradually replacing Boost with C++11, it seemed worth
doing that for the HackRF blocks I was working on. This change removes
all usage of boost::assign.

From: Clayton Smith <argilo@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
gr3.8
Clayton Smith 3 years ago committed by Sylvain Munaut
parent ae2253c516
commit 4d1c05e84b
  1. 54
      lib/hackrf/hackrf_common.cc
  2. 1
      lib/hackrf/hackrf_common.h
  3. 11
      lib/hackrf/hackrf_sink_c.cc
  4. 11
      lib/hackrf/hackrf_source_c.cc

@ -21,14 +21,10 @@
#include "config.h"
#endif
#include <boost/assign.hpp>
#include "hackrf_common.h"
#include "arg_helpers.h"
using namespace boost::assign;
int hackrf_common::_usage = 0;
std::mutex hackrf_common::_usage_mutex;
@ -213,11 +209,11 @@ osmosdr::meta_range_t hackrf_common::get_sample_rates()
* the user is allowed to request arbitrary (fractional) rates within these
* boundaries. */
range += osmosdr::range_t( 8e6 );
range += osmosdr::range_t( 10e6 );
range += osmosdr::range_t( 12.5e6 );
range += osmosdr::range_t( 16e6 );
range += osmosdr::range_t( 20e6 ); /* confirmed to work on fast machines */
range.push_back(osmosdr::range_t( 8e6 ));
range.push_back(osmosdr::range_t( 10e6 ));
range.push_back(osmosdr::range_t( 12.5e6 ));
range.push_back(osmosdr::range_t( 16e6 ));
range.push_back(osmosdr::range_t( 20e6 )); /* confirmed to work on fast machines */
return range;
}
@ -246,7 +242,7 @@ osmosdr::freq_range_t hackrf_common::get_freq_range( size_t chan )
{
osmosdr::freq_range_t range;
range += osmosdr::range_t( _sample_rate / 2, 7250e6 - _sample_rate / 2 );
range.push_back(osmosdr::range_t( _sample_rate / 2, 7250e6 - _sample_rate / 2 ));
return range;
}
@ -325,11 +321,7 @@ double hackrf_common::get_gain( size_t chan )
std::vector< std::string > hackrf_common::get_antennas( size_t chan )
{
std::vector< std::string > antennas;
antennas += get_antenna( chan );
return antennas;
return { get_antenna( chan ) };
}
std::string hackrf_common::set_antenna( const std::string & antenna, size_t chan )
@ -375,22 +367,22 @@ osmosdr::freq_range_t hackrf_common::get_bandwidth_range( size_t chan )
// TODO: read out from libhackrf when an API is available
bandwidths += osmosdr::range_t( 1750000 );
bandwidths += osmosdr::range_t( 2500000 );
bandwidths += osmosdr::range_t( 3500000 );
bandwidths += osmosdr::range_t( 5000000 );
bandwidths += osmosdr::range_t( 5500000 );
bandwidths += osmosdr::range_t( 6000000 );
bandwidths += osmosdr::range_t( 7000000 );
bandwidths += osmosdr::range_t( 8000000 );
bandwidths += osmosdr::range_t( 9000000 );
bandwidths += osmosdr::range_t( 10000000 );
bandwidths += osmosdr::range_t( 12000000 );
bandwidths += osmosdr::range_t( 14000000 );
bandwidths += osmosdr::range_t( 15000000 );
bandwidths += osmosdr::range_t( 20000000 );
bandwidths += osmosdr::range_t( 24000000 );
bandwidths += osmosdr::range_t( 28000000 );
bandwidths.push_back(osmosdr::range_t( 1750000 ));
bandwidths.push_back(osmosdr::range_t( 2500000 ));
bandwidths.push_back(osmosdr::range_t( 3500000 ));
bandwidths.push_back(osmosdr::range_t( 5000000 ));
bandwidths.push_back(osmosdr::range_t( 5500000 ));
bandwidths.push_back(osmosdr::range_t( 6000000 ));
bandwidths.push_back(osmosdr::range_t( 7000000 ));
bandwidths.push_back(osmosdr::range_t( 8000000 ));
bandwidths.push_back(osmosdr::range_t( 9000000 ));
bandwidths.push_back(osmosdr::range_t( 10000000 ));
bandwidths.push_back(osmosdr::range_t( 12000000 ));
bandwidths.push_back(osmosdr::range_t( 14000000 ));
bandwidths.push_back(osmosdr::range_t( 15000000 ));
bandwidths.push_back(osmosdr::range_t( 20000000 ));
bandwidths.push_back(osmosdr::range_t( 24000000 ));
bandwidths.push_back(osmosdr::range_t( 28000000 ));
return bandwidths;
}

@ -20,6 +20,7 @@
#ifndef INCLUDED_HACKRF_COMMON_H
#define INCLUDED_HACKRF_COMMON_H
#include <map>
#include <memory>
#include <mutex>
#include <string>

@ -38,16 +38,12 @@
#include <emmintrin.h>
#endif
#include <boost/assign.hpp>
#include <gnuradio/io_signature.h>
#include "hackrf_sink_c.h"
#include "arg_helpers.h"
using namespace boost::assign;
static inline bool cb_init(circular_buffer_t *cb, size_t capacity, size_t sz)
{
cb->buffer = malloc(capacity * sz);
@ -449,12 +445,7 @@ double hackrf_sink_c::get_freq_corr( size_t chan )
std::vector<std::string> hackrf_sink_c::get_gain_names( size_t chan )
{
std::vector< std::string > names;
names += "RF";
names += "IF";
return names;
return { "RF", "IF" };
}
osmosdr::gain_range_t hackrf_sink_c::get_gain_range( size_t chan )

@ -31,7 +31,6 @@
#include <stdexcept>
#include <iostream>
#include <boost/assign.hpp>
#include <boost/detail/endian.hpp>
#include <gnuradio/io_signature.h>
@ -40,8 +39,6 @@
#include "arg_helpers.h"
using namespace boost::assign;
hackrf_source_c_sptr make_hackrf_source_c (const std::string & args)
{
return gnuradio::get_initial_sptr(new hackrf_source_c (args));
@ -306,13 +303,7 @@ double hackrf_source_c::get_freq_corr( size_t chan )
std::vector<std::string> hackrf_source_c::get_gain_names( size_t chan )
{
std::vector< std::string > names;
names += "RF";
names += "IF";
names += "BB";
return names;
return { "RF", "IF", "BB" };
}
osmosdr::gain_range_t hackrf_source_c::get_gain_range( size_t chan )

Loading…
Cancel
Save