diff --git a/.clang-format b/.clang-format index d917fcd0b..7ab3cb079 100644 --- a/.clang-format +++ b/.clang-format @@ -51,9 +51,9 @@ IncludeBlocks: Merge IncludeCategories: - Regex: '^.*.h"' Priority: 1 - - Regex: '^.*(boost|gflags|glog|gtest|gnsssdr|gnuradio|pmt|uhd|volk)/' + - Regex: '^.*(boost|gflags|glog|gnsssdr|gpstk|gtest|gnuradio|pmt|uhd|volk)/' Priority: 2 - - Regex: '^.*(armadillo|matio)' + - Regex: '^.*(armadillo|matio|pugixml)' Priority: 2 - Regex: '.*' Priority: 3 diff --git a/.clang-tidy b/.clang-tidy index 5eb3cab9e..79a8beaa6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,3 +1,3 @@ --- -Checks: '-*,boost-use-to-string,cert-dcl21-cpp,cert-dcl58-cpp,cert-env33-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,clang-analyzer-cplusplus*,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-build-namespaces,google-runtime-int,google-runtime-references,llvm-header-guard,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-static-assert,misc-throw-by-value-catch-by-reference,misc-uniqueptr-reset-release,modernize-deprecated-headers,modernize-loop-convert,modernize-pass-by-value,modernize-raw-string-literal,modernize-use-auto,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-move-const-arg,readability-named-parameter,readability-string-compare' +Checks: '-*,boost-use-to-string,cert-dcl21-cpp,cert-dcl58-cpp,cert-env33-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,clang-analyzer-cplusplus*,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-build-namespaces,google-runtime-int,google-runtime-references,llvm-header-guard,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-static-assert,misc-throw-by-value-catch-by-reference,misc-uniqueptr-reset-release,modernize-deprecated-headers,modernize-loop-convert,modernize-pass-by-value,modernize-raw-string-literal,modernize-use-auto,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-move-const-arg,performance-type-promotion-in-math-fn,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-named-parameter,readability-string-compare' HeaderFilterRegex: '.*' diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index a4f4616e7..6097ce61d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -89,7 +89,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); // acq_parameters.dump_filename = dump_filename_; //--- Find number of samples per spreading code (4 ms) ----------------- - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); + auto code_length = static_cast(std::round(static_cast(fs_in) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); //acq_parameters.samples_per_code = code_length_; //int samples_per_ms = static_cast(std::round(static_cast(fs_in_) * 0.001)); //acq_parameters.samples_per_ms = samples_per_ms; @@ -120,9 +120,9 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // compute all the GALILEO E1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * Galileo_E1_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search @@ -174,7 +174,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index a5764948b..0559ddc7e 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -89,7 +89,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf acq_pilot_ = false; } - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast(Galileo_E5a_CODE_LENGTH_CHIPS))); + auto code_length = static_cast(std::round(static_cast(fs_in) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast(Galileo_E5a_CODE_LENGTH_CHIPS))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. float nbits = ceilf(log2f((float)code_length)); @@ -108,9 +108,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf // compute all the GALILEO E5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * Galileo_E5a_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search @@ -141,7 +141,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 10d5a0551..6ddfa4616 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -74,7 +74,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( acq_parameters.doppler_max = doppler_max_; unsigned int sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1); acq_parameters.sampled_ms = sampled_ms; - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); + auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. float nbits = ceilf(log2f((float)code_length)); @@ -90,10 +90,10 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT + auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT // allocate memory to compute all the PRNs and compute all the possible codes - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) @@ -102,7 +102,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } int offset = 0; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 089c87c9a..c3cd96275 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -104,10 +104,10 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT + auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT // allocate memory to compute all the PRNs and compute all the possible codes - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) @@ -116,7 +116,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index d8f754755..f90c77040 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -89,7 +89,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( //dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); //acq_parameters.dump_filename = dump_filename_; //--- Find number of samples per spreading code ------------------------- - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L5i_CODE_RATE_HZ / static_cast(GPS_L5i_CODE_LENGTH_CHIPS)))); + auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L5i_CODE_RATE_HZ / static_cast(GPS_L5i_CODE_LENGTH_CHIPS)))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. float nbits = ceilf(log2f((float)code_length)); @@ -105,11 +105,11 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( //printf("L5 ACQ CLASS MID 01\n"); // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT + auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT //printf("L5 ACQ CLASS MID 02\n"); - std::complex* code = new gr_complex[vector_length]; + auto* code = new gr_complex[vector_length]; //printf("L5 ACQ CLASS MID 03\n"); - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); //printf("L5 ACQ CLASS MID 04\n"); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 @@ -124,7 +124,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index 8014a7b22..ffb4d2452 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -42,6 +42,7 @@ #include "pcps_acquisition_fpga.h" #include #include +#include #define AQ_DOWNSAMPLING_DELAY 40 // delay due to the downsampling filter in the acquisition @@ -50,7 +51,7 @@ using google::LogMessage; pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_) { - return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_)); + return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(std::move(conf_))); } @@ -61,7 +62,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block( // printf("acq constructor start\n"); this->message_port_register_out(pmt::mp("events")); - acq_parameters = conf_; + acq_parameters = std::move(conf_); d_sample_counter = 0ULL; // SAMPLE COUNTER d_active = false; d_state = 0; @@ -74,7 +75,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block( d_doppler_step = 0U; d_test_statistics = 0.0; d_channel = 0U; - d_gnss_synchro = 0; + d_gnss_synchro = nullptr; //printf("zzzz acq_parameters.code_length = %d\n", acq_parameters.code_length); //printf("zzzz acq_parameters.samples_per_ms = %d\n", acq_parameters.samples_per_ms); @@ -256,7 +257,7 @@ void pcps_acquisition_fpga::set_active(bool active) d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; - d_test_statistics = (d_mag / d_input_power); //* correction_factor; + d_test_statistics = (d_mag / d_input_power); // correction_factor; } // In the case of the FPGA the option of dumping the results of the acquisition to a file is not available diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index fc490a02b..5618d072b 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -40,6 +40,7 @@ #include // libraries used by the GIPO #include #include // libraries used by the GIPO +#include #define PAGE_SIZE 0x10000 // default page size for the multicorrelator memory map @@ -102,7 +103,7 @@ fpga_acquisition::fpga_acquisition(std::string device_name, //printf("AAA- vector_length = %d\n ", vector_length); // initial values - d_device_name = device_name; + d_device_name = std::move(device_name); //d_freq = freq; d_fs_in = fs_in; d_vector_length = vector_length; @@ -121,7 +122,7 @@ fpga_acquisition::fpga_acquisition(std::string device_name, LOG(WARNING) << "Cannot open deviceio" << d_device_name; std::cout << "Acq: cannot open deviceio" << d_device_name << std::endl; } - d_map_base = reinterpret_cast(mmap(NULL, PAGE_SIZE, + d_map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_fd, 0)); if (d_map_base == reinterpret_cast(-1)) @@ -234,7 +235,7 @@ void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps) float phase_step_rad_int_temp; int32_t phase_step_rad_int; //int32_t doppler = static_cast(-d_doppler_max) + d_doppler_step * doppler_index; - int32_t doppler = static_cast(-d_doppler_max); + auto doppler = static_cast(-d_doppler_max); //float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast(d_fs_in); float phase_step_rad = GPS_TWO_PI * (doppler) / static_cast(d_fs_in); // The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing @@ -408,7 +409,7 @@ void fpga_acquisition::unblock_samples() void fpga_acquisition::close_device() { - uint32_t *aux = const_cast(d_map_base); + auto *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { printf("Failed to unmap memory uio\n"); diff --git a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc index 8c1b29617..94eb8e294 100644 --- a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc +++ b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc @@ -33,9 +33,9 @@ #include "gnss_synchro.h" #include #include +#include #include #include // libraries used by the GIPO -#include #include #include #include // libraries used by the GIPO @@ -129,7 +129,7 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__(( // variable number). sample_counter = sample_counter + samples_passed; //samples_per_output; - Gnss_Synchro *out = reinterpret_cast(output_items[0]); + auto *out = reinterpret_cast(output_items[0]); out[0] = Gnss_Synchro(); out[0].Flag_valid_symbol_output = false; out[0].Flag_valid_word = false; @@ -236,7 +236,7 @@ void gnss_sdr_fpga_sample_counter::open_device() LOG(WARNING) << "Cannot open deviceio" << device_name; std::cout << "Counter-Intr: cannot open deviceio" << device_name << std::endl; } - map_base = reinterpret_cast(mmap(NULL, PAGE_SIZE, + map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)); if (map_base == reinterpret_cast(-1)) @@ -265,7 +265,7 @@ void gnss_sdr_fpga_sample_counter::close_device() //printf("=========================================== NOW closing device ...\n"); map_base[2] = 0; // disable the generation of the interrupt in the device - uint32_t *aux = const_cast(map_base); + auto *aux = const_cast(map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { printf("Failed to unmap memory uio\n"); diff --git a/src/algorithms/libs/gnss_sdr_time_counter.cc b/src/algorithms/libs/gnss_sdr_time_counter.cc index 59a0b4782..0cd06517b 100644 --- a/src/algorithms/libs/gnss_sdr_time_counter.cc +++ b/src/algorithms/libs/gnss_sdr_time_counter.cc @@ -63,8 +63,8 @@ gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter() int gnss_sdr_time_counter::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_void_star &output_items) { - Gnss_Synchro *out = reinterpret_cast(output_items[0]); - const Gnss_Synchro *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); out[0] = in[0]; if ((current_T_rx_ms % report_interval_ms) == 0) { diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 83c8d85ff..a9cade7c5 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -38,6 +38,7 @@ #include #include #include // for cout, endl +#include #ifdef __APPLE__ #include @@ -46,8 +47,8 @@ #endif Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + const std::string& role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr 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"; diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index 0f1287664..79ebeff3e 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -45,7 +45,7 @@ class Ad9361FpgaSignalSource : public GNSSBlockInterface { public: Ad9361FpgaSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); ~Ad9361FpgaSignalSource(); diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index 0be972168..c94859709 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -36,14 +36,15 @@ #include #include #include +#include using google::LogMessage; CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + const std::string& role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr 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) diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h index 325f4ab6d..bec7c3d73 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h @@ -54,7 +54,7 @@ class CustomUDPSignalSource : public GNSSBlockInterface { public: CustomUDPSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~CustomUDPSignalSource(); diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index 6256e330f..8f3f5fa82 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -38,13 +38,14 @@ #include #include #include +#include using google::LogMessage; Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + const std::string& role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr 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) { diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h index 2601d155f..820ce1a14 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -46,7 +46,7 @@ class Fmcomms2SignalSource : public GNSSBlockInterface { public: Fmcomms2SignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~Fmcomms2SignalSource(); diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 71c5eb690..1aab48cff 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -37,14 +37,15 @@ #include #include #include +#include using google::LogMessage; OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + const std::string& role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr 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() diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h index 04a60dd50..7a820f8fd 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h @@ -52,7 +52,7 @@ class OsmosdrSignalSource : public GNSSBlockInterface { public: OsmosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~OsmosdrSignalSource(); diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index def81d2c7..6465b72bd 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -34,14 +34,15 @@ #include "gnss_sdr_valve.h" #include #include +#include using google::LogMessage; PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + const std::string& role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr 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) diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h index 178604257..4cedb3787 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -48,7 +48,7 @@ class PlutosdrSignalSource : public GNSSBlockInterface { public: PlutosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~PlutosdrSignalSource(); diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index 034d2b488..c741dc19a 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -32,6 +32,7 @@ #include "gr_complex_ip_packet_source.h" #include +#include const int FIFO_SIZE = 1472000; @@ -76,15 +77,15 @@ typedef struct gr_udp_header gr_complex_ip_packet_source::sptr gr_complex_ip_packet_source::make(std::string src_device, - std::string origin_address, + const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_) { - return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(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,11 +100,11 @@ 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, - __attribute__((unused)) std::string origin_address, + __attribute__((unused)) const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_) : gr::sync_block("gr_complex_ip_packet_source", @@ -113,12 +114,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; @@ -129,7 +130,7 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, exit(0); } std::cout << "d_wire_sample_type:" << d_wire_sample_type << std::endl; - d_src_device = src_device; + d_src_device = std::move(src_device); d_udp_port = udp_port; d_udp_payload_size = udp_packet_size; d_fifo_full = false; @@ -142,8 +143,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(&si_me), 0, sizeof(si_me)); } @@ -171,7 +172,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 +188,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 +221,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 +233,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(args); + auto *bridge = reinterpret_cast(args); bridge->pcap_callback(args, pkthdr, packet); } @@ -327,22 +328,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(output_items[i])[n] = gr_complex(real, imag); + static_cast(output_item)[n] = gr_complex(real, imag); } else { - static_cast(output_items[i])[n] = gr_complex(imag, real); + static_cast(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 +366,11 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items } if (d_IQ_swap) { - static_cast(output_items[i])[n] = gr_complex(imag, real); + static_cast(output_item)[n] = gr_complex(imag, real); } else { - static_cast(output_items[i])[n] = gr_complex(real, imag); + static_cast(output_item)[n] = gr_complex(real, imag); } } break; diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h index 345399730..2417534f7 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h @@ -84,19 +84,19 @@ private: public: typedef boost::shared_ptr sptr; static sptr make(std::string src_device, - std::string origin_address, + const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_); gr_complex_ip_packet_source(std::string src_device, - std::string origin_address, + const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_); ~gr_complex_ip_packet_source(); diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 7c9c9f3c9..e4d4b6db0 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -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"<(d_map_base); + auto *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { std::cout << "Failed to unmap memory uio" << std::endl; diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index f4a755775..ce3dff3ad 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -44,7 +44,7 @@ class fpga_switch { public: - fpga_switch(std::string device_name); + fpga_switch(const std::string& device_name); ~fpga_switch(); void set_switch_position(int switch_position); diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index 355c0af21..31d2cbfff 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -51,7 +51,7 @@ void GalileoE1DllPllVemlTrackingFpga::stop_tracking() } GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //dllpllconf_t trk_param; diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h index d996cae0a..794aa22d4 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h @@ -52,7 +52,7 @@ class GalileoE1DllPllVemlTrackingFpga : public TrackingInterface { public: GalileoE1DllPllVemlTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index 68e510381..1a5e1cf09 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -51,7 +51,7 @@ void GalileoE5aDllPllTrackingFpga::stop_tracking() } GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( - ConfigurationInterface *configuration, std::string role, + ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //printf("creating the E5A tracking"); @@ -136,9 +136,9 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( //################# PRE-COMPUTE ALL THE CODES ################# unsigned int code_samples_per_chip = 1; - unsigned int code_length_chips = static_cast(Galileo_E5a_CODE_LENGTH_CHIPS); + auto code_length_chips = static_cast(Galileo_E5a_CODE_LENGTH_CHIPS); - gr_complex *aux_code = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex) * code_length_chips * code_samples_per_chip, volk_gnsssdr_get_alignment())); + auto *aux_code = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex) * code_length_chips * code_samples_per_chip, volk_gnsssdr_get_alignment())); float *tracking_code; float *data_code; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h index 5edb90727..49c52de5e 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h @@ -52,7 +52,7 @@ class GalileoE5aDllPllTrackingFpga : public TrackingInterface { public: GalileoE5aDllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index 2434e82a4..e81e7a905 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -53,7 +53,7 @@ void GpsL1CaDllPllTrackingFpga::stop_tracking() } GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga(); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h index 5fcaa5144..5cc38f230 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h @@ -53,7 +53,7 @@ class GpsL1CaDllPllTrackingFpga : public TrackingInterface { public: GpsL1CaDllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index a79f5603d..c133b1ea1 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -52,7 +52,7 @@ void GpsL2MDllPllTrackingFpga::stop_tracking() } GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //dllpllconf_t trk_param; @@ -125,7 +125,7 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( //d_tracking_code = static_cast(volk_gnsssdr_malloc(2 * static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment())); d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * NUM_PRNs * sizeof(int), volk_gnsssdr_get_alignment())); - float* ca_codes_f = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment())); + auto* ca_codes_f = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment())); //################# PRE-COMPUTE ALL THE CODES ################# d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment())); @@ -167,9 +167,7 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( } -GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga() -{ -} +GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga() = default; void GpsL2MDllPllTrackingFpga::start_tracking() diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h index 2cde19cd7..7d36d1e74 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h @@ -52,7 +52,7 @@ class GpsL2MDllPllTrackingFpga : public TrackingInterface { public: GpsL2MDllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index cfb75786a..effa0c5b7 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -52,7 +52,7 @@ void GpsL5DllPllTrackingFpga::stop_tracking() } GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( - ConfigurationInterface *configuration, std::string role, + ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //printf("L5 TRK CLASS CREATED\n"); @@ -136,7 +136,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( //################# PRE-COMPUTE ALL THE CODES ################# unsigned int code_samples_per_chip = 1; - unsigned int code_length_chips = static_cast(GPS_L5i_CODE_LENGTH_CHIPS); + auto code_length_chips = static_cast(GPS_L5i_CODE_LENGTH_CHIPS); //printf("TRK code_length_chips = %d\n", code_length_chips); float *tracking_code; diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h index 2c3f35ef8..087f3730c 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h @@ -50,7 +50,7 @@ class GpsL5DllPllTrackingFpga : public TrackingInterface { public: GpsL5DllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 418dde9de..b683e6a15 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -103,7 +103,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & if (trk_parameters.system == 'G') { systemName = "GPS"; - if (signal_type.compare("1C") == 0) + if (signal_type == "1C") { d_signal_carrier_freq = GPS_L1_FREQ_HZ; d_code_period = GPS_L1_CA_CODE_PERIOD; @@ -124,11 +124,11 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & // preamble bits to sampled symbols d_gps_l1ca_preambles_symbols = static_cast(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment())); int32_t n = 0; - for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++) + for (unsigned short preambles_bit : preambles_bits) { for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++) { - if (preambles_bits[i] == 1) + if (preambles_bit == 1) { d_gps_l1ca_preambles_symbols[n] = 1; } @@ -142,7 +142,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_symbol_history.resize(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); // Change fixed buffer size d_symbol_history.clear(); // Clear all the elements in the buffer } - else if (signal_type.compare("2S") == 0) + else if (signal_type == "2S") { d_signal_carrier_freq = GPS_L2_FREQ_HZ; d_code_period = GPS_L2_M_PERIOD; @@ -156,7 +156,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & trk_parameters.track_pilot = false; interchange_iq = false; } - else if (signal_type.compare("L5") == 0) + else if (signal_type == "L5") { d_signal_carrier_freq = GPS_L5_FREQ_HZ; d_code_period = GPS_L5i_PERIOD; @@ -199,7 +199,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & else if (trk_parameters.system == 'E') { systemName = "Galileo"; - if (signal_type.compare("1B") == 0) + if (signal_type == "1B") { d_signal_carrier_freq = Galileo_E1_FREQ_HZ; d_code_period = Galileo_E1_CODE_PERIOD; @@ -223,7 +223,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & } interchange_iq = false; // Note that E1-B and E1-C are in anti-phase, NOT IN QUADRATURE. See Galileo ICD. } - else if (signal_type.compare("5X") == 0) + else if (signal_type == "5X") { d_signal_carrier_freq = Galileo_E5a_FREQ_HZ; d_code_period = GALILEO_E5a_CODE_PERIOD; @@ -428,10 +428,10 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & { d_dump_filename = trk_parameters.dump_filename; std::string dump_path; - if (d_dump_filename.find_last_of("/") != std::string::npos) + if (d_dump_filename.find_last_of('/') != std::string::npos) { - std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1); - dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/")); + std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); + dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); d_dump_filename = dump_filename_; } else @@ -443,9 +443,9 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_dump_filename = "trk_channel_"; } // remove extension if any - if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos) + if (d_dump_filename.substr(1).find_last_of('.') != std::string::npos) { - d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of(".")); + d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.')); } d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename; @@ -501,15 +501,15 @@ void dll_pll_veml_tracking_fpga::start_tracking() d_carrier_loop_filter.initialize(); // initialize the carrier filter d_code_loop_filter.initialize(); // initialize the code filter - if (systemName.compare("GPS") == 0 and signal_type.compare("1C") == 0) + if (systemName == "GPS" and signal_type == "1C") { // nothing to compute : the local codes are pre-computed in the adapter class } - else if (systemName.compare("GPS") == 0 and signal_type.compare("2S") == 0) + else if (systemName == "GPS" and signal_type == "2S") { // nothing to compute : the local codes are pre-computed in the adapter class } - else if (systemName.compare("GPS") == 0 and signal_type.compare("L5") == 0) + else if (systemName == "GPS" and signal_type == "L5") { if (trk_parameters.track_pilot) { @@ -520,7 +520,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() // nothing to compute : the local codes are pre-computed in the adapter class } } - else if (systemName.compare("Galileo") == 0 and signal_type.compare("1B") == 0) + else if (systemName == "Galileo" and signal_type == "1B") { if (trk_parameters.track_pilot) { @@ -533,7 +533,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() // nothing to compute : the local codes are pre-computed in the adapter class } } - else if (systemName.compare("Galileo") == 0 and signal_type.compare("5X") == 0) + else if (systemName == "Galileo" and signal_type == "5X") { if (trk_parameters.track_pilot) { @@ -604,7 +604,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga() { - if (signal_type.compare("1C") == 0) + if (signal_type == "1C") { volk_gnsssdr_free(d_gps_l1ca_preambles_symbols); } @@ -1025,26 +1025,26 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() { return 1; } - float *abs_VE = new float[num_epoch]; - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = new float[num_epoch]; - float *abs_VL = new float[num_epoch]; - float *Prompt_I = new float[num_epoch]; - float *Prompt_Q = new float[num_epoch]; - uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; - float *acc_carrier_phase_rad = new float[num_epoch]; - float *carrier_doppler_hz = new float[num_epoch]; - float *code_freq_chips = new float[num_epoch]; - float *carr_error_hz = new float[num_epoch]; - float *carr_error_filt_hz = new float[num_epoch]; - float *code_error_chips = new float[num_epoch]; - float *code_error_filt_chips = new float[num_epoch]; - float *CN0_SNV_dB_Hz = new float[num_epoch]; - float *carrier_lock_test = new float[num_epoch]; - float *aux1 = new float[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_VE = new float[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = new float[num_epoch]; + auto *abs_VL = new float[num_epoch]; + auto *Prompt_I = new float[num_epoch]; + auto *Prompt_Q = new float[num_epoch]; + auto *PRN_start_sample_count = new uint64_t[num_epoch]; + auto *acc_carrier_phase_rad = new float[num_epoch]; + auto *carrier_doppler_hz = new float[num_epoch]; + auto *code_freq_chips = new float[num_epoch]; + auto *carr_error_hz = new float[num_epoch]; + auto *carr_error_filt_hz = new float[num_epoch]; + auto *code_error_chips = new float[num_epoch]; + auto *code_error_filt_chips = new float[num_epoch]; + auto *CN0_SNV_dB_Hz = new float[num_epoch]; + auto *carrier_lock_test = new float[num_epoch]; + auto *aux1 = new float[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -1108,8 +1108,8 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() std::string filename = dump_filename_; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); @@ -1264,7 +1264,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un { gr::thread::scoped_lock l(d_setlock); // Block input data and block output stream pointers - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -1297,7 +1297,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un //printf("333333 d_correlation_length_samples = %d\n", d_correlation_length_samples); uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples) / d_correlation_length_samples); //printf("333333 num_frames = %d\n", num_frames); - uint64_t absolute_samples_offset = static_cast(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples); + auto absolute_samples_offset = static_cast(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples); //printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset); multicorrelator_fpga->set_initial_sample(absolute_samples_offset); d_absolute_samples_offset = absolute_samples_offset; diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index 38118dff2..add36b0a8 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -41,20 +41,20 @@ #include // libraries used by DMA test code and GIPO test code -#include +#include +#include #include -#include #include // libraries used by DMA test code -#include -#include +#include +#include #include #include // libraries used by GPIO test code -#include -#include +#include +#include #include // logging @@ -62,6 +62,7 @@ // string manipulation #include +#include // constants #include "GPS_L1_CA.h" @@ -160,7 +161,7 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int32_t n_correlators, { //printf("tracking fpga class created\n"); d_n_correlators = n_correlators; - d_device_name = device_name; + d_device_name = std::move(device_name); d_device_base = device_base; d_track_pilot = track_pilot; d_device_descriptor = 0; @@ -345,7 +346,7 @@ void fpga_multicorrelator_8sc::set_channel(uint32_t channel) // std::cout << "deviceio" << device_io_name << " opened successfully" << std::endl; // // } - d_map_base = reinterpret_cast(mmap(NULL, PAGE_SIZE, + d_map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0)); if (d_map_base == reinterpret_cast(-1)) @@ -709,7 +710,7 @@ void fpga_multicorrelator_8sc::unlock_channel(void) void fpga_multicorrelator_8sc::close_device() { - uint32_t *aux = const_cast(d_map_base); + auto *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { printf("Failed to unmap memory uio\n"); diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index f09b02a96..46b0b0031 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -32,8 +32,8 @@ */ #include "gnss_sdr_supl_client.h" -#include #include +#include #include gnss_sdr_supl_client::gnss_sdr_supl_client() diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index a295ba018..a9ab20e54 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -67,6 +67,7 @@ #include #include #include +#include extern concurrent_map global_gps_acq_assist_map; @@ -294,14 +295,14 @@ int ControlThread::run() } -void ControlThread::set_control_queue(gr::msg_queue::sptr control_queue) +void ControlThread::set_control_queue(const gr::msg_queue::sptr& control_queue) { if (flowgraph_->running()) { LOG(WARNING) << "Unable to set control queue while flowgraph is running"; return; } - control_queue_ = control_queue; + control_queue_ = std::move(control_queue); cmd_interface_.set_msg_queue(control_queue_); } diff --git a/src/core/receiver/control_thread.h b/src/core/receiver/control_thread.h index f44ee7963..b500e43fa 100644 --- a/src/core/receiver/control_thread.h +++ b/src/core/receiver/control_thread.h @@ -93,7 +93,7 @@ public: * * \param[in] boost::shared_ptr control_queue */ - void set_control_queue(gr::msg_queue::sptr control_queue); + void set_control_queue(const gr::msg_queue::sptr& control_queue); unsigned int processed_control_messages() diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index c10fdc53b..08d47a376 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef GR_GREATER_38 #include #else @@ -61,12 +62,12 @@ using google::LogMessage; -GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, gr::msg_queue::sptr queue) +GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, const gr::msg_queue::sptr& queue) { connected_ = false; running_ = false; configuration_ = configuration; - queue_ = queue; + queue_ = std::move(queue); init(); } diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 71b52dd6f..929243939 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -73,7 +73,7 @@ public: /*! * \brief Constructor that initializes the receiver flow graph */ - GNSSFlowgraph(std::shared_ptr configuration, gr::msg_queue::sptr queue); + GNSSFlowgraph(std::shared_ptr configuration, const gr::msg_queue::sptr& queue); /*! * \brief Destructor diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 202f31306..b719dba55 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -837,7 +837,7 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) { boost::filesystem::path p(gnuplot_executable); boost::filesystem::path dir = p.parent_path(); - std::string gnuplot_path = dir.native(); + const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("points"); diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 24759c828..feccb8105 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -70,15 +70,15 @@ #include #include #include -#include -#include -#include -#include #include #include #include #include #include +#include +#include +#include +#include #include #ifdef GR_GREATER_38 #include diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 3f8cb2923..ffaeffc76 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -54,10 +54,11 @@ #include #include #include +#include // FPGA read input file #include #include -#include // FPGA read input file #include +#include #ifdef GR_GREATER_38 #include #else @@ -69,7 +70,7 @@ #define FIVE_SECONDS 5000000 // five seconds in microseconds void send_tracking_gps_input_samples(FILE *rx_signal_file, - int num_remaining_samples, gr::top_block_sptr top_block) + int num_remaining_samples, const gr::top_block_sptr& top_block) { int num_samples_transferred = 0; // number of samples that have been transferred to the DMA so far static int flowgraph_stopped = 0; // flag to indicate if the flowgraph is stopped already @@ -142,7 +143,7 @@ void sending_thread(gr::top_block_sptr top_block, const char *file_name) usleep(FIVE_SECONDS); // wait for some time to give time to the other thread to program the device //send_tracking_gps_input_samples(dma_descr, rx_signal_file, file_length); - send_tracking_gps_input_samples(rx_signal_file, file_length, top_block); + send_tracking_gps_input_samples(rx_signal_file, file_length, std::move(top_block)); fclose(rx_signal_file); } @@ -151,7 +152,7 @@ void sending_thread(gr::top_block_sptr top_block, const char *file_name) // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CADllPllTrackingTestFpga_msg_rx; -typedef boost::shared_ptr GpsL1CADllPllTrackingTestFpga_msg_rx_sptr; +using GpsL1CADllPllTrackingTestFpga_msg_rx_sptr = boost::shared_ptr; GpsL1CADllPllTrackingTestFpga_msg_rx_sptr GpsL1CADllPllTrackingTestFpga_msg_rx_make(); @@ -180,7 +181,7 @@ void GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg) { try { - int64_t message = pmt::to_long(msg); + int64_t message = pmt::to_long(std::move(msg)); rx_message = message; } catch (boost::bad_any_cast &e) @@ -204,9 +205,7 @@ GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : g } -GpsL1CADllPllTrackingTestFpga_msg_rx::~GpsL1CADllPllTrackingTestFpga_msg_rx() -{ -} +GpsL1CADllPllTrackingTestFpga_msg_rx::~GpsL1CADllPllTrackingTestFpga_msg_rx() = default; // ########################################################### @@ -243,9 +242,7 @@ public: gnss_synchro = Gnss_Synchro(); } - ~GpsL1CADllPllTrackingTestFpga() - { - } + ~GpsL1CADllPllTrackingTestFpga() = default; void configure_receiver(); @@ -283,7 +280,7 @@ int GpsL1CADllPllTrackingTestFpga::generate_signal() int child_status; char *const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], - &p4[0], &p5[0], NULL}; + &p4[0], &p5[0], nullptr}; int pid; if ((pid = fork()) == -1) diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index 6dca86d30..c26b128dc 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -42,10 +42,10 @@ #include #include #include -#include #include #include #include +#include #include