diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index 67301faf9..4a52770c9 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -877,11 +877,9 @@ bool rtklib_pvt_cc::save_gnss_synchro_map_xml(const std::string& file_name) } return true; } - else - { - LOG(WARNING) << "Failed to save gnss_synchro, map is empty"; - return false; - } + + LOG(WARNING) << "Failed to save gnss_synchro, map is empty"; + return false; } @@ -925,10 +923,8 @@ bool rtklib_pvt_cc::get_latest_PVT(double* longitude_deg, return true; } - else - { - return false; - } + + return false; } diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index cd306531a..25a4c592a 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -80,8 +80,7 @@ else() ) endif() -target_link_libraries( - pvt_lib +target_link_libraries(pvt_lib rtklib_lib gnss_sdr_flags gnss_sp_libs diff --git a/src/algorithms/PVT/libs/geojson_printer.cc b/src/algorithms/PVT/libs/geojson_printer.cc index 0e1091b98..7f4da17c1 100644 --- a/src/algorithms/PVT/libs/geojson_printer.cc +++ b/src/algorithms/PVT/libs/geojson_printer.cc @@ -149,19 +149,15 @@ bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_nam geojson_file << " \"properties\": {" << std::endl; geojson_file << R"( "name": "Locations generated by GNSS-SDR" )" << std::endl; geojson_file << " }," << std::endl; - - geojson_file << " \"geometry\": {" << std::endl; geojson_file << R"( "type": "MultiPoint",)" << std::endl; geojson_file << " \"coordinates\": [" << std::endl; return true; } - else - { - std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl; - return false; - } + + std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl; + return false; } @@ -200,10 +196,7 @@ bool GeoJSON_Printer::print_position(const std::shared_ptr& positi } return true; } - else - { - return false; - } + return false; } @@ -222,11 +215,7 @@ bool GeoJSON_Printer::close_file() { if (remove(filename_.c_str()) != 0) LOG(INFO) << "Error deleting temporary file"; } - return true; } - else - { - return false; - } + return false; } diff --git a/src/algorithms/PVT/libs/gpx_printer.cc b/src/algorithms/PVT/libs/gpx_printer.cc index 78e7ecda1..7ca86052a 100644 --- a/src/algorithms/PVT/libs/gpx_printer.cc +++ b/src/algorithms/PVT/libs/gpx_printer.cc @@ -149,11 +149,8 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name) << indent << indent << "" << std::endl; return true; } - else - { - std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl; - return false; - } + std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl; + return false; } @@ -201,10 +198,7 @@ bool Gpx_Printer::print_position(const std::shared_ptr& position, << "" << std::endl; return true; } - else - { - return false; - } + return false; } @@ -218,10 +212,7 @@ bool Gpx_Printer::close_file() gpx_file.close(); return true; } - else - { - return false; - } + return false; } diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index e0892562b..76018ba35 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -206,11 +206,8 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name) return true; } - else - { - std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl; - return false; - } + std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl; + return false; } @@ -282,10 +279,7 @@ bool Kml_Printer::print_position(const std::shared_ptr& position, return true; } - else - { - return false; - } + return false; } @@ -319,10 +313,7 @@ bool Kml_Printer::close_file() return true; } - else - { - return false; - } + return false; } diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index 350e57608..89fd17b46 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -46,7 +46,7 @@ using google::LogMessage; -Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, std::string rtcm_dump_devname, bool time_tag_name, const std::string& base_path) +Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_devname, bool time_tag_name, const std::string& base_path) { boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time(); tm timeinfo = boost::posix_time::to_tm(pt); diff --git a/src/algorithms/PVT/libs/rtcm_printer.h b/src/algorithms/PVT/libs/rtcm_printer.h index 9e3b9cf7c..883826800 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.h +++ b/src/algorithms/PVT/libs/rtcm_printer.h @@ -48,7 +48,7 @@ public: /*! * \brief Default constructor. */ - Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, std::string rtcm_dump_filename, bool time_tag_name = true, const std::string& base_path = "."); + Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_filename, bool time_tag_name = true, const std::string& base_path = "."); /*! * \brief Default destructor. diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 7cdcacf14..26c3e42fb 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -203,10 +203,7 @@ signed int GalileoE1Pcps8msAmbiguousAcquisition::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index 791aad2e3..22262ca2b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -334,7 +334,7 @@ gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block() { return acquisition_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return acquisition_; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 809924e89..d0e16de1f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -206,10 +206,7 @@ signed int GalileoE1PcpsCccwsrAmbiguousAcquisition::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index ab87e5f79..ecc243de0 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -237,10 +237,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 7843078f0..db77547a5 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -207,10 +207,7 @@ signed int GalileoE1PcpsTongAmbiguousAcquisition::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index c2841157e..d9fe2ac69 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -213,10 +213,7 @@ signed int GalileoE5aNoncoherentIQAcquisitionCaf::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc index 42f6cb3f3..9f9cb22d6 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -319,7 +319,7 @@ gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_left_block() { return acquisition_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return acquisition_; } diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc index fac80f39e..ef6a7dcf1 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc @@ -318,7 +318,7 @@ gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_left_block() { return acquisition_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return acquisition_; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 991ae7880..2af325c52 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -307,7 +307,7 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block() { return acquisition_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return acquisition_; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index 56bcee3a2..8a4774f7b 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -231,10 +231,7 @@ signed int GpsL1CaPcpsQuickSyncAcquisition::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index cf3a0c61f..7663d76ca 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -193,10 +193,7 @@ signed int GpsL1CaPcpsTongAcquisition::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index 9f1fa5e2e..acf415635 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -321,7 +321,7 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block() { return acquisition_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return acquisition_; } diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index c9ee6bc4c..16066ebaa 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -309,7 +309,7 @@ gr::basic_block_sptr GpsL5iPcpsAcquisition::get_left_block() { return acquisition_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return acquisition_; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 156134a77..224a873e6 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -268,7 +268,7 @@ bool pcps_acquisition::is_fdma() LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; return true; } - else if (strcmp(d_gnss_synchro->Signal, "2G") == 0) + if (strcmp(d_gnss_synchro->Signal, "2G") == 0) { d_old_freq += DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN); LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; diff --git a/src/algorithms/channel/libs/channel_fsm.cc b/src/algorithms/channel/libs/channel_fsm.cc index ad6ed9e3a..968ea2393 100644 --- a/src/algorithms/channel/libs/channel_fsm.cc +++ b/src/algorithms/channel/libs/channel_fsm.cc @@ -81,13 +81,10 @@ bool ChannelFsm::Event_start_acquisition() { return false; } - else - { - d_state = 1; - start_acquisition(); - DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition"; - return true; - } + d_state = 1; + start_acquisition(); + DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition"; + return true; } @@ -98,13 +95,10 @@ bool ChannelFsm::Event_valid_acquisition() { return false; } - else - { - d_state = 2; - start_tracking(); - DLOG(INFO) << "CH = " << channel_ << ". Ev valid acquisition"; - return true; - } + d_state = 2; + start_tracking(); + DLOG(INFO) << "CH = " << channel_ << ". Ev valid acquisition"; + return true; } @@ -115,13 +109,10 @@ bool ChannelFsm::Event_failed_acquisition_repeat() { return false; } - else - { - d_state = 1; - start_acquisition(); - DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition repeat"; - return true; - } + d_state = 1; + start_acquisition(); + DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition repeat"; + return true; } @@ -132,13 +123,10 @@ bool ChannelFsm::Event_failed_acquisition_no_repeat() { return false; } - else - { - d_state = 3; - request_satellite(); - DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition no repeat"; - return true; - } + d_state = 3; + request_satellite(); + DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition no repeat"; + return true; } @@ -149,13 +137,10 @@ bool ChannelFsm::Event_failed_tracking_standby() { return false; } - else - { - d_state = 0U; - notify_stop_tracking(); - DLOG(INFO) << "CH = " << channel_ << ". Ev failed tracking standby"; - return true; - } + d_state = 0U; + notify_stop_tracking(); + DLOG(INFO) << "CH = " << channel_ << ". Ev failed tracking standby"; + return true; } diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index 4d773eb7e..5cfbd4186 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -144,8 +144,5 @@ gr::basic_block_sptr IbyteToCbyte::get_right_block() { return conjugate_ic_; } - else - { - return ibyte_to_cbyte_; - } + return ibyte_to_cbyte_; } diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index 6e448d536..cd8c14850 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -142,8 +142,5 @@ gr::basic_block_sptr IbyteToComplex::get_right_block() { return conjugate_cc_; } - else - { - return gr_interleaved_char_to_complex_; - } + return gr_interleaved_char_to_complex_; } diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index ea2580c25..f4c8b6207 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -141,8 +141,5 @@ gr::basic_block_sptr IbyteToCshort::get_right_block() { return conjugate_sc_; } - else - { - return interleaved_byte_to_complex_short_; - } + return interleaved_byte_to_complex_short_; } diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index 54cea92b3..918dbd8a3 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -142,8 +142,5 @@ gr::basic_block_sptr IshortToComplex::get_right_block() { return conjugate_cc_; } - else - { - return gr_interleaved_short_to_complex_; - } + return gr_interleaved_short_to_complex_; } diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index a6d07ab21..c6a7d7490 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -144,8 +144,5 @@ gr::basic_block_sptr IshortToCshort::get_right_block() { return conjugate_sc_; } - else - { - return interleaved_short_to_complex_short_; - } + return interleaved_short_to_complex_short_; } diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index 3537ab0da..b09ab9af0 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -31,7 +31,6 @@ #include "fir_filter.h" #include "configuration_interface.h" -#include #include #include #include @@ -284,7 +283,7 @@ gr::basic_block_sptr FirFilter::get_left_block() { return fir_filter_ccf_; } - else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) + if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) { return cshort_to_float_x2_; } @@ -314,7 +313,7 @@ gr::basic_block_sptr FirFilter::get_right_block() { return fir_filter_ccf_; } - else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) + if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) { return short_x2_to_cshort_; } @@ -369,23 +368,23 @@ void FirFilter::init() double option_value; for (unsigned int i = 0; i < number_of_bands; i++) { - option = ".band" + boost::lexical_cast(i + 1) + "_begin"; + option = ".band" + std::to_string(i + 1) + "_begin"; option_value = config_->property(role_ + option, default_bands[i]); bands.push_back(option_value); - option = ".band" + boost::lexical_cast(i + 1) + "_end"; + option = ".band" + std::to_string(i + 1) + "_end"; option_value = config_->property(role_ + option, default_bands[i]); bands.push_back(option_value); - option = ".ampl" + boost::lexical_cast(i + 1) + "_begin"; + option = ".ampl" + std::to_string(i + 1) + "_begin"; option_value = config_->property(role_ + option, default_bands[i]); ampl.push_back(option_value); - option = ".ampl" + boost::lexical_cast(i + 1) + "_end"; + option = ".ampl" + std::to_string(i + 1) + "_end"; option_value = config_->property(role_ + option, default_bands[i]); ampl.push_back(option_value); - option = ".band" + boost::lexical_cast(i + 1) + "_error"; + option = ".band" + std::to_string(i + 1) + "_error"; option_value = config_->property(role_ + option, default_bands[i]); error_w.push_back(option_value); } @@ -399,7 +398,7 @@ void FirFilter::init() // those bands, and the weight given to the error in those bands. std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); taps_.reserve(taps_d.size()); - for (double & it : taps_d) + for (double& it : taps_d) { taps_.push_back(float(it)); } diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index ba2a30899..f430edbfd 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -31,7 +31,6 @@ #include "freq_xlating_fir_filter.h" #include "configuration_interface.h" -#include #include #include #include @@ -84,23 +83,23 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration for (unsigned int i = 0; i < number_of_bands; i++) { - option = ".band" + boost::lexical_cast(i + 1) + "_begin"; + option = ".band" + std::to_string(i + 1) + "_begin"; option_value = config_->property(role_ + option, default_bands[i]); bands.push_back(option_value); - option = ".band" + boost::lexical_cast(i + 1) + "_end"; + option = ".band" + std::to_string(i + 1) + "_end"; option_value = config_->property(role_ + option, default_bands[i]); bands.push_back(option_value); - option = ".ampl" + boost::lexical_cast(i + 1) + "_begin"; + option = ".ampl" + std::to_string(i + 1) + "_begin"; option_value = config_->property(role_ + option, default_bands[i]); ampl.push_back(option_value); - option = ".ampl" + boost::lexical_cast(i + 1) + "_end"; + option = ".ampl" + std::to_string(i + 1) + "_end"; option_value = config_->property(role_ + option, default_bands[i]); ampl.push_back(option_value); - option = ".band" + boost::lexical_cast(i + 1) + "_error"; + option = ".band" + std::to_string(i + 1) + "_error"; option_value = config_->property(role_ + option, default_bands[i]); error_w.push_back(option_value); } @@ -108,7 +107,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration int grid_density = config_->property(role_ + ".grid_density", default_grid_density); taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); taps_.reserve(taps_d.size()); - for (double & it : taps_d) + for (double& it : taps_d) { taps_.push_back(static_cast(it)); } @@ -324,7 +323,7 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_left_block() { return freq_xlating_fir_filter_ccf_; } - else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) + if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_fcf_; } @@ -358,7 +357,7 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_right_block() { return freq_xlating_fir_filter_ccf_; } - else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) + if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_fcf_; } diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index 504baf800..236ecd4cc 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -158,15 +158,12 @@ gr::basic_block_sptr PulseBlankingFilter::get_left_block() { return freq_xlating_; } - else - { - return pulse_blanking_cc_; - } + return pulse_blanking_cc_; } else { - return nullptr; LOG(ERROR) << " Unknown input filter input/output item type conversion"; + return nullptr; } } @@ -177,9 +174,6 @@ gr::basic_block_sptr PulseBlankingFilter::get_right_block() { return pulse_blanking_cc_; } - else - { - return nullptr; - LOG(ERROR) << " Unknown input filter input/output item type conversion"; - } + LOG(ERROR) << " Unknown input filter input/output item type conversion"; + return nullptr; } diff --git a/src/algorithms/libs/gnss_sdr_create_directory.cc b/src/algorithms/libs/gnss_sdr_create_directory.cc index 3a880143b..d0af41952 100644 --- a/src/algorithms/libs/gnss_sdr_create_directory.cc +++ b/src/algorithms/libs/gnss_sdr_create_directory.cc @@ -79,9 +79,7 @@ bool gnss_sdr_create_directory(const std::string& foldername) } return true; } - else - { - os_test_file.close(); - return false; - } + + os_test_file.close(); + return false; } diff --git a/src/algorithms/libs/gnss_sdr_valve.cc b/src/algorithms/libs/gnss_sdr_valve.cc index 9e8dec580..8ef8eb08d 100644 --- a/src/algorithms/libs/gnss_sdr_valve.cc +++ b/src/algorithms/libs/gnss_sdr_valve.cc @@ -90,11 +90,8 @@ int gnss_sdr_valve::work(int noutput_items, { return -1; // Done! } - else - { - usleep(1000000); - return 0; // do not produce or consume - } + usleep(1000000); + return 0; // do not produce or consume } unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast(noutput_items)); if (n == 0) return 0; @@ -102,9 +99,7 @@ int gnss_sdr_valve::work(int noutput_items, d_ncopied_items += n; return n; } - else - { - memcpy(output_items[0], input_items[0], noutput_items * input_signature()->sizeof_stream_item(0)); - return noutput_items; - } + + memcpy(output_items[0], input_items[0], noutput_items * input_signature()->sizeof_stream_item(0)); + return noutput_items; } diff --git a/src/algorithms/libs/gps_l5_signal.cc b/src/algorithms/libs/gps_l5_signal.cc index c5e970bf5..2c1336a21 100644 --- a/src/algorithms/libs/gps_l5_signal.cc +++ b/src/algorithms/libs/gps_l5_signal.cc @@ -44,12 +44,9 @@ std::deque l5i_xa_shift(std::deque xa) { return std::deque{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; } - else - { - std::deque out(xa.begin(), xa.end() - 1); - out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]); - return out; - } + std::deque out(xa.begin(), xa.end() - 1); + out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]); + return out; } @@ -59,12 +56,9 @@ std::deque l5q_xa_shift(std::deque xa) { return std::deque{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; } - else - { - std::deque out(xa.begin(), xa.end() - 1); - out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]); - return out; - } + std::deque out(xa.begin(), xa.end() - 1); + out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]); + return out; } diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index fc50da210..b388363da 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -149,7 +149,7 @@ gr::basic_block_sptr Pass_Through::get_left_block() { return conjugate_cc_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return conjugate_sc_; } @@ -176,7 +176,7 @@ gr::basic_block_sptr Pass_Through::get_right_block() { return conjugate_cc_; } - else if (item_type_ == "cshort") + if (item_type_ == "cshort") { return conjugate_sc_; } diff --git a/src/algorithms/libs/rtklib/rtklib_ionex.cc b/src/algorithms/libs/rtklib/rtklib_ionex.cc index ab7747135..baae973c5 100644 --- a/src/algorithms/libs/rtklib/rtklib_ionex.cc +++ b/src/algorithms/libs/rtklib/rtklib_ionex.cc @@ -400,18 +400,17 @@ void readtec(const char *file, nav_t *nav, int opt) trace(2, "ionex file open error %s\n", efiles[i]); continue; } - else + + /* read ionex header */ + if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0) { - /* read ionex header */ - if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0) - { - trace(2, "ionex file format error %s\n", efiles[i]); - fclose(fp); - continue; - } - /* read ionex body */ - readionexb(fp, lats, lons, hgts, rb, nexp, nav); + trace(2, "ionex file format error %s\n", efiles[i]); + fclose(fp); + continue; } + + /* read ionex body */ + readionexb(fp, lats, lons, hgts, rb, nexp, nav); fclose(fp); } for (i = 0; i < MAXEXFILE; i++) free(efiles[i]); diff --git a/src/algorithms/libs/rtklib/rtklib_lambda.cc b/src/algorithms/libs/rtklib/rtklib_lambda.cc index 3130b0e21..74e247aa0 100644 --- a/src/algorithms/libs/rtklib/rtklib_lambda.cc +++ b/src/algorithms/libs/rtklib/rtklib_lambda.cc @@ -197,13 +197,11 @@ int search(int n, int m, const double *L, const double *D, { if (k == n - 1) break; - else - { - k++; - z[k] += step[k]; - y = zb[k] - z[k]; - step[k] = -step[k] - SGN_LAMBDA(step[k]); - } + + k++; + z[k] += step[k]; + y = zb[k] - z[k]; + step[k] = -step[k] - SGN_LAMBDA(step[k]); } } for (i = 0; i < m - 1; i++) diff --git a/src/algorithms/libs/rtklib/rtklib_pntpos.cc b/src/algorithms/libs/rtklib/rtklib_pntpos.cc index d2b4b43da..5c3a3255f 100644 --- a/src/algorithms/libs/rtklib/rtklib_pntpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_pntpos.cc @@ -243,7 +243,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel, return 0.0; } - else if (obs->code[i] != CODE_NONE and obs->code[j] == CODE_NONE) + if (obs->code[i] != CODE_NONE and obs->code[j] == CODE_NONE) { P1 += P1_C1; /* C1->P1 */ PC = P1 - P1_P2; diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm.cc b/src/algorithms/libs/rtklib/rtklib_rtcm.cc index 46163873e..56e46907c 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtcm.cc @@ -194,8 +194,8 @@ int input_rtcm2(rtcm_t *rtcm, unsigned char data) } if (++rtcm->nbit < 30) continue; - else - rtcm->nbit = 0; + + rtcm->nbit = 0; /* check parity */ if (!decode_word(rtcm->word, rtcm->buff + rtcm->nbyte)) diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 612f8791a..2ac962251 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -1775,11 +1775,9 @@ unsigned int tickget(void) { return tp.tv_sec * 1000u + tp.tv_nsec / 1000000u; } - else - { - gettimeofday(&tv, nullptr); - return tv.tv_sec * 1000u + tv.tv_usec / 1000u; - } + gettimeofday(&tv, nullptr); + return tv.tv_sec * 1000u + tv.tv_usec / 1000u; + #else gettimeofday(&tv, NULL); return tv.tv_sec * 1000u + tv.tv_usec / 1000u; @@ -3175,7 +3173,7 @@ void freenav(nav_t *nav, int opt) /* debug trace functions -----------------------------------------------------*/ //#ifdef TRACE // -FILE *fp_trace = nullptr; /* file pointer of trace */ +FILE *fp_trace = nullptr; /* file pointer of trace */ char file_trace[1024]; /* trace file */ static int level_trace = 0; /* level of trace */ unsigned int tick_trace = 0; /* tick time at traceopen (ms) */ @@ -3635,7 +3633,7 @@ double satwavelen(int sat, int frq, const nav_t *nav) { if (frq == 0) return SPEED_OF_LIGHT / FREQ1_BDS; /* B1 */ - else if (frq == 1) + if (frq == 1) return SPEED_OF_LIGHT / FREQ2_BDS; /* B2 */ else if (frq == 2) return SPEED_OF_LIGHT / FREQ3_BDS; /* B3 */ @@ -3644,7 +3642,7 @@ double satwavelen(int sat, int frq, const nav_t *nav) { if (frq == 0) return SPEED_OF_LIGHT / FREQ1; /* L1/E1 */ - else if (frq == 1) + if (frq == 1) return SPEED_OF_LIGHT / FREQ2; /* L2 */ else if (frq == 2) return SPEED_OF_LIGHT / FREQ5; /* L5/E5a */ @@ -3886,7 +3884,7 @@ double interpc(const double coef[], double lat) int i = (int)(lat / 15.0); if (i < 1) return coef[0]; - else if (i > 4) + if (i > 4) return coef[4]; return coef[i - 1] * (1.0 - lat / 15.0 + i) + coef[i] * (lat / 15.0 - i); } @@ -3999,7 +3997,7 @@ double interpvar(double ang, const double *var) int i = (int)a; if (i < 0) return var[0]; - else if (i >= 18) + if (i >= 18) return var[18]; return var[i] * (1.0 - a + i) + var[i + 1] * (a - i); } diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index ef971be0e..20dac4267 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -67,7 +67,7 @@ static int resamb_TCAR(rtk_t *rtk __attribute((unused)), const obsd_t *obs __att /* global variables ----------------------------------------------------------*/ static int statlevel = 0; /* rtk status output level (0:off) */ -static FILE *fp_stat = nullptr; /* rtk status file pointer */ +static FILE *fp_stat = nullptr; /* rtk status file pointer */ static char file_stat[1024] = ""; /* rtk status file original path */ static gtime_t time_stat = {0, 0}; /* rtk status file time */ @@ -1616,8 +1616,7 @@ int ddmat(rtk_t *rtk, double *D) rtk->ssat[i - k].fix[f] = 2; /* fix */ break; } - else - rtk->ssat[i - k].fix[f] = 1; + rtk->ssat[i - k].fix[f] = 1; } for (j = k; j < k + MAXSAT; j++) { diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index a0c4c8663..587067bb7 100644 --- a/src/algorithms/libs/rtklib/rtklib_solution.cc +++ b/src/algorithms/libs/rtklib/rtklib_solution.cc @@ -79,7 +79,7 @@ const char *opt2sep(const solopt_t *opt) { if (!*opt->sep) return " "; - else if (!strcmp(opt->sep, "\\t")) + if (!strcmp(opt->sep, "\\t")) return "\t"; return opt->sep; } @@ -343,7 +343,7 @@ int decode_nmea(char *buff, sol_t *sol) { return decode_nmearmc(val + 1, n - 1, sol); } - else if (!strcmp(val[0], "$GPGGA")) + if (!strcmp(val[0], "$GPGGA")) { return decode_nmeagga(val + 1, n - 1, sol); } diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index 8696dad44..59b833c5b 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.cc +++ b/src/algorithms/libs/rtklib/rtklib_stream.cc @@ -1227,7 +1227,7 @@ int rspntrip_s(ntrip_t *ntrip, char *msg) tracet(2, "rspntrip_s: response ok nb=%d\n", ntrip->nb); return 1; } - else if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_ERROR))) + if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_ERROR))) { /* error */ nb = ntrip->nb < MAXSTATMSG ? ntrip->nb : MAXSTATMSG; // strncpy(msg, (char *)ntrip->buff, nb); This line triggers a warning. Replaced by; @@ -2362,7 +2362,7 @@ void strsendcmd(stream_t *str, const char *cmd) } if (*q == '\0') break; - else - p = q + 1; + + p = q + 1; } } diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index ffd2dfdf0..d2d6edd2d 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -409,10 +409,7 @@ bool hybrid_observables_cc::interp_trk_obs(Gnss_Synchro &interpolated_obs, const // << " ,diff: " << old_abs_diff << " samples (" << static_cast(old_abs_diff) / static_cast(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n"; return true; } - else - { - return false; - } + return false; } else { @@ -616,8 +613,5 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) } return 1; } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc index f600a3bb8..07c17ab00 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -105,7 +105,7 @@ void signal_generator_c::init() { start_phase_rad_.push_back(0); current_data_bit_int_.push_back(1); - current_data_bits_.push_back(gr_complex(1, 0)); + current_data_bits_.emplace_back(1, 0); ms_counter_.push_back(0); data_modulation_.push_back((Galileo_E5a_I_SECONDARY_CODE.at(0) == '0' ? 1 : -1)); pilot_modulation_.push_back((Galileo_E5a_Q_SECONDARY_CODE[PRN_[sat]].at(0) == '0' ? 1 : -1)); diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index 5f674cc79..7dbea2d0e 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -370,15 +370,9 @@ gr::basic_block_sptr FileSignalSource::get_right_block() { return valve_; } - else + if (enable_throttle_control_ == true) { - if (enable_throttle_control_ == true) - { - return throttle_; - } - else - { - return file_source_; - } + return throttle_; } + return file_source_; } diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc index ef46fd725..60566ed5e 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -309,15 +309,9 @@ gr::basic_block_sptr NsrFileSignalSource::get_right_block() { return valve_; } - else + if (enable_throttle_control_ == true) { - if (enable_throttle_control_ == true) - { - return throttle_; - } - else - { - return unpack_byte_; - } + return throttle_; } + return unpack_byte_; } diff --git a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc index f01dec094..d5692e434 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc @@ -308,15 +308,9 @@ gr::basic_block_sptr SpirFileSignalSource::get_right_block() { return valve_; } - else + if (enable_throttle_control_ == true) { - if (enable_throttle_control_ == true) - { - return throttle_; - } - else - { - return unpack_intspir_; - } + return throttle_; } + return unpack_intspir_; } diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc index 8f113cd72..7115771e9 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc @@ -318,15 +318,9 @@ gr::basic_block_sptr TwoBitCpxFileSignalSource::get_right_block() { return valve_; } - else + if (enable_throttle_control_ == true) { - if (enable_throttle_control_ == true) - { - return throttle_; - } - else - { - return unpack_byte_; - } + return throttle_; } + return unpack_byte_; } diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index 8002c9c8d..2af118173 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -92,14 +92,14 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, for (int i = 0; i < RF_channels_; i++) { // Single RF channel UHD operation (backward compatible config file format) - samples_.push_back(configuration->property(role + ".samples" + boost::lexical_cast(i), 0)); - dump_.push_back(configuration->property(role + ".dump" + boost::lexical_cast(i), false)); - dump_filename_.push_back(configuration->property(role + ".dump_filename" + boost::lexical_cast(i), default_dump_file)); + samples_.push_back(configuration->property(role + ".samples" + std::to_string(i), 0)); + dump_.push_back(configuration->property(role + ".dump" + std::to_string(i), false)); + dump_filename_.push_back(configuration->property(role + ".dump_filename" + std::to_string(i), default_dump_file)); - freq_.push_back(configuration->property(role + ".freq" + boost::lexical_cast(i), GPS_L1_FREQ_HZ)); - gain_.push_back(configuration->property(role + ".gain" + boost::lexical_cast(i), 50.0)); + freq_.push_back(configuration->property(role + ".freq" + std::to_string(i), GPS_L1_FREQ_HZ)); + gain_.push_back(configuration->property(role + ".gain" + std::to_string(i), 50.0)); - IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz" + boost::lexical_cast(i), sample_rate_ / 2)); + IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz" + std::to_string(i), sample_rate_ / 2)); } } // 1. Make the uhd driver instance @@ -314,8 +314,5 @@ gr::basic_block_sptr UhdSignalSource::get_right_block(int RF_channel) { return valve_.at(RF_channel); } - else - { - return uhd_source_; - } + return uhd_source_; } diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc index 1d1990038..c633d97a5 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc @@ -300,7 +300,7 @@ int labsat23_source::general_work(int noutput_items, return -1; } - //check if the selected channel in config file match the file encoding + // check if the selected channel in config file match the file encoding if (d_channel_selector_config == 2 and d_channel_selector != 0) { std::cout << "Labsat source channel config inconsistency: channel 2 is selected but the file has only one channel" << std::endl; @@ -359,18 +359,15 @@ int labsat23_source::general_work(int noutput_items, std::cout << "Unknown channel B constellation ID " << static_cast(channel_b_constellation) << std::endl; } - //end of header + // end of header d_header_parsed = true; - //seek file to the first signal sample + // seek file to the first signal sample binary_input_file->clear(); binary_input_file->seekg(header_bytes, binary_input_file->beg); return 0; } - else - { - std::cout << "Labsat file header error: section 2 is not available." << std::endl; - return -1; - } + std::cout << "Labsat file header error: section 2 is not available." << std::endl; + return -1; } else { @@ -380,7 +377,7 @@ int labsat23_source::general_work(int noutput_items, } else { - //ready to start reading samples + // ready to start reading samples switch (d_bits_per_sample) { case 2: @@ -391,7 +388,7 @@ int labsat23_source::general_work(int noutput_items, // dual channel 2 bits per complex sample break; default: - //single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16) + // single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16) int n_int16_to_read = noutput_items / 8; if (n_int16_to_read > 0) { @@ -408,23 +405,21 @@ int labsat23_source::general_work(int noutput_items, } return output_pointer; } + + // trigger the read of the next file in the sequence + std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl; + + d_current_file_number++; + binary_input_file->close(); + binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary); + if (binary_input_file->is_open()) + { + std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl; + } else { - //trigger the read of the next file in the sequence - std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl; - - d_current_file_number++; - binary_input_file->close(); - binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary); - if (binary_input_file->is_open()) - { - std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl; - } - else - { - std::cout << "Last file reached, LabSat source stop" << std::endl; - return -1; - } + std::cout << "Last file reached, LabSat source stop" << std::endl; + return -1; } } else @@ -442,7 +437,7 @@ int labsat23_source::general_work(int noutput_items, // dual channel break; default: - //single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16) + // single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16) int n_int16_to_read = noutput_items / 4; if (n_int16_to_read > 0) { @@ -459,23 +454,21 @@ int labsat23_source::general_work(int noutput_items, } return output_pointer; } + + // trigger the read of the next file in the sequence + std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl; + + d_current_file_number++; + binary_input_file->close(); + binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary); + if (binary_input_file->is_open()) + { + std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl; + } else { - //trigger the read of the next file in the sequence - std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl; - - d_current_file_number++; - binary_input_file->close(); - binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary); - if (binary_input_file->is_open()) - { - std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl; - } - else - { - std::cout << "Last file reached, LabSat source stop" << std::endl; - return -1; - } + std::cout << "Last file reached, LabSat source stop" << std::endl; + return -1; } } else diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc index 7e3578130..4fc08e96e 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc @@ -66,8 +66,8 @@ bool systemBytesAreBigEndian() b.byte = static_cast(0x01); if (*(char *)&b.byte == 1) return false; - else - return true; + + return true; } diff --git a/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc b/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc index 0f2419498..fab664d28 100644 --- a/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc +++ b/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc @@ -126,28 +126,26 @@ double rtl_tcp_dongle_info::clip_gain(int gain) const // no defined gains to clip to return gain; } - else - { - double last_stop = gains.front(); - BOOST_FOREACH (double g, gains) - { - g /= 10.0; - if (gain < g) + double last_stop = gains.front(); + BOOST_FOREACH (double g, gains) + { + g /= 10.0; + + if (gain < g) + { + if (std::abs(gain - g) < std::abs(gain - last_stop)) { - if (std::abs(gain - g) < std::abs(gain - last_stop)) - { - return g; - } - else - { - return last_stop; - } + return g; + } + else + { + return last_stop; } - last_stop = g; } - return last_stop; + last_stop = g; } + return last_stop; } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc index 0e0fd2214..a6b732887 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_cc.cc @@ -439,7 +439,7 @@ void galileo_telemetry_decoder_cc::set_channel(int32_t channel) try { d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); @@ -780,8 +780,5 @@ int galileo_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( *out[0] = current_symbol; return 1; } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index cf748c694..d8b5fb1b6 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -244,7 +244,7 @@ void glonass_l1_ca_telemetry_decoder_cc::set_channel(int32_t channel) try { d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc index e73dfcb9f..3b1651cba 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc @@ -244,7 +244,7 @@ void glonass_l2_ca_telemetry_decoder_cc::set_channel(int32_t channel) try { d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index e566abf83..9d4c04278 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -136,9 +136,11 @@ bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(uint32_t gpsword) parity = t ^ _rotl(t, 6) ^ _rotl(t, 12) ^ _rotl(t, 18) ^ _rotl(t, 24); parity = parity & 0x3F; if (parity == (gpsword & 0x3F)) - return (true); - else - return (false); + { + return (true); + } + + return (false); } @@ -165,7 +167,7 @@ void gps_l1_ca_telemetry_decoder_cc::set_channel(int32_t channel) try { d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); @@ -474,8 +476,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__ return 1; } - else - { - return 0; - } + + + return 0; } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc index dba641cd0..da5e9e123 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc @@ -109,7 +109,7 @@ void gps_l2c_telemetry_decoder_cc::set_channel(int channel) try { d_dump_filename = "telemetry_L2CM_"; - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc index de69376c5..561be8878 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc @@ -121,7 +121,7 @@ void gps_l5_telemetry_decoder_cc::set_channel(int32_t channel) try { d_dump_filename = "telemetry_L5_"; - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); @@ -282,8 +282,5 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u out[0] = current_synchro_data; return 1; } - else - { - return 0; - } + return 0; } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc index 25b3cdaa2..8a6417cd0 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc @@ -302,7 +302,7 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st for (int & candidate_bit_it : candidate) candidate_bit_it = candidate_bit_it == 0 ? 1 : 0; } - msg_candidates.push_back(std::pair>(relative_preamble_start, candidate)); + msg_candidates.emplace_back(relative_preamble_start, candidate); ss.str(""); ss << "preamble " << preample_it - preambles.begin() << (inv_preamble_detected ? " inverted" : " normal") << " detected! candidate="; for (auto bit_it = candidate.begin(); bit_it < candidate.end(); ++bit_it) @@ -344,7 +344,7 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vec // the final remainder must be zero for a valid message, because the CRC is done over the received CRC value if (crc == 0) { - valid_msgs.push_back(msg_candiate_char_t(candidate_it->first, candidate_bytes)); + valid_msgs.emplace_back(candidate_it->first, candidate_bytes); ss << "Valid message found!"; } else diff --git a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc index 92b022253..ef71c4537 100644 --- a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc +++ b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc @@ -559,12 +559,9 @@ int Viterbi_Decoder::Prev::get_anchestor_state_of_current_state(int current_stat { return state[current_state]; } - else - { - //std::cout<<"alarm "<<"num_states="< 0) d_carrier_lock_fail_counter--; - } - if (d_carrier_lock_fail_counter > trk_parameters.max_lock_fail) - { - std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; - LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; - this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock - d_carrier_lock_fail_counter = 0; - return false; - } - else - { - return true; - } + if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } + if (d_carrier_lock_fail_counter > trk_parameters.max_lock_fail) + { + std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; + LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; + this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock + d_carrier_lock_fail_counter = 0; + return false; + } + return true; } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 3c2620306..91cea2f28 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -64,7 +64,7 @@ galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking int64_t fs_in, uint32_t vector_length, bool dump, - const std::string& dump_filename, + const std::string &dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, @@ -90,7 +90,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, - std::string dump_filename, + const std::string& dump_filename, float pll_bw_hz __attribute__((unused)), float dll_bw_hz __attribute__((unused)), float early_late_space_chips, @@ -544,8 +544,6 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri { return 1; } - else - { - return 0; - } + + return 0; } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h index dedb723f5..7f93ebb03 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h @@ -97,7 +97,7 @@ private: Galileo_E1_Tcp_Connector_Tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, - std::string dump_filename, + const std::string& dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index c2d7d9364..71a31058d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -43,7 +43,6 @@ #include "lock_detectors.h" #include "gnss_sdr_flags.h" #include "control_message_factory.h" -#include #include #include #include @@ -567,7 +566,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 5a1d08090..6903c78e6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -44,7 +44,6 @@ #include "gnss_sdr_flags.h" #include "control_message_factory.h" #include -#include #include #include #include @@ -558,7 +557,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 52e612164..600edeb51 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -43,7 +43,6 @@ #include "lock_detectors.h" #include "gnss_sdr_flags.h" #include "control_message_factory.h" -#include #include #include #include @@ -519,7 +518,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index e5aacb3bf..311e4a49a 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -41,7 +41,6 @@ #include "GLONASS_L1_L2_CA.h" #include "gnss_sdr_flags.h" #include "control_message_factory.h" -#include #include #include #include @@ -564,7 +563,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index 7f2a5fac1..5ecb75f62 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -42,7 +42,6 @@ #include "gnss_sdr_flags.h" #include "control_message_factory.h" #include -#include #include #include #include @@ -557,7 +556,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index b3e14d11f..99ddb9b35 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -43,7 +43,6 @@ #include "GLONASS_L1_L2_CA.h" #include "gnss_sdr_flags.h" #include "control_message_factory.h" -#include #include #include #include @@ -519,7 +518,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc index 8ce7d3d09..aa794f286 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -35,7 +35,6 @@ #include "gnss_sdr_flags.h" #include "GPS_L1_CA.h" #include "control_message_factory.h" -#include #include #include #include @@ -546,7 +545,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); @@ -905,8 +904,6 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib { return 1; } - else - { - return 0; - } + + return 0; } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc index 2a541fabd..63357b078 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -36,7 +36,6 @@ #include "gnss_sdr_flags.h" #include "control_message_factory.h" #include -#include #include #include #include @@ -548,7 +547,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); @@ -906,8 +905,6 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib { return 1; } - else - { - return 0; - } + + return 0; } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc index 28148a004..6700036d2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc @@ -44,7 +44,6 @@ #include "gnss_sdr_flags.h" #include "GPS_L1_CA.h" #include "control_message_factory.h" -#include #include #include #include @@ -648,7 +647,7 @@ void Gps_L1_Ca_Kf_Tracking_cc::set_channel(uint32_t channel) { try { - d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 7875a2bbc..c5e4c1e98 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -62,7 +62,7 @@ gps_l1_ca_tcp_connector_make_tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, - const std::string& dump_filename, + const std::string &dump_filename, float early_late_space_chips, size_t port_ch0) { @@ -85,7 +85,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, - std::string dump_filename, + const std::string& dump_filename, float early_late_space_chips, size_t port_ch0) : gr::block("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) @@ -583,8 +583,6 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib { return 1; } - else - { - return 0; - } + + return 0; } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h index 91bdb0890..3acbdb54e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h @@ -93,7 +93,7 @@ private: Gps_L1_Ca_Tcp_Connector_Tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, - std::string dump_filename, + const std::string& dump_filename, float early_late_space_chips, size_t port_ch0); diff --git a/src/algorithms/tracking/libs/tcp_communication.cc b/src/algorithms/tracking/libs/tcp_communication.cc index edba15b7f..998006c1b 100644 --- a/src/algorithms/tracking/libs/tcp_communication.cc +++ b/src/algorithms/tracking/libs/tcp_communication.cc @@ -40,9 +40,7 @@ tcp_communication::tcp_communication() : tcp_socket_(io_service_) } -tcp_communication::~tcp_communication() -{ -} +tcp_communication::~tcp_communication() = default; int tcp_communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_) diff --git a/src/algorithms/tracking/libs/tracking_discriminators.cc b/src/algorithms/tracking/libs/tracking_discriminators.cc index 5d7283d65..c7ba2858f 100644 --- a/src/algorithms/tracking/libs/tracking_discriminators.cc +++ b/src/algorithms/tracking/libs/tracking_discriminators.cc @@ -81,10 +81,7 @@ double pll_cloop_two_quadrant_atan(gr_complex prompt_s1) { return atan(prompt_s1.imag() / prompt_s1.real()); } - else - { - return 0.0; - } + return 0.0; } @@ -105,10 +102,7 @@ double dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1) { return 0.0; } - else - { - return 0.5 * (P_early - P_late) / (P_early + P_late); - } + return 0.5 * (P_early - P_late) / (P_early + P_late); } /* @@ -129,8 +123,5 @@ double dll_nc_vemlp_normalized(gr_complex very_early_s1, gr_complex early_s1, gr { return 0.0; } - else - { - return (P_early - P_late) / (P_early + P_late); - } + return (P_early - P_late) / (P_early + P_late); } diff --git a/src/core/libs/string_converter.cc b/src/core/libs/string_converter.cc index 7420aad64..a529ae5fd 100644 --- a/src/core/libs/string_converter.cc +++ b/src/core/libs/string_converter.cc @@ -46,7 +46,7 @@ bool StringConverter::convert(const std::string& value, bool default_value) { return true; } - else if (value == "false") + if (value == "false") { return false; } @@ -68,10 +68,8 @@ int64_t StringConverter::convert(const std::string& value, int64_t default_value { return default_value; } - else - { - return result; - } + + return result; } @@ -86,10 +84,8 @@ uint64_t StringConverter::convert(const std::string& value, uint64_t default_val { return default_value; } - else - { - return result; - } + + return result; } @@ -104,10 +100,8 @@ int32_t StringConverter::convert(const std::string& value, int32_t default_value { return default_value; } - else - { - return result; - } + + return result; } @@ -122,10 +116,8 @@ uint32_t StringConverter::convert(const std::string& value, uint32_t default_val { return default_value; } - else - { - return result; - } + + return result; } @@ -140,10 +132,8 @@ uint16_t StringConverter::convert(const std::string& value, uint16_t default_val { return default_value; } - else - { - return result; - } + + return result; } @@ -158,10 +148,8 @@ int16_t StringConverter::convert(const std::string& value, int16_t default_value { return default_value; } - else - { - return result; - } + + return result; } @@ -176,10 +164,8 @@ float StringConverter::convert(const std::string& value, float default_value) { return default_value; } - else - { - return result; - } + + return result; } @@ -194,8 +180,6 @@ double StringConverter::convert(const std::string& value, double default_value) { return default_value; } - else - { - return result; - } + + return result; } diff --git a/src/core/receiver/concurrent_map.h b/src/core/receiver/concurrent_map.h index 7df929b82..218030286 100644 --- a/src/core/receiver/concurrent_map.h +++ b/src/core/receiver/concurrent_map.h @@ -94,11 +94,8 @@ public: lock.unlock(); return true; } - else - { - lock.unlock(); - return false; - } + lock.unlock(); + return false; } }; diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index a99a499dc..5fc45e668 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -289,10 +289,8 @@ int ControlThread::run() { return 42; // signal the gnss-sdr-harness.sh to restart the receiver program } - else - { - return 0; // normal shutdown - } + + return 0; // normal shutdown } diff --git a/src/core/receiver/file_configuration.cc b/src/core/receiver/file_configuration.cc index 614d9268c..62992c074 100644 --- a/src/core/receiver/file_configuration.cc +++ b/src/core/receiver/file_configuration.cc @@ -69,10 +69,7 @@ std::string FileConfiguration::property(std::string property_name, std::string d { return overrided_->property(property_name, default_value); } - else - { - return ini_reader_->Get("GNSS-SDR", property_name, default_value); - } + return ini_reader_->Get("GNSS-SDR", property_name, default_value); } @@ -82,11 +79,8 @@ bool FileConfiguration::property(std::string property_name, bool default_value) { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -96,11 +90,8 @@ int64_t FileConfiguration::property(std::string property_name, int64_t default_v { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -110,11 +101,8 @@ uint64_t FileConfiguration::property(std::string property_name, uint64_t default { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -124,11 +112,8 @@ int FileConfiguration::property(std::string property_name, int default_value) { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -138,11 +123,8 @@ unsigned int FileConfiguration::property(std::string property_name, unsigned int { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -152,11 +134,8 @@ uint16_t FileConfiguration::property(std::string property_name, uint16_t default { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -166,11 +145,8 @@ int16_t FileConfiguration::property(std::string property_name, int16_t default_v { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -180,11 +156,8 @@ float FileConfiguration::property(std::string property_name, float default_value { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } @@ -194,11 +167,8 @@ double FileConfiguration::property(std::string property_name, double default_val { return overrided_->property(property_name, default_value); } - else - { - std::string empty; - return converter_->convert(property(property_name, empty), default_value); - } + std::string empty; + return converter_->convert(property(property_name, empty), default_value); } diff --git a/src/core/receiver/in_memory_configuration.cc b/src/core/receiver/in_memory_configuration.cc index 3a3d220b7..4801d2eb2 100644 --- a/src/core/receiver/in_memory_configuration.cc +++ b/src/core/receiver/in_memory_configuration.cc @@ -55,10 +55,7 @@ std::string InMemoryConfiguration::property(std::string property_name, std::stri { return iter->second; } - else - { - return default_value; - } + return default_value; } diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index 03d74680b..58888effe 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -224,10 +224,8 @@ bool Galileo_Fnav_Message::_CRC_test(std::bitset b { return true; } - else - { - return false; - } + + return false; } @@ -498,10 +496,7 @@ bool Galileo_Fnav_Message::have_new_ephemeris() // Check if we have a new ephem std::cout << "Batch number: " << IOD_ephemeris << std::endl; return true; } - else - { - return false; - } + return false; } else { diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index ded7a075a..8407cf3e6 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -253,10 +253,7 @@ bool Galileo_Navigation_Message::CRC_test(std::bitset b { return true; } - else - { - return false; - } + return false; } @@ -442,10 +439,9 @@ bool Galileo_Navigation_Message::have_new_ephemeris() // Check if we have a new std::cout << "Batch number: " << IOD_ephemeris << std::endl; return true; } - else - { - return false; - } + + + return false; } else return false; @@ -459,8 +455,8 @@ bool Galileo_Navigation_Message::have_new_iono_and_GST() // Check if we have a flag_iono_and_GST = false; // clear the flag return true; } - else - return false; + + return false; } @@ -471,8 +467,8 @@ bool Galileo_Navigation_Message::have_new_utc_model() // Check if we have a new flag_utc_model = false; // clear the flag return true; } - else - return false; + + return false; } @@ -488,8 +484,8 @@ bool Galileo_Navigation_Message::have_new_almanac() // Check if we have a new a flag_all_almanac = true; return true; } - else - return false; + + return false; } diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 005e14597..b360a5c02 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -83,7 +83,7 @@ void Glonass_Gnav_Navigation_Message::reset() // Data update information d_previous_tb = 0.0; - for (double & i : d_previous_Na) + for (double& i : d_previous_Na) i = 0.0; std::map satelliteBlock; // Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus @@ -200,7 +200,7 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset x_v_read; for (unsigned int i = 0; i < size; i++) { - x_v_read.push_back(gr_complex(x_read_real[i], x_read_imag[i])); + x_v_read.emplace_back(x_read_real[i], x_read_imag[i]); } Mat_Close(matfp_read); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc index 1a6a19278..95c5ed22d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc @@ -63,10 +63,7 @@ bool observables_dump_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -82,10 +79,7 @@ int64_t observables_dump_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc index 2159b0e34..c8c95afd4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc @@ -56,10 +56,7 @@ bool tlm_dump_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -75,10 +72,7 @@ int64_t tlm_dump_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc index 701df393c..233bd8acb 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc @@ -75,10 +75,7 @@ bool tracking_dump_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -96,10 +93,9 @@ int64_t tracking_dump_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + + + return 0; } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc index df51a8baa..25ec5b66b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc @@ -58,10 +58,7 @@ bool tracking_true_obs_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -77,10 +74,7 @@ int64_t tracking_true_obs_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc index 396c41401..14cd52562 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc @@ -63,10 +63,7 @@ bool true_observables_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -82,10 +79,7 @@ int64_t true_observables_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } diff --git a/src/utils/front-end-cal/front_end_cal.cc b/src/utils/front-end-cal/front_end_cal.cc index c0ba4ea15..4590f47b6 100644 --- a/src/utils/front-end-cal/front_end_cal.cc +++ b/src/utils/front-end-cal/front_end_cal.cc @@ -78,12 +78,9 @@ bool FrontEndCal::read_assistance_from_XML() } return true; } - else - { - std::cout << "ERROR: SUPL client error reading XML" << std::endl; - LOG(WARNING) << "ERROR: SUPL client error reading XML"; - return false; - } + std::cout << "ERROR: SUPL client error reading XML" << std::endl; + LOG(WARNING) << "ERROR: SUPL client error reading XML"; + return false; } @@ -256,10 +253,7 @@ bool FrontEndCal::get_ephemeris() { return true; } - else - { - return false; - } + return false; } else { @@ -274,10 +268,7 @@ bool FrontEndCal::get_ephemeris() { return true; } - else - { - return false; - } + return false; } } @@ -377,10 +368,7 @@ double FrontEndCal::estimate_doppler_from_eph(unsigned int PRN, double TOW, doub mean_Doppler_Hz = arma::mean(Doppler_Hz); return mean_Doppler_Hz; } - else - { - throw(1); - } + throw(1); }