mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-21 21:40:18 +00:00
Apply fixes by clang-tidy
This commit is contained in:
parent
3dce8934fd
commit
5485afd882
@ -38,6 +38,7 @@
|
||||
#include <glog/logging.h>
|
||||
#include <exception>
|
||||
#include <iostream> // for cout, endl
|
||||
#include <utility>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <iio/iio.h>
|
||||
@ -47,7 +48,7 @@
|
||||
|
||||
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||
{
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_file = "./data/signal_source.dat";
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <boost/format.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
@ -43,7 +44,7 @@ using google::LogMessage;
|
||||
|
||||
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
std::string empty = "";
|
||||
@ -113,8 +114,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configurati
|
||||
|
||||
|
||||
CustomUDPSignalSource::~CustomUDPSignalSource()
|
||||
{
|
||||
}
|
||||
= default;
|
||||
|
||||
|
||||
void CustomUDPSignalSource::connect(gr::top_block_sptr top_block)
|
||||
|
@ -38,13 +38,14 @@
|
||||
#include <glog/logging.h>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||
{
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_file = "./data/signal_source.dat";
|
||||
@ -85,7 +86,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
std::cout << "LO frequency : " << freq_ << " Hz" << std::endl;
|
||||
std::cout << "sample rate: " << sample_rate_ << " Hz" << std::endl;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
if (RF_channels_ == 1)
|
||||
{
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
@ -44,7 +45,7 @@ using google::LogMessage;
|
||||
|
||||
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
std::string empty = "";
|
||||
@ -66,11 +67,11 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string());
|
||||
antenna_ = configuration->property(role + ".antenna", empty);
|
||||
|
||||
if (item_type_.compare("short") == 0)
|
||||
if (item_type_ == "short")
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
else if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
// 1. Make the driver instance
|
||||
@ -158,8 +159,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
|
||||
|
||||
OsmosdrSignalSource::~OsmosdrSignalSource()
|
||||
{
|
||||
}
|
||||
= default;
|
||||
|
||||
|
||||
void OsmosdrSignalSource::driver_instance()
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include <glog/logging.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
@ -41,7 +42,7 @@ using google::LogMessage;
|
||||
|
||||
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||
{
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_file = "./data/signal_source.dat";
|
||||
@ -63,7 +64,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||
|
||||
if (item_type_.compare("gr_complex") != 0)
|
||||
if (item_type_ != "gr_complex")
|
||||
{
|
||||
std::cout << "Configuration error: item_type must be gr_complex" << std::endl;
|
||||
LOG(FATAL) << "Configuration error: item_type must be gr_complex!";
|
||||
@ -106,8 +107,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
||||
|
||||
|
||||
PlutosdrSignalSource::~PlutosdrSignalSource()
|
||||
{
|
||||
}
|
||||
= default;
|
||||
|
||||
|
||||
void PlutosdrSignalSource::connect(gr::top_block_sptr top_block)
|
||||
|
@ -113,12 +113,12 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
||||
std::cout << "Start Ethernet packet capture\n";
|
||||
|
||||
d_n_baseband_channels = n_baseband_channels;
|
||||
if (wire_sample_type.compare("cbyte") == 0)
|
||||
if (wire_sample_type == "cbyte")
|
||||
{
|
||||
d_wire_sample_type = 1;
|
||||
d_bytes_per_sample = d_n_baseband_channels * 2;
|
||||
}
|
||||
else if (wire_sample_type.compare("c4bits") == 0)
|
||||
else if (wire_sample_type == "c4bits")
|
||||
{
|
||||
d_wire_sample_type = 2;
|
||||
d_bytes_per_sample = d_n_baseband_channels;
|
||||
@ -142,8 +142,8 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
||||
d_item_size = item_size;
|
||||
d_IQ_swap = IQ_swap_;
|
||||
d_sock_raw = 0;
|
||||
d_pcap_thread = NULL;
|
||||
descr = NULL;
|
||||
d_pcap_thread = nullptr;
|
||||
descr = nullptr;
|
||||
|
||||
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
|
||||
}
|
||||
@ -171,7 +171,7 @@ bool gr_complex_ip_packet_source::start()
|
||||
bool gr_complex_ip_packet_source::stop()
|
||||
{
|
||||
std::cout << "gr_complex_ip_packet_source STOP\n";
|
||||
if (descr != NULL)
|
||||
if (descr != nullptr)
|
||||
{
|
||||
pcap_breakloop(descr);
|
||||
d_pcap_thread->join();
|
||||
@ -187,7 +187,7 @@ bool gr_complex_ip_packet_source::open()
|
||||
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
|
||||
// open device for reading
|
||||
descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf);
|
||||
if (descr == NULL)
|
||||
if (descr == nullptr)
|
||||
{
|
||||
std::cout << "Error opening Ethernet device " << d_src_device << std::endl;
|
||||
std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl;
|
||||
@ -220,7 +220,7 @@ bool gr_complex_ip_packet_source::open()
|
||||
|
||||
gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
|
||||
{
|
||||
if (d_pcap_thread != NULL)
|
||||
if (d_pcap_thread != nullptr)
|
||||
{
|
||||
delete d_pcap_thread;
|
||||
}
|
||||
@ -232,7 +232,7 @@ gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
|
||||
void gr_complex_ip_packet_source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr,
|
||||
const u_char *packet)
|
||||
{
|
||||
gr_complex_ip_packet_source *bridge = reinterpret_cast<gr_complex_ip_packet_source *>(args);
|
||||
auto *bridge = reinterpret_cast<gr_complex_ip_packet_source *>(args);
|
||||
bridge->pcap_callback(args, pkthdr, packet);
|
||||
}
|
||||
|
||||
@ -327,22 +327,22 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
|
||||
switch (d_wire_sample_type)
|
||||
{
|
||||
case 1: // interleaved byte samples
|
||||
for (long unsigned int i = 0; i < output_items.size(); i++)
|
||||
for (auto & output_item : output_items)
|
||||
{
|
||||
real = fifo_buff[fifo_read_ptr++];
|
||||
imag = fifo_buff[fifo_read_ptr++];
|
||||
if (d_IQ_swap)
|
||||
{
|
||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(real, imag);
|
||||
static_cast<gr_complex *>(output_item)[n] = gr_complex(real, imag);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(imag, real);
|
||||
static_cast<gr_complex *>(output_item)[n] = gr_complex(imag, real);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: // 4-bit samples
|
||||
for (long unsigned int i = 0; i < output_items.size(); i++)
|
||||
for (auto & output_item : output_items)
|
||||
{
|
||||
tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F;
|
||||
if (tmp_char2 >= 8)
|
||||
@ -365,11 +365,11 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
|
||||
}
|
||||
if (d_IQ_swap)
|
||||
{
|
||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(imag, real);
|
||||
static_cast<gr_complex *>(output_item)[n] = gr_complex(imag, real);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(real, imag);
|
||||
static_cast<gr_complex *>(output_item)[n] = gr_complex(real, imag);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -75,10 +75,10 @@ bool get_ad9361_stream_dev(struct iio_context *ctx, enum iodev d, struct iio_dev
|
||||
{
|
||||
case TX:
|
||||
*dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc");
|
||||
return *dev != NULL;
|
||||
return *dev != nullptr;
|
||||
case RX:
|
||||
*dev = iio_context_find_device(ctx, "cf-ad9361-lpc");
|
||||
return *dev != NULL;
|
||||
return *dev != nullptr;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -100,7 +100,7 @@ bool get_ad9361_stream_ch(struct iio_context *ctx __attribute__((unused)), enum
|
||||
name << chid;
|
||||
*chn = iio_device_find_channel(dev, name.str().c_str(), d == TX);
|
||||
}
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -115,14 +115,14 @@ bool get_phy_chan(struct iio_context *ctx, enum iodev d, int chid, struct iio_ch
|
||||
name << "voltage";
|
||||
name << chid;
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), false);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
break;
|
||||
case TX:
|
||||
name.str("");
|
||||
name << "voltage";
|
||||
name << chid;
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), true);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@ -138,10 +138,10 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn
|
||||
// LO chan is always output, i.e. true
|
||||
case RX:
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage0", true);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
case TX:
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage1", true);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -151,7 +151,7 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn
|
||||
/* applies streaming configuration through IIO */
|
||||
bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, enum iodev type, int chid)
|
||||
{
|
||||
struct iio_channel *chn = NULL;
|
||||
struct iio_channel *chn = nullptr;
|
||||
|
||||
// Configure phy and lo channels
|
||||
//LOG(INFO)<<"* Acquiring AD9361 phy channel"<<chid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user