1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-22 04:53:14 +00:00

Apply clang-tidy checks

This commit is contained in:
Carles Fernandez 2019-02-22 21:34:15 +00:00
parent 0068740895
commit 07259159af
9 changed files with 36 additions and 35 deletions

View File

@ -57,6 +57,7 @@
#include "rtklib_pntpos.h"
#include "rtklib_ppp.h"
#include "rtklib_tides.h"
#include <cmath>
#include <cstring>
static int resamb_WLNL(rtk_t *rtk __attribute((unused)), const obsd_t *obs __attribute((unused)), const int *sat __attribute((unused)),
@ -2672,7 +2673,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
}
rtk->sol.age = static_cast<float>(timediff(rtk->sol.time, solb.time));
if (fabs(rtk->sol.age) > TTOL_MOVEB)
if (std::fabs(rtk->sol.age) > TTOL_MOVEB)
{
errmsg(rtk, "time sync error for moving-base (age=%.1f)\n", rtk->sol.age);
return 0;
@ -2692,7 +2693,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{
rtk->sol.age = static_cast<float>(timediff(obs[0].time, obs[nu].time));
if (fabs(rtk->sol.age) > opt->maxtdiff)
if (std::fabs(rtk->sol.age) > opt->maxtdiff)
{
errmsg(rtk, "age of differential error (age=%.1f)\n", rtk->sol.age);
outsolstat(rtk);

View File

@ -110,7 +110,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configura
std::string default_device_name = "/dev/uio13";
std::string device_name = configuration->property(role + ".devicename", default_device_name);
int switch_position = configuration->property(role + ".switch_position", 0);
switch_fpga = std::make_shared<fpga_switch>(device_name);
switch_fpga = std::make_shared<Fpga_Switch>(device_name);
switch_fpga->set_switch_position(switch_position);
if (in_stream_ > 0)
{

View File

@ -114,7 +114,7 @@ private:
boost::shared_ptr<gr::msg_queue> queue_;
std::shared_ptr<fpga_switch> switch_fpga;
std::shared_ptr<Fpga_Switch> switch_fpga;
};
#endif /*GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_*/

View File

@ -72,7 +72,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configurati
// output item size is always gr_complex
item_size_ = sizeof(gr_complex);
udp_gnss_rx_source_ = gr_complex_ip_packet_source::make(capture_device,
udp_gnss_rx_source_ = Gr_Complex_Ip_Packet_Source::make(capture_device,
address,
port,
payload_bytes,

View File

@ -97,7 +97,7 @@ private:
bool dump_;
std::string dump_filename_;
std::vector<boost::shared_ptr<gr::block>> null_sinks_;
gr_complex_ip_packet_source::sptr udp_gnss_rx_source_;
Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
std::vector<boost::shared_ptr<gr::block>> file_sink_;
boost::shared_ptr<gr::msg_queue> queue_;
};

View File

@ -75,8 +75,8 @@ typedef struct gr_udp_header
} gr_udp_header;
gr_complex_ip_packet_source::sptr
gr_complex_ip_packet_source::make(std::string src_device,
Gr_Complex_Ip_Packet_Source::sptr
Gr_Complex_Ip_Packet_Source::make(std::string src_device,
const std::string &origin_address,
int udp_port,
int udp_packet_size,
@ -85,7 +85,7 @@ gr_complex_ip_packet_source::make(std::string src_device,
size_t item_size,
bool IQ_swap_)
{
return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(std::move(src_device),
return gnuradio::get_initial_sptr(new Gr_Complex_Ip_Packet_Source(std::move(src_device),
origin_address,
udp_port,
udp_packet_size,
@ -99,7 +99,7 @@ gr_complex_ip_packet_source::make(std::string src_device,
/*
* The private constructor
*/
gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
Gr_Complex_Ip_Packet_Source::Gr_Complex_Ip_Packet_Source(std::string src_device,
__attribute__((unused)) const std::string &origin_address,
int udp_port,
int udp_packet_size,
@ -151,14 +151,14 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
// Called by gnuradio to enable drivers, etc for i/o devices.
bool gr_complex_ip_packet_source::start()
bool Gr_Complex_Ip_Packet_Source::start()
{
std::cout << "gr_complex_ip_packet_source START\n";
// open the ethernet device
if (open() == true)
{
// start pcap capture thread
d_pcap_thread = new boost::thread(boost::bind(&gr_complex_ip_packet_source::my_pcap_loop_thread, this, descr));
d_pcap_thread = new boost::thread(boost::bind(&Gr_Complex_Ip_Packet_Source::my_pcap_loop_thread, this, descr));
return true;
}
else
@ -169,7 +169,7 @@ bool gr_complex_ip_packet_source::start()
// Called by gnuradio to disable drivers, etc for i/o devices.
bool gr_complex_ip_packet_source::stop()
bool Gr_Complex_Ip_Packet_Source::stop()
{
std::cout << "gr_complex_ip_packet_source STOP\n";
if (descr != nullptr)
@ -182,7 +182,7 @@ bool gr_complex_ip_packet_source::stop()
}
bool gr_complex_ip_packet_source::open()
bool Gr_Complex_Ip_Packet_Source::open()
{
char errbuf[PCAP_ERRBUF_SIZE];
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
@ -219,7 +219,7 @@ bool gr_complex_ip_packet_source::open()
}
gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
Gr_Complex_Ip_Packet_Source::~Gr_Complex_Ip_Packet_Source()
{
if (d_pcap_thread != nullptr)
{
@ -230,15 +230,15 @@ 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,
void Gr_Complex_Ip_Packet_Source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr,
const u_char *packet)
{
auto *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);
}
void gr_complex_ip_packet_source::pcap_callback(__attribute__((unused)) u_char *args, __attribute__((unused)) const struct pcap_pkthdr *pkthdr,
void Gr_Complex_Ip_Packet_Source::pcap_callback(__attribute__((unused)) u_char *args, __attribute__((unused)) const struct pcap_pkthdr *pkthdr,
const u_char *packet)
{
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
@ -312,13 +312,13 @@ void gr_complex_ip_packet_source::pcap_callback(__attribute__((unused)) u_char *
}
void gr_complex_ip_packet_source::my_pcap_loop_thread(pcap_t *pcap_handle)
void Gr_Complex_Ip_Packet_Source::my_pcap_loop_thread(pcap_t *pcap_handle)
{
pcap_loop(pcap_handle, -1, gr_complex_ip_packet_source::static_pcap_callback, reinterpret_cast<u_char *>(this));
pcap_loop(pcap_handle, -1, Gr_Complex_Ip_Packet_Source::static_pcap_callback, reinterpret_cast<u_char *>(this));
}
void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items, int num_samples_readed)
void Gr_Complex_Ip_Packet_Source::demux_samples(gr_vector_void_star output_items, int num_samples_readed)
{
int8_t real;
int8_t imag;
@ -383,7 +383,7 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
}
int gr_complex_ip_packet_source::work(int noutput_items,
int Gr_Complex_Ip_Packet_Source::work(int noutput_items,
__attribute__((unused)) gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{

View File

@ -43,7 +43,7 @@
#include <string>
#include <sys/ioctl.h>
class gr_complex_ip_packet_source : virtual public gr::sync_block
class Gr_Complex_Ip_Packet_Source : virtual public gr::sync_block
{
private:
boost::mutex d_mutex;
@ -82,7 +82,7 @@ private:
static void static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
public:
typedef boost::shared_ptr<gr_complex_ip_packet_source> sptr;
typedef boost::shared_ptr<Gr_Complex_Ip_Packet_Source> sptr;
static sptr make(std::string src_device,
const std::string &origin_address,
int udp_port,
@ -91,7 +91,7 @@ public:
const std::string &wire_sample_type,
size_t item_size,
bool IQ_swap_);
gr_complex_ip_packet_source(std::string src_device,
Gr_Complex_Ip_Packet_Source(std::string src_device,
const std::string &origin_address,
int udp_port,
int udp_packet_size,
@ -99,7 +99,7 @@ public:
const std::string &wire_sample_type,
size_t item_size,
bool IQ_swap_);
~gr_complex_ip_packet_source();
~Gr_Complex_Ip_Packet_Source();
// Where all the action really happens
int work(int noutput_items,

View File

@ -45,7 +45,7 @@
const size_t PAGE_SIZE = 0x10000;
const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA;
fpga_switch::fpga_switch(const std::string &device_name)
Fpga_Switch::Fpga_Switch(const std::string &device_name)
{
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
{
@ -67,7 +67,7 @@ fpga_switch::fpga_switch(const std::string &device_name)
// sanity check : check test register
unsigned writeval = TEST_REGISTER_TRACK_WRITEVAL;
unsigned readval;
readval = fpga_switch::fpga_switch_test_register(writeval);
readval = Fpga_Switch::fpga_switch_test_register(writeval);
if (writeval != readval)
{
LOG(WARNING) << "Test register sanity check failed";
@ -81,19 +81,19 @@ fpga_switch::fpga_switch(const std::string &device_name)
}
fpga_switch::~fpga_switch()
Fpga_Switch::~Fpga_Switch()
{
close_device();
}
void fpga_switch::set_switch_position(int switch_position)
void Fpga_Switch::set_switch_position(int switch_position)
{
d_map_base[0] = switch_position;
}
unsigned fpga_switch::fpga_switch_test_register(
unsigned Fpga_Switch::fpga_switch_test_register(
unsigned writeval)
{
unsigned readval;
@ -106,7 +106,7 @@ unsigned fpga_switch::fpga_switch_test_register(
}
void fpga_switch::close_device()
void Fpga_Switch::close_device()
{
auto *aux = const_cast<unsigned *>(d_map_base);
if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)

View File

@ -41,11 +41,11 @@
#define MAX_LENGTH_DEVICEIO_NAME 50
class fpga_switch
class Fpga_Switch
{
public:
fpga_switch(const std::string& device_name);
~fpga_switch();
Fpga_Switch(const std::string& device_name);
~Fpga_Switch();
void set_switch_position(int switch_position);
private: