diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index b3e3b2b51..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; } @@ -1021,7 +1017,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item if (gnss_observables_map.empty() == false) { double current_RX_time = gnss_observables_map.begin()->second.RX_time; - uint32_t current_RX_time_ms = static_cast(current_RX_time * 1000.0); + auto current_RX_time_ms = static_cast(current_RX_time * 1000.0); if (current_RX_time_ms % d_output_rate_ms == 0) { flag_compute_pvt_output = true; diff --git a/src/algorithms/PVT/libs/geojson_printer.cc b/src/algorithms/PVT/libs/geojson_printer.cc index 5a6561880..7f4da17c1 100644 --- a/src/algorithms/PVT/libs/geojson_printer.cc +++ b/src/algorithms/PVT/libs/geojson_printer.cc @@ -145,23 +145,19 @@ bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_nam // Writing the header geojson_file << "{" << std::endl; - geojson_file << " \"type\": \"Feature\"," << std::endl; + geojson_file << R"( "type": "Feature",)" << std::endl; geojson_file << " \"properties\": {" << std::endl; - geojson_file << " \"name\": \"Locations generated by GNSS-SDR\" " << std::endl; + geojson_file << R"( "name": "Locations generated by GNSS-SDR" )" << std::endl; geojson_file << " }," << std::endl; - - geojson_file << " \"geometry\": {" << std::endl; - geojson_file << " \"type\": \"MultiPoint\"," << 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 95495c6c2..7ca86052a 100644 --- a/src/algorithms/PVT/libs/gpx_printer.cc +++ b/src/algorithms/PVT/libs/gpx_printer.cc @@ -136,8 +136,8 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name) // Set iostream numeric format and precision gpx_file.setf(gpx_file.std::ofstream::fixed, gpx_file.std::ofstream::floatfield); gpx_file << std::setprecision(14); - gpx_file << "" << std::endl - << ")" << std::endl + << R"(" << 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/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index 5ca6ef597..007552187 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -34,6 +34,7 @@ #include "GPS_L1_CA.h" #include "GPS_L2C.h" #include +#include #include @@ -43,7 +44,7 @@ hybrid_ls_pvt::hybrid_ls_pvt(int nchannels, std::string dump_filename, bool flag { // init empty ephemeris for all the available GNSS channels d_nchannels = nchannels; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_flag_dump_enabled = flag_dump_to_file; d_galileo_current_time = 0; count_valid_position = 0; diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index 797f45ebb..76018ba35 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -149,8 +149,8 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name) tmp_file.setf(tmp_file.std::ofstream::fixed, tmp_file.std::ofstream::floatfield); tmp_file << std::setprecision(14); - kml_file << "" << std::endl - << "" << std::endl + kml_file << R"()" << std::endl + << R"()" << std::endl << indent << "" << std::endl << indent << indent << "GNSS Track" << std::endl << indent << indent << "& 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/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc index 604991af1..eb1a66db4 100644 --- a/src/algorithms/PVT/libs/nmea_printer.cc +++ b/src/algorithms/PVT/libs/nmea_printer.cc @@ -248,9 +248,9 @@ char Nmea_Printer::checkSum(std::string sentence) { char check = 0; // iterate over the string, XOR each byte with the total sum: - for (unsigned int c = 0; c < sentence.length(); c++) + for (char c : sentence) { - check = char(check ^ sentence.at(c)); + check = char(check ^ c); } // return the result return check; diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 73d8af555..fdd6ec9ab 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -254,7 +254,7 @@ void Rinex_Printer::lengthCheck(const std::string& line) } -std::string Rinex_Printer::createFilename(std::string type) +std::string Rinex_Printer::createFilename(const std::string& type) { const std::string stationName = "GSDR"; // 4-character station name designator boost::gregorian::date today = boost::gregorian::day_clock::local_day(); @@ -2878,7 +2878,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map(gps_ephemeris_iter->second.i_code_on_L2), 18, 2); line += std::string(1, ' '); - double GPS_week_continuous_number = static_cast(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm) + auto GPS_week_continuous_number = static_cast(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm) line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2); line += std::string(1, ' '); line += Rinex_Printer::doub2for(static_cast(gps_ephemeris_iter->second.i_code_on_L2), 18, 2); @@ -3082,7 +3082,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm) + auto GPS_week_continuous_number = static_cast(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm) line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2); line += std::string(1, ' '); line += Rinex_Printer::doub2for(my_zero, 18, 2); @@ -3227,7 +3227,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map(data_source_INAV), 18, 2); line += std::string(1, ' '); - double GST_week = static_cast(galileo_ephemeris_iter->second.WN_5); + auto GST_week = static_cast(galileo_ephemeris_iter->second.WN_5); double num_GST_rollovers = floor((GST_week + 1024.0) / 4096.0); double Galileo_week_continuous_number = GST_week + 1024.0 + num_GST_rollovers * 4096.0; line += Rinex_Printer::doub2for(Galileo_week_continuous_number, 18, 2); @@ -3529,7 +3529,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map& observables, const std::string glonass_band) +void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double obs_time, const std::map& observables, const std::string& glonass_band) { // RINEX observations timestamps are GPS timestamps. std::string line; @@ -7558,7 +7558,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep lineObs += std::to_string(static_cast(*it)); } ret = total_glo_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { /// \todo Need to account for pseudorange correction for glonass //double leap_seconds = Rinex_Printer::get_leap_second(glonass_gnav_eph, gps_obs_time); @@ -7798,7 +7798,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g lineObs += std::to_string(static_cast(*it)); ret = total_glo_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { /// \todo Need to account for pseudorange correction for glonass //double leap_seconds = Rinex_Printer::get_leap_second(glonass_gnav_eph, gps_obs_time); @@ -8035,7 +8035,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_glo_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); @@ -8616,7 +8616,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_mmap.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); @@ -8669,7 +8669,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c } -void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map& observables, const std::string galileo_bands) +void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map& observables, const std::string& galileo_bands) { // RINEX observations timestamps are Galileo timestamps. // See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html @@ -8856,7 +8856,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); @@ -9110,7 +9110,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_gal_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); @@ -9339,7 +9339,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_gps_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); @@ -9398,7 +9398,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_gal_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); @@ -9648,7 +9648,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_gps_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); @@ -9707,7 +9707,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep if (static_cast(*it) < 10) lineObs += std::string(1, '0'); lineObs += std::to_string(static_cast(*it)); ret = total_gal_map.equal_range(*it); - for (std::multimap::iterator iter = ret.first; iter != ret.second; ++iter) + for (auto iter = ret.first; iter != ret.second; ++iter) { lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14); diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index 1f33176ff..00c8497db 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -146,52 +146,52 @@ public: /*! * \brief Generates the GPS L2 Observation data header */ - void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string gps_bands = "2S"); + void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string& gps_bands = "2S"); /*! * \brief Generates the dual frequency GPS L1 & L2/L5 Observation data header */ - void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string gps_bands = "1C 2S"); + void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string& gps_bands = "1C 2S"); /*! * \brief Generates the Galileo Observation data header. Example: bands("1B"), bands("1B 5X"), bands("5X"), ... Default: "1B". */ - void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands = "1B"); + void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands = "1B"); /*! * \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". */ - void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string galileo_bands = "1B"); + void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& galileo_bands = "1B"); /*! * \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". */ - void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands = "1C 2S", const std::string galileo_bands = "1B"); + void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands = "1C 2S", const std::string& galileo_bands = "1B"); /*! * \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". */ - void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands = "2S", const std::string galileo_bands = "1B"); + void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands = "2S", const std::string& galileo_bands = "1B"); /*! * \brief Generates the GLONASS GNAV Observation data header. Example: bands("1C"), bands("1C 2C"), bands("2C"), ... Default: "1C". */ - void rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands = "1G"); + void rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands = "1G"); /*! * \brief Generates the Mixed (GPS L1 C/A /GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". */ - void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glo_bands = "1C"); + void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glo_bands = "1C"); /*! * \brief Generates the Mixed (Galileo/GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". */ - void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string galileo_bands = "1B", const std::string glo_bands = "1C"); + void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& galileo_bands = "1B", const std::string& glo_bands = "1C"); /*! * \brief Generates the Mixed (GPS L2C/GLONASS) Observation data header. Example: galileo_bands("1G")... Default: "1G". */ - void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glo_bands = "1G"); + void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glo_bands = "1G"); /*! * \brief Generates the SBAS raw data header @@ -297,7 +297,7 @@ public: /*! * \brief Writes Galileo observables into the RINEX file. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". */ - void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map& observables, const std::string galileo_bands = "1B"); + void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map& observables, const std::string& galileo_bands = "1B"); /*! * \brief Writes Mixed GPS / Galileo observables into the RINEX file @@ -317,7 +317,7 @@ public: /*! * \brief Writes GLONASS GNAV observables into the RINEX file. Example: glonass_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". */ - void log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, double obs_time, const std::map& observables, const std::string glonass_bands = "1C"); + void log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, double obs_time, const std::map& observables, const std::string& glonass_bands = "1C"); /*! * \brief Writes Mixed GPS L1 C/A - GLONASS observables into the RINEX file @@ -406,7 +406,7 @@ private: * "RINEX_FILE_TYPE_SBAS" - SBAS broadcast data file. * "RINEX_FILE_TYPE_CLK" - Clock file. */ - std::string createFilename(std::string type); + std::string createFilename(const std::string& type); /* * Generates the data for the PGM / RUN BY / DATE line diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index 40934e833..350e57608 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -38,6 +38,7 @@ #include // for filesystem #include #include +#include #include // for O_RDWR #include // for tcgetattr @@ -45,7 +46,7 @@ using google::LogMessage; -Rtcm_Printer::Rtcm_Printer(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, 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); @@ -141,7 +142,7 @@ Rtcm_Printer::Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool } } - rtcm_devname = rtcm_dump_devname; + rtcm_devname = std::move(rtcm_dump_devname); if (flag_rtcm_tty_port == true) { rtcm_dev_descriptor = init_serial(rtcm_devname.c_str()); @@ -337,7 +338,7 @@ bool Rtcm_Printer::Print_Rtcm_MSM(uint32_t msm_number, const Gps_Ephemeris& gps_ } -int Rtcm_Printer::init_serial(std::string serial_device) +int Rtcm_Printer::init_serial(const std::string& serial_device) { /* * Opens the serial device and sets the default baud rate for a RTCM transmission (9600,8,N,1) diff --git a/src/algorithms/PVT/libs/rtcm_printer.h b/src/algorithms/PVT/libs/rtcm_printer.h index bb34f7ea6..9e3b9cf7c 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(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, std::string rtcm_dump_filename, bool time_tag_name = true, const std::string& base_path = "."); /*! * \brief Default destructor. @@ -149,7 +149,7 @@ private: uint16_t port; uint16_t station_id; int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port) - int32_t init_serial(std::string serial_device); //serial port control + int32_t init_serial(const std::string& serial_device); //serial port control void close_serial(); std::shared_ptr rtcm; bool Print_Message(const std::string& message); diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index d7eb452ac..4e00c5621 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -60,6 +60,8 @@ #include #include +#include + using google::LogMessage; @@ -67,18 +69,18 @@ rtklib_solver::rtklib_solver(int nchannels, std::string dump_filename, bool flag { // init empty ephemeris for all the available GNSS channels d_nchannels = nchannels; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_flag_dump_enabled = flag_dump_to_file; d_flag_dump_mat_enabled = flag_dump_to_mat; count_valid_position = 0; this->set_averaging_flag(false); rtk_ = rtk; - for (unsigned int i = 0; i < 4; i++) dop_[i] = 0.0; + for (double & i : dop_) i = 0.0; pvt_sol = {{0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, '0', '0', '0', 0, 0, 0}; ssat_t ssat0 = {0, 0, {0.0}, {0.0}, {0.0}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {}, {}, {}, {}, 0.0, 0.0, 0.0, 0.0, {{{0, 0}}, {{0, 0}}}, {{}, {}}}; - for (unsigned int i = 0; i < MAXSAT; i++) + for (auto & i : pvt_ssat) { - pvt_ssat[i] = ssat0; + i = ssat0; } // ############# ENABLE DATA FILE LOG ################# if (d_flag_dump_enabled == true) @@ -137,34 +139,34 @@ bool rtklib_solver::save_matfile() return false; } - uint32_t *TOW_at_current_symbol_ms = new uint32_t[num_epoch]; - uint32_t *week = new uint32_t[num_epoch]; - double *RX_time = new double[num_epoch]; - double *user_clk_offset = new double[num_epoch]; - double *pos_x = new double[num_epoch]; - double *pos_y = new double[num_epoch]; - double *pos_z = new double[num_epoch]; - double *vel_x = new double[num_epoch]; - double *vel_y = new double[num_epoch]; - double *vel_z = new double[num_epoch]; - double *cov_xx = new double[num_epoch]; - double *cov_yy = new double[num_epoch]; - double *cov_zz = new double[num_epoch]; - double *cov_xy = new double[num_epoch]; - double *cov_yz = new double[num_epoch]; - double *cov_zx = new double[num_epoch]; - double *latitude = new double[num_epoch]; - double *longitude = new double[num_epoch]; - double *height = new double[num_epoch]; - uint8_t *valid_sats = new uint8_t[num_epoch]; - uint8_t *solution_status = new uint8_t[num_epoch]; - uint8_t *solution_type = new uint8_t[num_epoch]; - float *AR_ratio_factor = new float[num_epoch]; - float *AR_ratio_threshold = new float[num_epoch]; - double *gdop = new double[num_epoch]; - double *pdop = new double[num_epoch]; - double *hdop = new double[num_epoch]; - double *vdop = new double[num_epoch]; + auto *TOW_at_current_symbol_ms = new uint32_t[num_epoch]; + auto *week = new uint32_t[num_epoch]; + auto *RX_time = new double[num_epoch]; + auto *user_clk_offset = new double[num_epoch]; + auto *pos_x = new double[num_epoch]; + auto *pos_y = new double[num_epoch]; + auto *pos_z = new double[num_epoch]; + auto *vel_x = new double[num_epoch]; + auto *vel_y = new double[num_epoch]; + auto *vel_z = new double[num_epoch]; + auto *cov_xx = new double[num_epoch]; + auto *cov_yy = new double[num_epoch]; + auto *cov_zz = new double[num_epoch]; + auto *cov_xy = new double[num_epoch]; + auto *cov_yz = new double[num_epoch]; + auto *cov_zx = new double[num_epoch]; + auto *latitude = new double[num_epoch]; + auto *longitude = new double[num_epoch]; + auto *height = new double[num_epoch]; + auto *valid_sats = new uint8_t[num_epoch]; + auto *solution_status = new uint8_t[num_epoch]; + auto *solution_type = new uint8_t[num_epoch]; + auto *AR_ratio_factor = new float[num_epoch]; + auto *AR_ratio_threshold = new float[num_epoch]; + auto *gdop = new double[num_epoch]; + auto *pdop = new double[num_epoch]; + auto *hdop = new double[num_epoch]; + auto *vdop = new double[num_epoch]; try { @@ -548,7 +550,7 @@ bool rtklib_solver::get_PVT(const std::map &gnss_observables_ // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); // convert observation from GNSS-SDR class to RTKLIB structure - unsigned char default_code_ = static_cast(CODE_NONE); + auto default_code_ = static_cast(CODE_NONE); obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {default_code_, default_code_, default_code_}, {}, {0.0, 0.0, 0.0}, {}}; @@ -624,7 +626,7 @@ bool rtklib_solver::get_PVT(const std::map &gnss_observables_ // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); // convert observation from GNSS-SDR class to RTKLIB structure - unsigned char default_code_ = static_cast(CODE_NONE); + auto default_code_ = static_cast(CODE_NONE); obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {default_code_, default_code_, default_code_}, {}, {0.0, 0.0, 0.0}, {}}; @@ -671,7 +673,7 @@ bool rtklib_solver::get_PVT(const std::map &gnss_observables_ // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); // convert observation from GNSS-SDR class to RTKLIB structure - unsigned char default_code_ = static_cast(CODE_NONE); + auto default_code_ = static_cast(CODE_NONE); obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {default_code_, default_code_, default_code_}, {}, {0.0, 0.0, 0.0}, {}}; @@ -775,11 +777,11 @@ bool rtklib_solver::get_PVT(const std::map &gnss_observables_ nav_data.n = valid_obs; nav_data.ng = glo_valid_obs; - for (int i = 0; i < MAXSAT; i++) + for (auto & i : nav_data.lam) { - nav_data.lam[i][0] = SPEED_OF_LIGHT / FREQ1; // L1/E1 - nav_data.lam[i][1] = SPEED_OF_LIGHT / FREQ2; // L2 - nav_data.lam[i][2] = SPEED_OF_LIGHT / FREQ5; // L5/E5 + i[0] = SPEED_OF_LIGHT / FREQ1; // L1/E1 + i[1] = SPEED_OF_LIGHT / FREQ2; // L2 + i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5 } result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data); @@ -809,12 +811,12 @@ bool rtklib_solver::get_PVT(const std::map &gnss_observables_ std::vector azel; azel.reserve(used_sats * 2); unsigned int index_aux = 0; - for (unsigned int i = 0; i < MAXSAT; i++) + for (auto & i : rtk_.ssat) { - if (rtk_.ssat[i].vs == 1) + if (i.vs == 1) { - azel[2 * index_aux] = rtk_.ssat[i].azel[0]; - azel[2 * index_aux + 1] = rtk_.ssat[i].azel[1]; + azel[2 * index_aux] = i.azel[0]; + azel[2 * index_aux + 1] = i.azel[1]; index_aux++; } } 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 442f1f85c..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; } @@ -224,7 +221,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code() bool cboc = configuration_->property( "Acquisition" + std::to_string(channel_) + ".cboc", false); - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, cboc, gnss_synchro_->PRN, fs_in_, 0, false); @@ -263,9 +260,9 @@ float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } 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 a9cf7d51a..22262ca2b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -103,7 +103,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( code_ = new gr_complex[vector_length_]; - if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); } @@ -119,7 +119,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acquisition_ = pcps_make_acquisition(acq_parameters); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; - if (item_type_.compare("cbyte") == 0) + if (item_type_ == "cbyte") { cbyte_to_float_x2_ = make_complex_byte_to_float_x2(); float_to_complex_ = gr::blocks::float_to_complex::make(); @@ -221,7 +221,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code() bool cboc = configuration_->property( "Acquisition" + std::to_string(channel_) + ".cboc", false); - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; if (acquire_pilot_ == true) { @@ -272,9 +272,9 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } @@ -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 574f86b21..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; } @@ -258,7 +255,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code() bool cboc = configuration_->property( "Acquisition" + std::to_string(channel_) + ".cboc", false); - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, cboc, gnss_synchro_->PRN, fs_in_, 0, false); @@ -311,7 +308,7 @@ float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa) double val = pow(1.0 - pfa, exponent); double lambda = static_cast(code_length_) / static_cast(folding_factor_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } 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 06d606d50..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; } @@ -228,7 +225,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code() bool cboc = configuration_->property( "Acquisition" + std::to_string(channel_) + ".cboc", false); - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, cboc, gnss_synchro_->PRN, fs_in_, 0, false); @@ -273,9 +270,9 @@ float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } 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 fd6f24e32..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; } @@ -231,8 +228,8 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code() { if (item_type_ == "gr_complex") { - std::complex* codeI = new std::complex[code_length_]; - std::complex* codeQ = new std::complex[code_length_]; + auto* codeI = new std::complex[code_length_]; + auto* codeQ = new std::complex[code_length_]; if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X') { @@ -305,9 +302,9 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 3177705ae..e18e2e0a3 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -208,7 +208,7 @@ void GalileoE5aPcpsAcquisition::init() void GalileoE5aPcpsAcquisition::set_local_code() { - gr_complex* code = new gr_complex[code_length_]; + auto* code = new gr_complex[code_length_]; char signal_[3]; if (acq_iq_) @@ -253,9 +253,9 @@ float GalileoE5aPcpsAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } 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 a2448a81e..9f9cb22d6 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -213,7 +213,7 @@ void GlonassL1CaPcpsAcquisition::init() void GlonassL1CaPcpsAcquisition::set_local_code() { - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; glonass_l1_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0); @@ -257,9 +257,9 @@ float GlonassL1CaPcpsAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = static_cast(vector_length_); + auto lambda = static_cast(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } @@ -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 208989dee..ef6a7dcf1 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc @@ -212,7 +212,7 @@ void GlonassL2CaPcpsAcquisition::init() void GlonassL2CaPcpsAcquisition::set_local_code() { - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; glonass_l2_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0); @@ -256,9 +256,9 @@ float GlonassL2CaPcpsAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = static_cast(vector_length_); + auto lambda = static_cast(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } @@ -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 7787b34cb..2af325c52 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -206,7 +206,7 @@ void GpsL1CaPcpsAcquisition::init() void GpsL1CaPcpsAcquisition::set_local_code() { - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); @@ -245,9 +245,9 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } @@ -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 2abe0c8ea..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 @@ -68,7 +68,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( code_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); /*Calculate the folding factor value based on the calculations*/ - unsigned int temp = static_cast(ceil(sqrt(log2(code_length_)))); + auto temp = static_cast(ceil(sqrt(log2(code_length_)))); folding_factor_ = configuration_->property(role + ".folding_factor", temp); if (sampled_ms_ % folding_factor_ != 0) @@ -231,10 +231,7 @@ signed int GpsL1CaPcpsQuickSyncAcquisition::mag() { return acquisition_cc_->mag(); } - else - { - return 0; - } + return 0; } @@ -249,7 +246,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code() { if (item_type_ == "gr_complex") { - std::complex* code = new std::complex[code_length_](); + auto* code = new std::complex[code_length_](); gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); @@ -299,7 +296,7 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa) double val = pow(1.0 - pfa, exponent); double lambda = static_cast(code_length_) / static_cast(folding_factor_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } 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 5dc2f425b..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; } @@ -210,7 +207,7 @@ void GpsL1CaPcpsTongAcquisition::set_local_code() { if (item_type_ == "gr_complex") { - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); @@ -259,9 +256,9 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } 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 1e4560388..acf415635 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -221,7 +221,7 @@ void GpsL2MPcpsAcquisition::init() void GpsL2MPcpsAcquisition::set_local_code() { - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); @@ -259,9 +259,9 @@ float GpsL2MPcpsAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1.0 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } @@ -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 6e1de1582..16066ebaa 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -209,7 +209,7 @@ void GpsL5iPcpsAcquisition::init() void GpsL5iPcpsAcquisition::set_local_code() { - std::complex* code = new std::complex[code_length_]; + auto* code = new std::complex[code_length_]; gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); @@ -247,9 +247,9 @@ float GpsL5iPcpsAcquisition::calculate_threshold(float pfa) unsigned int ncells = vector_length_ * frequency_bins; double exponent = 1.0 / static_cast(ncells); double val = pow(1.0 - pfa, exponent); - double lambda = double(vector_length_); + auto lambda = double(vector_length_); boost::math::exponential_distribution mydist(lambda); - float threshold = static_cast(quantile(mydist, val)); + auto threshold = static_cast(quantile(mydist, val)); return threshold; } @@ -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/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index e87390899..c884bcf34 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -42,6 +42,7 @@ #include #include #include +#include using google::LogMessage; @@ -59,7 +60,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make { return galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr( new galileo_e5a_noncoherentIQ_acquisition_caf_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, - samples_per_code, bit_transition_flag, dump, dump_filename, both_signal_components_, CAF_window_hz_, Zero_padding_)); + samples_per_code, bit_transition_flag, dump, std::move(dump_filename), both_signal_components_, CAF_window_hz_, Zero_padding_)); } @@ -152,7 +153,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit // For dumping samples into a file d_dump = dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_doppler_resolution = 0; d_threshold = 0; @@ -393,7 +394,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items } case 1: { - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer unsigned int buff_increment; if ((ninput_items[0] + d_buffer_count) <= d_fft_size) { @@ -417,7 +418,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items case 2: { // Fill last part of the buffer and reset counter - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer if (d_buffer_count < d_fft_size) { memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * (d_fft_size - d_buffer_count)); @@ -674,7 +675,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items if (d_CAF_window_hz > 0) { int CAF_bins_half; - float *accum = static_cast(volk_gnsssdr_malloc(sizeof(float), volk_gnsssdr_get_alignment())); + auto *accum = static_cast(volk_gnsssdr_malloc(sizeof(float), volk_gnsssdr_get_alignment())); CAF_bins_half = d_CAF_window_hz / (2 * d_doppler_step); float weighting_factor; weighting_factor = 0.5 / static_cast(CAF_bins_half); diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index d502c4cb2..eaf7ff134 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -31,6 +31,7 @@ #include "galileo_pcps_8ms_acquisition_cc.h" #include +#include #include #include #include @@ -47,7 +48,7 @@ galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc( { return galileo_pcps_8ms_acquisition_cc_sptr( new galileo_pcps_8ms_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, - samples_per_code, dump, dump_filename)); + samples_per_code, dump, std::move(dump_filename))); } galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc( @@ -87,7 +88,7 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc( // For dumping samples into a file d_dump = dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_doppler_resolution = 0; d_threshold = 0; @@ -246,7 +247,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, float magt = 0.0; float magt_A = 0.0; float magt_B = 0.0; - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size); d_input_power = 0.0; d_mag = 0.0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index a7df810a7..224a873e6 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -158,10 +158,10 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu { std::string dump_path; // Get 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 @@ -173,9 +173,9 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu d_dump_filename = "acquisition"; } // 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; // create directory @@ -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; @@ -472,7 +472,7 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size) Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarFree(matvar); - float aux = static_cast(d_gnss_synchro->Acq_doppler_hz); + auto aux = static_cast(d_gnss_synchro->Acq_doppler_hz); matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarFree(matvar); @@ -927,7 +927,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), uint32_t buff_increment; if (d_cshort) { - const lv_16sc_t* in = reinterpret_cast(input_items[0]); // Get the input samples pointer + const auto* in = reinterpret_cast(input_items[0]); // Get the input samples pointer if ((ninput_items[0] + d_buffer_count) <= d_consumed_samples) { buff_increment = ninput_items[0]; @@ -940,7 +940,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), } else { - const gr_complex* in = reinterpret_cast(input_items[0]); // Get the input samples pointer + const auto* in = reinterpret_cast(input_items[0]); // Get the input samples pointer if ((ninput_items[0] + d_buffer_count) <= d_consumed_samples) { buff_increment = ninput_items[0]; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 8b80cb3e3..3e19bee55 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -91,10 +91,10 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con { std::string dump_path; // Get 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 @@ -106,9 +106,9 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con d_dump_filename = "acquisition"; } // 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; // create directory @@ -337,7 +337,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF() float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_void_star &input_items) { - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer // Compute the input signal power estimation float power = 0; volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size); @@ -350,7 +350,7 @@ float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_voi int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items) { // initialize acquisition algorithm - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer DLOG(INFO) << "Channel: " << d_channel << " , doing acquisition of satellite: " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN @@ -359,7 +359,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons << ", doppler_step: " << d_doppler_step; // 2- Doppler frequency search loop - float *p_tmp_vector = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); + auto *p_tmp_vector = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++) { @@ -405,12 +405,12 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() int signal_samples = prn_replicas * d_fft_size; //int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor); int fft_size_extended = signal_samples * zero_padding_factor; - gr::fft::fft_complex *fft_operator = new gr::fft::fft_complex(fft_size_extended, true); + auto *fft_operator = new gr::fft::fft_complex(fft_size_extended, true); //zero padding the entire vector std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0)); //1. generate local code aligned with the acquisition code phase estimation - gr_complex *code_replica = static_cast(volk_gnsssdr_malloc(signal_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto *code_replica = static_cast(volk_gnsssdr_malloc(signal_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment())); gps_l1_ca_code_gen_complex_sampled(code_replica, d_gnss_synchro->PRN, d_fs_in, 0); @@ -433,7 +433,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() fft_operator->execute(); // 4. Compute the magnitude and find the maximum - float *p_tmp_vector = static_cast(volk_gnsssdr_malloc(fft_size_extended * sizeof(float), volk_gnsssdr_get_alignment())); + auto *p_tmp_vector = static_cast(volk_gnsssdr_malloc(fft_size_extended * sizeof(float), volk_gnsssdr_get_alignment())); volk_32fc_magnitude_squared_32f(p_tmp_vector, fft_operator->get_outbuf(), fft_size_extended); @@ -442,7 +442,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() //case even int counter = 0; - float *fftFreqBins = new float[fft_size_extended]; + auto *fftFreqBins = new float[fft_size_extended]; std::fill_n(fftFreqBins, fft_size_extended, 0.0); @@ -699,7 +699,7 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size) Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarFree(matvar); - float aux = static_cast(d_gnss_synchro->Acq_doppler_hz); + auto aux = static_cast(d_gnss_synchro->Acq_doppler_hz); matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarFree(matvar); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc index 7bf74c2b0..43850040b 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -32,6 +32,7 @@ #include "pcps_assisted_acquisition_cc.h" #include +#include #include #include #include @@ -52,7 +53,7 @@ pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc( { return pcps_assisted_acquisition_cc_sptr( new pcps_assisted_acquisition_cc(max_dwells, sampled_ms, doppler_max, doppler_min, - fs_in, samples_per_ms, dump, dump_filename)); + fs_in, samples_per_ms, dump, std::move(dump_filename))); } @@ -89,7 +90,7 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc( // For dumping samples into a file d_dump = dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_doppler_resolution = 0; d_threshold = 0; @@ -301,9 +302,9 @@ double pcps_assisted_acquisition_cc::search_maximum() float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_star &input_items) { - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer // 1- Compute the input signal power estimation - float *p_tmp_vector = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); + auto *p_tmp_vector = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); volk_32fc_magnitude_squared_32f(p_tmp_vector, in, d_fft_size); @@ -318,7 +319,7 @@ float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_st int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items) { // initialize acquisition algorithm - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer DLOG(INFO) << "Channel: " << d_channel << " , doing acquisition of satellite: " << d_gnss_synchro->System << " " @@ -328,7 +329,7 @@ int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_vo << ", doppler_step: " << d_doppler_step; // 2- Doppler frequency search loop - float *p_tmp_vector = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); + auto *p_tmp_vector = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++) { diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc index 11aaf81c1..e0872e9eb 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -36,6 +36,7 @@ #include "pcps_cccwsr_acquisition_cc.h" #include +#include #include #include #include @@ -54,7 +55,7 @@ pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc( { return pcps_cccwsr_acquisition_cc_sptr( new pcps_cccwsr_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, - samples_per_ms, samples_per_code, dump, dump_filename)); + samples_per_ms, samples_per_code, dump, std::move(dump_filename))); } pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc( @@ -98,7 +99,7 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc( // For dumping samples into a file d_dump = dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_doppler_resolution = 0; d_threshold = 0; @@ -261,7 +262,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items, float magt = 0.0; float magt_plus = 0.0; float magt_minus = 0.0; - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size); d_sample_counter += static_cast(d_fft_size); // sample counter diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index cc893cb77..159f09978 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -37,6 +37,7 @@ #include #include #include +#include using google::LogMessage; @@ -57,7 +58,7 @@ pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc( fs_in, samples_per_ms, samples_per_code, bit_transition_flag, - dump, dump_filename)); + dump, std::move(dump_filename))); } @@ -110,7 +111,7 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc( // For dumping samples into a file d_dump = dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_corr_acumulator = nullptr; d_signal_folded = nullptr; @@ -304,18 +305,18 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, int doppler; uint32_t indext = 0; float magt = 0.0; - const gr_complex* in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto* in = reinterpret_cast(input_items[0]); //Get the input samples pointer - gr_complex* in_temp = static_cast(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment())); - gr_complex* in_temp_folded = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* in_temp = static_cast(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* in_temp_folded = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); /*Create a signal to store a signal of size 1ms, to perform correlation in time. No folding on this data is required*/ - gr_complex* in_1code = static_cast(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* in_1code = static_cast(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment())); /*Stores the values of the correlation output between the local code and the signal with doppler shift corrected */ - gr_complex* corr_output = static_cast(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* corr_output = static_cast(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment())); /*Stores a copy of the folded version of the signal.This is used for the FFT operations in future steps of execution*/ diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index 2d789b9a7..47617e953 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -56,6 +56,7 @@ #include #include #include +#include using google::LogMessage; @@ -68,7 +69,7 @@ pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc( { return pcps_tong_acquisition_cc_sptr( new pcps_tong_acquisition_cc(sampled_ms, doppler_max, fs_in, samples_per_ms, samples_per_code, - tong_init_val, tong_max_val, tong_max_dwells, dump, dump_filename)); + tong_init_val, tong_max_val, tong_max_dwells, dump, std::move(dump_filename))); } pcps_tong_acquisition_cc::pcps_tong_acquisition_cc( @@ -111,7 +112,7 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc( // For dumping samples into a file d_dump = dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_doppler_resolution = 0; d_threshold = 0; @@ -282,7 +283,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, int doppler; uint32_t indext = 0; float magt = 0.0; - const gr_complex *in = reinterpret_cast(input_items[0]); //Get the input samples pointer + const auto *in = reinterpret_cast(input_items[0]); //Get the input samples pointer float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size); d_input_power = 0.0; d_mag = 0.0; 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/conditioner/adapters/array_signal_conditioner.cc b/src/algorithms/conditioner/adapters/array_signal_conditioner.cc index 552d6d058..f664c1de1 100644 --- a/src/algorithms/conditioner/adapters/array_signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/array_signal_conditioner.cc @@ -32,6 +32,8 @@ #include "array_signal_conditioner.h" #include +#include + using google::LogMessage; @@ -41,11 +43,11 @@ ArraySignalConditioner::ArraySignalConditioner(ConfigurationInterface *configura std::shared_ptr in_filt, std::shared_ptr res, std::string role, - std::string implementation) : data_type_adapt_(data_type_adapt), - in_filt_(in_filt), - res_(res), - role_(role), - implementation_(implementation) + std::string implementation) : data_type_adapt_(std::move(data_type_adapt)), + in_filt_(std::move(in_filt)), + res_(std::move(res)), + role_(std::move(role)), + implementation_(std::move(implementation)) { connected_ = false; if (configuration) diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.cc b/src/algorithms/conditioner/adapters/signal_conditioner.cc index c8045fec2..0a7518e16 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/signal_conditioner.cc @@ -32,6 +32,8 @@ #include "signal_conditioner.h" #include +#include + using google::LogMessage; @@ -41,11 +43,11 @@ SignalConditioner::SignalConditioner(ConfigurationInterface *configuration, std::shared_ptr in_filt, std::shared_ptr res, std::string role, - std::string implementation) : data_type_adapt_(data_type_adapt), - in_filt_(in_filt), - res_(res), - role_(role), - implementation_(implementation) + std::string implementation) : data_type_adapt_(std::move(data_type_adapt)), + in_filt_(std::move(in_filt)), + res_(std::move(res)), + role_(std::move(role)), + implementation_(std::move(implementation)) { connected_ = false; if (configuration) diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index daf6a3e9a..0c5a29c24 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -32,11 +32,13 @@ #include "configuration_interface.h" #include +#include + using google::LogMessage; ByteToShort::ByteToShort(ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) + unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { std::string default_input_item_type = "byte"; std::string default_output_item_type = "short"; 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 e8543e460..5cfbd4186 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -36,7 +36,7 @@ using google::LogMessage; -IbyteToCbyte::IbyteToCbyte(ConfigurationInterface* configuration, std::string role, +IbyteToCbyte::IbyteToCbyte(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_input_item_type = "byte"; @@ -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_cbyte.h b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.h index 7f0b83483..3fb202a1a 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.h +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.h @@ -48,7 +48,7 @@ class IbyteToCbyte : public GNSSBlockInterface { public: IbyteToCbyte(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, + const std::string& role, unsigned int in_streams, unsigned int out_streams); virtual ~IbyteToCbyte(); 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 c6b5d66d0..cd8c14850 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -34,7 +34,7 @@ using google::LogMessage; -IbyteToComplex::IbyteToComplex(ConfigurationInterface* configuration, std::string role, +IbyteToComplex::IbyteToComplex(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_input_item_type = "byte"; @@ -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_complex.h b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.h index c768e4b46..677ba11e8 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.h +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.h @@ -48,7 +48,7 @@ class IbyteToComplex : public GNSSBlockInterface { public: IbyteToComplex(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, + const std::string& role, unsigned int in_streams, unsigned int out_streams); virtual ~IbyteToComplex(); 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 cc901d4a1..f4c8b6207 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -37,7 +37,7 @@ using google::LogMessage; -IbyteToCshort::IbyteToCshort(ConfigurationInterface* configuration, std::string role, +IbyteToCshort::IbyteToCshort(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_input_item_type = "byte"; @@ -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/ibyte_to_cshort.h b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.h index cc94b866f..73e64da0d 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.h +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.h @@ -48,7 +48,7 @@ class IbyteToCshort : public GNSSBlockInterface { public: IbyteToCshort(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, + const std::string& role, unsigned int in_streams, unsigned int out_streams); virtual ~IbyteToCshort(); 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 27cb17afa..918dbd8a3 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -34,7 +34,7 @@ using google::LogMessage; -IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::string role, +IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_input_item_type = "short"; @@ -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_complex.h b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h index 8a60afa15..7359cfae1 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h @@ -47,7 +47,7 @@ class IshortToComplex : public GNSSBlockInterface { public: IshortToComplex(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, + const std::string& role, unsigned int in_streams, unsigned int out_streams); virtual ~IshortToComplex(); 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 1f41f20c4..c6a7d7490 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -36,7 +36,7 @@ using google::LogMessage; -IshortToCshort::IshortToCshort(ConfigurationInterface* configuration, std::string role, +IshortToCshort::IshortToCshort(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_input_item_type = "short"; @@ -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/data_type_adapter/adapters/ishort_to_cshort.h b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.h index 382ce7716..925065a1d 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.h +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.h @@ -48,7 +48,7 @@ class IshortToCshort : public GNSSBlockInterface { public: IshortToCshort(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, + const std::string& role, unsigned int in_streams, unsigned int out_streams); virtual ~IshortToCshort(); diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_byte.cc b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_byte.cc index f41662ed7..c5c854334 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_byte.cc +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_byte.cc @@ -54,8 +54,8 @@ int interleaved_byte_to_complex_byte::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const int8_t *in = reinterpret_cast(input_items[0]); - lv_8sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); // This could be put into a Volk kernel int8_t real_part; int8_t imag_part; diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_short.cc b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_short.cc index c8b288f9b..b6e5368b8 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_short.cc +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_byte_to_complex_short.cc @@ -54,8 +54,8 @@ int interleaved_byte_to_complex_short::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const int8_t *in = reinterpret_cast(input_items[0]); - lv_16sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); // This could be put into a Volk kernel int8_t real_part; int8_t imag_part; diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.cc b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.cc index fe4106ea8..bf88a2ea5 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.cc +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.cc @@ -54,8 +54,8 @@ int interleaved_short_to_complex_short::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const int16_t *in = reinterpret_cast(input_items[0]); - lv_16sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); // This could be put into a Volk kernel int16_t real_part; int16_t imag_part; diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index 58b76bf75..52c19352d 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -38,7 +38,7 @@ using google::LogMessage; BeamformerFilter::BeamformerFilter( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "gr_complex"; @@ -48,7 +48,7 @@ BeamformerFilter::BeamformerFilter( DLOG(INFO) << "dump_ is " << dump_; dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); beamformer_ = make_beamformer(); diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.h b/src/algorithms/input_filter/adapters/beamformer_filter.h index 78fec45ca..c97c32732 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.h +++ b/src/algorithms/input_filter/adapters/beamformer_filter.h @@ -46,7 +46,7 @@ class BeamformerFilter : public GNSSBlockInterface { public: BeamformerFilter(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream); virtual ~BeamformerFilter(); diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index dc3445fed..5ed87fd75 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -32,6 +32,7 @@ #include "fir_filter.h" #include "configuration_interface.h" #include +#include #include #include #include @@ -40,11 +41,11 @@ using google::LogMessage; FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) + unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { size_t item_size; (*this).init(); - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { item_size = sizeof(gr_complex); fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(1, taps_); @@ -55,7 +56,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) { item_size = sizeof(lv_16sc_t); cshort_to_float_x2_ = make_cshort_to_float_x2(); @@ -72,7 +73,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex")) { item_size = sizeof(gr_complex); cshort_to_float_x2_ = make_cshort_to_float_x2(); @@ -88,7 +89,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex")) { item_size = sizeof(gr_complex); cbyte_to_float_x2_ = make_complex_byte_to_float_x2(); @@ -106,7 +107,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte")) { item_size = sizeof(lv_8sc_t); cbyte_to_float_x2_ = make_complex_byte_to_float_x2(); @@ -147,7 +148,7 @@ FirFilter::~FirFilter() = default; void FirFilter::connect(gr::top_block_sptr top_block) { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { if (dump_) { @@ -158,7 +159,7 @@ void FirFilter::connect(gr::top_block_sptr top_block) DLOG(INFO) << "Nothing to connect internally"; } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) { top_block->connect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0); top_block->connect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0); @@ -171,7 +172,7 @@ void FirFilter::connect(gr::top_block_sptr top_block) top_block->connect(short_x2_to_cshort_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex")) { top_block->connect(cbyte_to_float_x2_, 0, fir_filter_fff_1_, 0); top_block->connect(cbyte_to_float_x2_, 1, fir_filter_fff_2_, 0); @@ -182,7 +183,7 @@ void FirFilter::connect(gr::top_block_sptr top_block) top_block->connect(float_to_complex_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte")) { top_block->connect(cbyte_to_float_x2_, 0, fir_filter_fff_1_, 0); top_block->connect(cbyte_to_float_x2_, 1, fir_filter_fff_2_, 0); @@ -195,7 +196,7 @@ void FirFilter::connect(gr::top_block_sptr top_block) top_block->connect(char_x2_cbyte_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex")) { top_block->connect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0); top_block->connect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0); @@ -215,14 +216,14 @@ void FirFilter::connect(gr::top_block_sptr top_block) void FirFilter::disconnect(gr::top_block_sptr top_block) { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { if (dump_) { top_block->disconnect(fir_filter_ccf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex")) { top_block->disconnect(fir_filter_fff_2_, 0, float_to_complex_, 1); top_block->disconnect(fir_filter_fff_1_, 0, float_to_complex_, 0); @@ -233,7 +234,7 @@ void FirFilter::disconnect(gr::top_block_sptr top_block) top_block->disconnect(float_to_complex_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) { top_block->disconnect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0); top_block->disconnect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0); @@ -246,7 +247,7 @@ void FirFilter::disconnect(gr::top_block_sptr top_block) top_block->disconnect(short_x2_to_cshort_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte")) { top_block->disconnect(float_to_char_2_, 0, char_x2_cbyte_, 1); top_block->disconnect(float_to_char_1_, 0, char_x2_cbyte_, 0); @@ -259,7 +260,7 @@ void FirFilter::disconnect(gr::top_block_sptr top_block) top_block->disconnect(char_x2_cbyte_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex")) { top_block->disconnect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0); top_block->disconnect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0); @@ -279,23 +280,23 @@ void FirFilter::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr FirFilter::get_left_block() { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { return fir_filter_ccf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) { return cshort_to_float_x2_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex")) { return cbyte_to_float_x2_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte")) { return cbyte_to_float_x2_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex")) { return cshort_to_float_x2_; } @@ -309,23 +310,23 @@ gr::basic_block_sptr FirFilter::get_left_block() gr::basic_block_sptr FirFilter::get_right_block() { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { return fir_filter_ccf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort")) { return short_x2_to_cshort_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex")) { return float_to_complex_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte")) { return char_x2_cbyte_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex")) { return float_to_complex_; } @@ -398,8 +399,8 @@ 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 (std::vector::iterator it = taps_d.begin(); it != taps_d.end(); it++) + for (double & it : taps_d) { - taps_.push_back(float(*it)); + 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 684813f02..643929db7 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -32,6 +32,7 @@ #include "freq_xlating_fir_filter.h" #include "configuration_interface.h" #include +#include #include #include #include @@ -41,7 +42,7 @@ using google::LogMessage; FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) + unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { std::string default_input_item_type = "gr_complex"; std::string default_output_item_type = "gr_complex"; @@ -72,7 +73,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type); decimation_factor_ = config_->property(role_ + ".decimation_factor", default_decimation_factor); - if (filter_type.compare("lowpass") != 0) + if (filter_type != "lowpass") { std::vector taps_d; std::vector bands; @@ -107,9 +108,9 @@ 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 (std::vector::iterator it = taps_d.begin(); it != taps_d.end(); it++) + for (double & it : taps_d) { - taps_.push_back(static_cast(*it)); + taps_.push_back(static_cast(it)); } } else @@ -123,28 +124,28 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration size_t item_size; - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { item_size = sizeof(gr_complex); //output input_size_ = sizeof(gr_complex); //input freq_xlating_fir_filter_ccf_ = gr::filter::freq_xlating_fir_filter_ccf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_); DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_ccf_->unique_id() << ")"; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) { item_size = sizeof(gr_complex); input_size_ = sizeof(float); //input freq_xlating_fir_filter_fcf_ = gr::filter::freq_xlating_fir_filter_fcf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_); DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_fcf_->unique_id() << ")"; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex")) { item_size = sizeof(gr_complex); input_size_ = sizeof(int16_t); //input freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_); DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")"; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort")) { item_size = sizeof(lv_16sc_t); input_size_ = sizeof(int16_t); //input @@ -155,7 +156,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration float_to_short_2_ = gr::blocks::float_to_short::make(); short_x2_to_cshort_ = make_short_x2_to_cshort(); } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex")) { item_size = sizeof(gr_complex); input_size_ = sizeof(int8_t); //input @@ -163,7 +164,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_); DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")"; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte")) { item_size = sizeof(lv_8sc_t); input_size_ = sizeof(int8_t); //input @@ -201,28 +202,28 @@ FreqXlatingFirFilter::~FreqXlatingFirFilter() = default; void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block) { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { if (dump_) { top_block->connect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) { if (dump_) { top_block->connect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex")) { if (dump_) { top_block->connect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort")) { top_block->connect(freq_xlating_fir_filter_scf_, 0, complex_to_float_, 0); top_block->connect(complex_to_float_, 0, float_to_short_1_, 0); @@ -234,7 +235,7 @@ void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block) top_block->connect(short_x2_to_cshort_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex")) { top_block->connect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0); if (dump_) @@ -242,7 +243,7 @@ void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block) top_block->connect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte")) { top_block->connect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0); top_block->connect(freq_xlating_fir_filter_scf_, 0, complex_to_complex_byte_, 0); @@ -260,28 +261,28 @@ void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block) void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block) { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { if (dump_) { top_block->disconnect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) { if (dump_) { top_block->disconnect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex")) { if (dump_) { top_block->disconnect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort")) { top_block->disconnect(freq_xlating_fir_filter_scf_, 0, complex_to_float_, 0); top_block->disconnect(complex_to_float_, 0, float_to_short_1_, 0); @@ -293,7 +294,7 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block) top_block->disconnect(short_x2_to_cshort_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex")) { top_block->disconnect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0); if (dump_) @@ -301,7 +302,7 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block) top_block->disconnect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0); } } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte")) { top_block->disconnect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0); top_block->disconnect(freq_xlating_fir_filter_scf_, 0, complex_to_complex_byte_, 0); @@ -319,27 +320,27 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr FreqXlatingFirFilter::get_left_block() { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_ccf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_fcf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_scf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort")) { return freq_xlating_fir_filter_scf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex")) { return gr_char_to_short_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte")) { return gr_char_to_short_; } @@ -353,27 +354,27 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_left_block() gr::basic_block_sptr FreqXlatingFirFilter::get_right_block() { - if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_ccf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0)) + if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_fcf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_scf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort")) { return short_x2_to_cshort_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex")) { return freq_xlating_fir_filter_scf_; } - else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0)) + else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte")) { return complex_to_complex_byte_; } diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index dd4f16978..c9264e0f7 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -38,7 +38,7 @@ using google::LogMessage; -NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role, +NotchFilter::NotchFilter(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { size_t item_size_; @@ -63,7 +63,7 @@ NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role length_ = configuration->property(role + ".length", default_length_); n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est); n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset); - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); notch_filter_ = make_notch_filter(pfa, p_c_factor, length_, n_segments_est, n_segments_reset); diff --git a/src/algorithms/input_filter/adapters/notch_filter.h b/src/algorithms/input_filter/adapters/notch_filter.h index 3bdf5c688..bf7e4f2db 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.h +++ b/src/algorithms/input_filter/adapters/notch_filter.h @@ -45,7 +45,7 @@ class NotchFilter : public GNSSBlockInterface { public: NotchFilter(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, + const std::string& role, unsigned int in_streams, unsigned int out_streams); virtual ~NotchFilter(); diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index 5aa615f1a..3c83369d5 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -38,7 +38,7 @@ using google::LogMessage; -NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, std::string role, +NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { size_t item_size_; @@ -70,7 +70,7 @@ NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, std::str n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset); int n_segments_coeff = static_cast((samp_freq / coeff_rate) / static_cast(length_)); n_segments_coeff = std::max(1, n_segments_coeff); - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); notch_filter_lite_ = make_notch_filter_lite(p_c_factor, pfa, length_, n_segments_est, n_segments_reset, n_segments_coeff); diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.h b/src/algorithms/input_filter/adapters/notch_filter_lite.h index 901326579..d8352706d 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.h +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.h @@ -45,7 +45,7 @@ class NotchFilterLite : public GNSSBlockInterface { public: NotchFilterLite(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, + const std::string& role, unsigned int in_streams, unsigned int out_streams); virtual ~NotchFilterLite(); diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index bedb22a90..236ecd4cc 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -33,13 +33,14 @@ #include #include #include +#include #include #include using google::LogMessage; PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams) + unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { size_t item_size; xlat_ = false; @@ -61,7 +62,7 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, int n_segments_est = config_->property(role_ + ".segments_est", default_n_segments_est); int default_n_segments_reset = 5000000; int n_segments_reset = config_->property(role_ + ".segments_reset", default_n_segments_reset); - if (input_item_type_.compare("gr_complex") == 0) + if (input_item_type_ == "gr_complex") { item_size = sizeof(gr_complex); //output input_size_ = sizeof(gr_complex); //input @@ -110,7 +111,7 @@ PulseBlankingFilter::~PulseBlankingFilter() = default; void PulseBlankingFilter::connect(gr::top_block_sptr top_block) { - if (input_item_type_.compare("gr_complex") == 0) + if (input_item_type_ == "gr_complex") { if (dump_) { @@ -131,7 +132,7 @@ void PulseBlankingFilter::connect(gr::top_block_sptr top_block) void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block) { - if (input_item_type_.compare("gr_complex") == 0) + if (input_item_type_ == "gr_complex") { if (dump_) { @@ -151,34 +152,28 @@ void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr PulseBlankingFilter::get_left_block() { - if (input_item_type_.compare("gr_complex") == 0) + if (input_item_type_ == "gr_complex") { if (xlat_) { 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; } } gr::basic_block_sptr PulseBlankingFilter::get_right_block() { - if (input_item_type_.compare("gr_complex") == 0) + if (input_item_type_ == "gr_complex") { 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/input_filter/gnuradio_blocks/beamformer.cc b/src/algorithms/input_filter/gnuradio_blocks/beamformer.cc index afd217338..0fc773efa 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/beamformer.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/beamformer.cc @@ -69,7 +69,7 @@ beamformer::~beamformer() int beamformer::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - gr_complex *out = reinterpret_cast(output_items[0]); + auto *out = reinterpret_cast(output_items[0]); // channel output buffers // gr_complex *ch1 = (gr_complex *) input_items[0]; // gr_complex *ch2 = (gr_complex *) input_items[1]; diff --git a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc index d7cc09c33..a969a7a36 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc @@ -86,9 +86,9 @@ Notch::~Notch() void Notch::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required) { - for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++) + for (int & aux : ninput_items_required) { - ninput_items_required[aux] = length_; + aux = length_; } } @@ -100,8 +100,8 @@ int Notch::general_work(int noutput_items, gr_vector_int &ninput_items __attribu float sig2dB = 0.0; float sig2lin = 0.0; lv_32fc_t dot_prod_; - const gr_complex *in = reinterpret_cast(input_items[0]); - gr_complex *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); in++; while ((index_out + length_) < noutput_items) { diff --git a/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc index 435b36470..b379fc664 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc @@ -89,9 +89,9 @@ NotchLite::~NotchLite() void NotchLite::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required) { - for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++) + for (int & aux : ninput_items_required) { - ninput_items_required[aux] = length_; + aux = length_; } } @@ -103,8 +103,8 @@ int NotchLite::general_work(int noutput_items, gr_vector_int &ninput_items __att float sig2dB = 0.0; float sig2lin = 0.0; lv_32fc_t dot_prod_; - const gr_complex *in = reinterpret_cast(input_items[0]); - gr_complex *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); in++; while ((index_out + length_) < noutput_items) { diff --git a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc index ea1232c30..f7e51f650 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc @@ -79,9 +79,9 @@ pulse_blanking_cc::~pulse_blanking_cc() void pulse_blanking_cc::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required) { - for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++) + for (int & aux : ninput_items_required) { - ninput_items_required[aux] = length_; + aux = length_; } } @@ -89,9 +89,9 @@ void pulse_blanking_cc::forecast(int noutput_items __attribute__((unused)), gr_v int pulse_blanking_cc::general_work(int noutput_items, gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const gr_complex *in = reinterpret_cast(input_items[0]); - gr_complex *out = reinterpret_cast(output_items[0]); - float *magnitude = static_cast(volk_malloc(noutput_items * sizeof(float), volk_get_alignment())); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); + auto *magnitude = static_cast(volk_malloc(noutput_items * sizeof(float), volk_get_alignment())); volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items); int32_t sample_index = 0; float segment_energy; diff --git a/src/algorithms/libs/byte_x2_to_complex_byte.cc b/src/algorithms/libs/byte_x2_to_complex_byte.cc index 7945f9573..a3a78c067 100644 --- a/src/algorithms/libs/byte_x2_to_complex_byte.cc +++ b/src/algorithms/libs/byte_x2_to_complex_byte.cc @@ -53,9 +53,9 @@ int byte_x2_to_complex_byte::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const int8_t *in0 = reinterpret_cast(input_items[0]); - const int8_t *in1 = reinterpret_cast(input_items[1]); - lv_8sc_t *out = reinterpret_cast(output_items[0]); + const auto *in0 = reinterpret_cast(input_items[0]); + const auto *in1 = reinterpret_cast(input_items[1]); + auto *out = reinterpret_cast(output_items[0]); // This could be put into a volk kernel int8_t real_part; int8_t imag_part; diff --git a/src/algorithms/libs/complex_byte_to_float_x2.cc b/src/algorithms/libs/complex_byte_to_float_x2.cc index ae0409d99..04f4a54b2 100644 --- a/src/algorithms/libs/complex_byte_to_float_x2.cc +++ b/src/algorithms/libs/complex_byte_to_float_x2.cc @@ -53,9 +53,9 @@ int complex_byte_to_float_x2::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const lv_8sc_t *in = reinterpret_cast(input_items[0]); - float *out0 = reinterpret_cast(output_items[0]); - float *out1 = reinterpret_cast(output_items[1]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out0 = reinterpret_cast(output_items[0]); + auto *out1 = reinterpret_cast(output_items[1]); const float scalar = 1; volk_8ic_s32f_deinterleave_32f_x2(out0, out1, in, scalar, noutput_items); return noutput_items; diff --git a/src/algorithms/libs/complex_float_to_complex_byte.cc b/src/algorithms/libs/complex_float_to_complex_byte.cc index 57576a9b1..d7106bedd 100644 --- a/src/algorithms/libs/complex_float_to_complex_byte.cc +++ b/src/algorithms/libs/complex_float_to_complex_byte.cc @@ -53,8 +53,8 @@ int complex_float_to_complex_byte::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const gr_complex *in = reinterpret_cast(input_items[0]); - lv_8sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); volk_gnsssdr_32fc_convert_8ic(out, in, noutput_items); return noutput_items; } diff --git a/src/algorithms/libs/conjugate_cc.cc b/src/algorithms/libs/conjugate_cc.cc index 2a61e1526..67077ba23 100644 --- a/src/algorithms/libs/conjugate_cc.cc +++ b/src/algorithms/libs/conjugate_cc.cc @@ -52,8 +52,8 @@ int conjugate_cc::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const gr_complex *in = reinterpret_cast(input_items[0]); - gr_complex *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); volk_32fc_conjugate_32fc(out, in, noutput_items); return noutput_items; } diff --git a/src/algorithms/libs/conjugate_ic.cc b/src/algorithms/libs/conjugate_ic.cc index c26f48388..d3d00932e 100644 --- a/src/algorithms/libs/conjugate_ic.cc +++ b/src/algorithms/libs/conjugate_ic.cc @@ -52,8 +52,8 @@ int conjugate_ic::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const lv_8sc_t *in = reinterpret_cast(input_items[0]); - lv_8sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); volk_gnsssdr_8ic_conjugate_8ic(out, in, noutput_items); return noutput_items; } diff --git a/src/algorithms/libs/conjugate_sc.cc b/src/algorithms/libs/conjugate_sc.cc index e62c6cc42..e23f1c1a4 100644 --- a/src/algorithms/libs/conjugate_sc.cc +++ b/src/algorithms/libs/conjugate_sc.cc @@ -52,8 +52,8 @@ int conjugate_sc::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const lv_16sc_t *in = reinterpret_cast(input_items[0]); - lv_16sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); volk_gnsssdr_16ic_conjugate_16ic(out, in, noutput_items); return noutput_items; } diff --git a/src/algorithms/libs/cshort_to_float_x2.cc b/src/algorithms/libs/cshort_to_float_x2.cc index accdb7826..cfde3f79c 100644 --- a/src/algorithms/libs/cshort_to_float_x2.cc +++ b/src/algorithms/libs/cshort_to_float_x2.cc @@ -53,9 +53,9 @@ int cshort_to_float_x2::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const lv_16sc_t *in = reinterpret_cast(input_items[0]); - float *out0 = reinterpret_cast(output_items[0]); - float *out1 = reinterpret_cast(output_items[1]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out0 = reinterpret_cast(output_items[0]); + auto *out1 = reinterpret_cast(output_items[1]); const float scalar = 1; volk_16ic_s32f_deinterleave_32f_x2(out0, out1, in, scalar, noutput_items); return noutput_items; diff --git a/src/algorithms/libs/galileo_e1_signal_processing.cc b/src/algorithms/libs/galileo_e1_signal_processing.cc index 3aaf2047c..14dfab908 100644 --- a/src/algorithms/libs/galileo_e1_signal_processing.cc +++ b/src/algorithms/libs/galileo_e1_signal_processing.cc @@ -51,17 +51,17 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], int32_t _prn) if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2) { - for (size_t i = 0; i < Galileo_E1_B_PRIMARY_CODE[prn].length(); i++) + for (char i : Galileo_E1_B_PRIMARY_CODE[prn]) { - hex_to_binary_converter(&_dest[index], Galileo_E1_B_PRIMARY_CODE[prn].at(i)); + hex_to_binary_converter(&_dest[index], i); index += 4; } } else if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2) { - for (size_t i = 0; i < Galileo_E1_C_PRIMARY_CODE[prn].length(); i++) + for (char i : Galileo_E1_C_PRIMARY_CODE[prn]) { - hex_to_binary_converter(&_dest[index], Galileo_E1_C_PRIMARY_CODE[prn].at(i)); + hex_to_binary_converter(&_dest[index], i); index += 4; } } @@ -71,7 +71,7 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], int32_t _prn) void galileo_e1_sinboc_11_gen_int(int* _dest, int* _prn, uint32_t _length_out) { const uint32_t _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS; - uint32_t _period = static_cast(_length_out / _length_in); + auto _period = static_cast(_length_out / _length_in); for (uint32_t i = 0; i < _length_in; i++) { for (uint32_t j = 0; j < (_period / 2); j++) @@ -89,7 +89,7 @@ void galileo_e1_sinboc_11_gen_int(int* _dest, int* _prn, uint32_t _length_out) void galileo_e1_sinboc_61_gen_int(int* _dest, int* _prn, uint32_t _length_out) { const uint32_t _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS; - uint32_t _period = static_cast(_length_out / _length_in); + auto _period = static_cast(_length_out / _length_in); for (uint32_t i = 0; i < _length_in; i++) { @@ -108,7 +108,7 @@ void galileo_e1_sinboc_61_gen_int(int* _dest, int* _prn, uint32_t _length_out) void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], uint32_t _prn) { std::string _galileo_signal = _Signal; - const uint32_t _codeLength = static_cast(Galileo_E1_B_CODE_LENGTH_CHIPS); + const auto _codeLength = static_cast(Galileo_E1_B_CODE_LENGTH_CHIPS); int32_t primary_code_E1_chips[4092]; // _codeLength not accepted by Clang galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip for (uint32_t i = 0; i < _codeLength; i++) @@ -159,8 +159,8 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3], std::string _galileo_signal = _Signal; uint32_t _samplesPerCode; const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; // Hz - uint32_t _codeLength = static_cast(Galileo_E1_B_CODE_LENGTH_CHIPS); - int32_t* primary_code_E1_chips = static_cast(volk_gnsssdr_malloc(static_cast(Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(int32_t), volk_gnsssdr_get_alignment())); + auto _codeLength = static_cast(Galileo_E1_B_CODE_LENGTH_CHIPS); + auto* primary_code_E1_chips = static_cast(volk_gnsssdr_malloc(static_cast(Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(int32_t), volk_gnsssdr_get_alignment())); _samplesPerCode = static_cast(static_cast(_fs) / (static_cast(_codeFreqBasis) / static_cast(_codeLength))); const int32_t _samplesPerChip = (_cboc == true) ? 12 : 2; @@ -180,7 +180,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3], } else { - int32_t* _signal_E1_int = static_cast(volk_gnsssdr_malloc(_codeLength * sizeof(int32_t), volk_gnsssdr_get_alignment())); + auto* _signal_E1_int = static_cast(volk_gnsssdr_malloc(_codeLength * sizeof(int32_t), volk_gnsssdr_get_alignment())); galileo_e1_sinboc_11_gen_int(_signal_E1_int, primary_code_E1_chips, _codeLength); // generate sinboc(1,1) 2 samples per chip for (uint32_t ii = 0; ii < _codeLength; ++ii) @@ -192,7 +192,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3], if (_fs != _samplesPerChip * _codeFreqBasis) { - float* _resampled_signal = new float[_samplesPerCode]; + auto* _resampled_signal = new float[_samplesPerCode]; resampler(_signal_E1, _resampled_signal, _samplesPerChip * _codeFreqBasis, _fs, _codeLength, _samplesPerCode); // resamples code to fs @@ -203,7 +203,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3], if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag) { - float* _signal_E1C_secondary = new float[static_cast(Galileo_E1_C_SECONDARY_CODE_LENGTH) * _samplesPerCode]; + auto* _signal_E1C_secondary = new float[static_cast(Galileo_E1_C_SECONDARY_CODE_LENGTH) * _samplesPerCode]; for (uint32_t i = 0; i < static_cast(Galileo_E1_C_SECONDARY_CODE_LENGTH); i++) { @@ -235,7 +235,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex* _dest, char _Signa { std::string _galileo_signal = _Signal; const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; // Hz - uint32_t _samplesPerCode = static_cast(static_cast(_fs) / + auto _samplesPerCode = static_cast(static_cast(_fs) / (static_cast(_codeFreqBasis) / static_cast(Galileo_E1_B_CODE_LENGTH_CHIPS))); if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag) @@ -243,7 +243,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex* _dest, char _Signa _samplesPerCode *= static_cast(Galileo_E1_C_SECONDARY_CODE_LENGTH); } - float* real_code = static_cast(volk_gnsssdr_malloc(_samplesPerCode * sizeof(float), volk_gnsssdr_get_alignment())); + auto* real_code = static_cast(volk_gnsssdr_malloc(_samplesPerCode * sizeof(float), volk_gnsssdr_get_alignment())); galileo_e1_code_gen_float_sampled(real_code, _Signal, _cboc, _prn, _fs, _chip_shift, _secondary_flag); diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc index 82ef4ed54..7874acff4 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.cc +++ b/src/algorithms/libs/galileo_e5_signal_processing.cc @@ -108,7 +108,7 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex* _dest, char _Sig const uint32_t _codeLength = Galileo_E5a_CODE_LENGTH_CHIPS; const int32_t _codeFreqBasis = Galileo_E5a_CODE_CHIP_RATE_HZ; - std::complex* _code = new std::complex[_codeLength](); + auto* _code = new std::complex[_codeLength](); galileo_e5_a_code_gen_complex_primary(_code, _prn, _Signal); 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_sample_counter.cc b/src/algorithms/libs/gnss_sdr_sample_counter.cc index 9fdc7e00e..c3382e19e 100644 --- a/src/algorithms/libs/gnss_sdr_sample_counter.cc +++ b/src/algorithms/libs/gnss_sdr_sample_counter.cc @@ -71,7 +71,7 @@ int gnss_sdr_sample_counter::work(int noutput_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]); + auto *out = reinterpret_cast(output_items[0]); out[0] = Gnss_Synchro(); out[0].Flag_valid_symbol_output = false; out[0].Flag_valid_word = false; diff --git a/src/algorithms/libs/gnss_sdr_valve.cc b/src/algorithms/libs/gnss_sdr_valve.cc index c8d0e1385..8ef8eb08d 100644 --- a/src/algorithms/libs/gnss_sdr_valve.cc +++ b/src/algorithms/libs/gnss_sdr_valve.cc @@ -37,6 +37,7 @@ #include #include // for min #include // for memcpy +#include gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item, unsigned long long nitems, @@ -46,7 +47,7 @@ gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item, gr::io_signature::make(1, 1, sizeof_stream_item)), d_nitems(nitems), d_ncopied_items(0), - d_queue(queue), + d_queue(std::move(queue)), d_stop_flowgraph(stop_flowgraph) { d_open_valve = false; @@ -55,14 +56,14 @@ gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item, boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue, bool stop_flowgraph) { - boost::shared_ptr valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, stop_flowgraph)); + boost::shared_ptr valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph)); return valve_; } boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue) { - boost::shared_ptr valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, true)); + boost::shared_ptr valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), true)); return valve_; } @@ -81,7 +82,7 @@ int gnss_sdr_valve::work(int noutput_items, { if (d_ncopied_items >= d_nitems) { - ControlMessageFactory *cmf = new ControlMessageFactory(); + auto *cmf = new ControlMessageFactory(); d_queue->handle(cmf->GetQueueMessage(200, 0)); LOG(INFO) << "Stopping receiver, " << d_ncopied_items << " samples processed"; delete cmf; @@ -89,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; @@ -101,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_l2c_signal.cc b/src/algorithms/libs/gps_l2c_signal.cc index 4f41e620f..b3b20be20 100644 --- a/src/algorithms/libs/gps_l2c_signal.cc +++ b/src/algorithms/libs/gps_l2c_signal.cc @@ -55,7 +55,7 @@ void gps_l2c_m_code(int32_t* _dest, uint32_t _prn) void gps_l2c_m_code_gen_complex(std::complex* _dest, uint32_t _prn) { - int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { @@ -73,7 +73,7 @@ void gps_l2c_m_code_gen_complex(std::complex* _dest, uint32_t _prn) void gps_l2c_m_code_gen_float(float* _dest, uint32_t _prn) { - int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { @@ -94,7 +94,7 @@ void gps_l2c_m_code_gen_float(float* _dest, uint32_t _prn) */ void gps_l2c_m_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, int32_t _fs) { - int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { gps_l2c_m_code(_code, _prn); diff --git a/src/algorithms/libs/gps_l5_signal.cc b/src/algorithms/libs/gps_l5_signal.cc index 26656d569..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; } @@ -182,7 +176,7 @@ void make_l5q(int32_t* _dest, int32_t prn) void gps_l5i_code_gen_complex(std::complex* _dest, uint32_t _prn) { - int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { @@ -200,7 +194,7 @@ void gps_l5i_code_gen_complex(std::complex* _dest, uint32_t _prn) void gps_l5i_code_gen_float(float* _dest, uint32_t _prn) { - int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { @@ -221,7 +215,7 @@ void gps_l5i_code_gen_float(float* _dest, uint32_t _prn) */ void gps_l5i_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, int32_t _fs) { - int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { make_l5i(_code, _prn - 1); @@ -267,7 +261,7 @@ void gps_l5i_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, void gps_l5q_code_gen_complex(std::complex* _dest, uint32_t _prn) { - int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { @@ -285,7 +279,7 @@ void gps_l5q_code_gen_complex(std::complex* _dest, uint32_t _prn) void gps_l5q_code_gen_float(float* _dest, uint32_t _prn) { - int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { @@ -306,7 +300,7 @@ void gps_l5q_code_gen_float(float* _dest, uint32_t _prn) */ void gps_l5q_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, int32_t _fs) { - int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS]; + auto* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS]; if (_prn > 0 and _prn < 51) { make_l5q(_code, _prn - 1); diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index ba0458358..b388363da 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -38,7 +38,7 @@ using google::LogMessage; -Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string role, +Pass_Through::Pass_Through(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), @@ -47,7 +47,7 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro std::string default_item_type = "gr_complex"; std::string input_type = configuration->property(role + ".input_item_type", default_item_type); std::string output_type = configuration->property(role + ".output_item_type", default_item_type); - if (input_type.compare(output_type) != 0) + if (input_type != output_type) { LOG(WARNING) << "input_item_type and output_item_type are different in a Pass_Through implementation! Taking " << input_type @@ -57,11 +57,11 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro item_type_ = configuration->property(role + ".item_type", input_type); inverted_spectrum = configuration->property(role + ".inverted_spectrum", false); - if (item_type_.compare("float") == 0) + if (item_type_ == "float") { item_size_ = sizeof(float); } - else if (item_type_.compare("gr_complex") == 0) + else if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); if (inverted_spectrum) @@ -69,15 +69,15 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro conjugate_cc_ = make_conjugate_cc(); } } - else if (item_type_.compare("short") == 0) + else if (item_type_ == "short") { item_size_ = sizeof(int16_t); } - else if (item_type_.compare("ishort") == 0) + else if (item_type_ == "ishort") { item_size_ = sizeof(int16_t); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); if (inverted_spectrum) @@ -85,15 +85,15 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro conjugate_sc_ = make_conjugate_sc(); } } - else if (item_type_.compare("byte") == 0) + else if (item_type_ == "byte") { item_size_ = sizeof(int8_t); } - else if (item_type_.compare("ibyte") == 0) + else if (item_type_ == "ibyte") { item_size_ = sizeof(int8_t); } - else if (item_type_.compare("cbyte") == 0) + else if (item_type_ == "cbyte") { item_size_ = sizeof(lv_8sc_t); if (inverted_spectrum) @@ -145,15 +145,15 @@ gr::basic_block_sptr Pass_Through::get_left_block() { if (inverted_spectrum) { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return conjugate_cc_; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return conjugate_sc_; } - else if (item_type_.compare("cbyte") == 0) + else if (item_type_ == "cbyte") { return conjugate_ic_; } @@ -172,15 +172,15 @@ gr::basic_block_sptr Pass_Through::get_right_block() { if (inverted_spectrum) { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return conjugate_cc_; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return conjugate_sc_; } - else if (item_type_.compare("cbyte") == 0) + else if (item_type_ == "cbyte") { return conjugate_ic_; } diff --git a/src/algorithms/libs/pass_through.h b/src/algorithms/libs/pass_through.h index 83100eab2..223256ab9 100644 --- a/src/algorithms/libs/pass_through.h +++ b/src/algorithms/libs/pass_through.h @@ -51,7 +51,7 @@ class Pass_Through : public GNSSBlockInterface { public: Pass_Through(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_stream, unsigned int out_stream); diff --git a/src/algorithms/libs/rtklib/rtklib_conversions.cc b/src/algorithms/libs/rtklib/rtklib_conversions.cc index 8fe890fd3..937beee41 100644 --- a/src/algorithms/libs/rtklib/rtklib_conversions.cc +++ b/src/algorithms/libs/rtklib/rtklib_conversions.cc @@ -51,7 +51,7 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro double CN0_dB_Hz_est = gnss_synchro.CN0_dB_hz; if (CN0_dB_Hz_est > 63.75) CN0_dB_Hz_est = 63.75; if (CN0_dB_Hz_est < 0.0) CN0_dB_Hz_est = 0.0; - unsigned char CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); + auto CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); rtklib_obs.SNR[band] = CN0_dB_Hz; //Galileo is the third satellite system for RTKLIB, so, add the required offset to discriminate Galileo ephemeris switch (gnss_synchro.System) 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_preceph.cc b/src/algorithms/libs/rtklib/rtklib_preceph.cc index eff872781..299f883ab 100644 --- a/src/algorithms/libs/rtklib/rtklib_preceph.cc +++ b/src/algorithms/libs/rtklib/rtklib_preceph.cc @@ -250,7 +250,7 @@ void readsp3b(FILE *fp, char type, int *sats __attribute__((unused)), int ns, do /* compare precise ephemeris -------------------------------------------------*/ int cmppeph(const void *p1, const void *p2) { - peph_t *q1 = (peph_t *)p1, *q2 = (peph_t *)p2; + auto *q1 = (peph_t *)p1, *q2 = (peph_t *)p2; double tt = timediff(q1->time, q2->time); return tt < -1e-9 ? -1 : (tt > 1e-9 ? 1 : q1->index - q2->index); } @@ -556,7 +556,7 @@ int readfcbf(const char *file, nav_t *nav) /* compare satellite fcb -----------------------------------------------------*/ int cmpfcb(const void *p1, const void *p2) { - fcbd_t *q1 = (fcbd_t *)p1, *q2 = (fcbd_t *)p2; + auto *q1 = (fcbd_t *)p1, *q2 = (fcbd_t *)p2; double tt = timediff(q1->ts, q2->ts); return tt < -1e-3 ? -1 : (tt > 1e-3 ? 1 : 0); } 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 a55d41b4b..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; @@ -2731,7 +2729,7 @@ int geterp(const erp_t *erp, gtime_t time, double *erpv) /* compare ephemeris ---------------------------------------------------------*/ int cmpeph(const void *p1, const void *p2) { - eph_t *q1 = (eph_t *)p1, *q2 = (eph_t *)p2; + auto *q1 = (eph_t *)p1, *q2 = (eph_t *)p2; return q1->ttr.time != q2->ttr.time ? (int)(q1->ttr.time - q2->ttr.time) : (q1->toe.time != q2->toe.time ? (int)(q1->toe.time - q2->toe.time) : q1->sat - q2->sat); } @@ -2776,7 +2774,7 @@ void uniqeph(nav_t *nav) /* compare glonass ephemeris -------------------------------------------------*/ int cmpgeph(const void *p1, const void *p2) { - geph_t *q1 = (geph_t *)p1, *q2 = (geph_t *)p2; + auto *q1 = (geph_t *)p1, *q2 = (geph_t *)p2; return q1->tof.time != q2->tof.time ? (int)(q1->tof.time - q2->tof.time) : (q1->toe.time != q2->toe.time ? (int)(q1->toe.time - q2->toe.time) : q1->sat - q2->sat); } @@ -2822,7 +2820,7 @@ void uniqgeph(nav_t *nav) /* compare sbas ephemeris ----------------------------------------------------*/ int cmpseph(const void *p1, const void *p2) { - seph_t *q1 = (seph_t *)p1, *q2 = (seph_t *)p2; + auto *q1 = (seph_t *)p1, *q2 = (seph_t *)p2; return q1->tof.time != q2->tof.time ? (int)(q1->tof.time - q2->tof.time) : (q1->t0.time != q2->t0.time ? (int)(q1->t0.time - q2->t0.time) : q1->sat - q2->sat); } @@ -2892,7 +2890,7 @@ void uniqnav(nav_t *nav) /* compare observation data -------------------------------------------------*/ int cmpobs(const void *p1, const void *p2) { - obsd_t *q1 = (obsd_t *)p1, *q2 = (obsd_t *)p2; + auto *q1 = (obsd_t *)p1, *q2 = (obsd_t *)p2; double tt = timediff(q1->time, q2->time); if (fabs(tt) > DTTOL) return tt < 0 ? -1 : 1; if (q1->rcv != q2->rcv) return (int)q1->rcv - (int)q2->rcv; @@ -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); } @@ -4213,7 +4211,7 @@ int rtk_uncompress(const char *file, char *uncfile) { strcpy(uncfile, tmpfile); uncfile[p - tmpfile] = '\0'; - sprintf(cmd, "gzip -f -d -c \"%s\" > \"%s\"", tmpfile, uncfile); + sprintf(cmd, R"(gzip -f -d -c "%s" > "%s")", tmpfile, uncfile); if (execcmd(cmd)) { @@ -4262,7 +4260,7 @@ int rtk_uncompress(const char *file, char *uncfile) { strcpy(uncfile, tmpfile); uncfile[p - tmpfile + 3] = *(p + 3) == 'D' ? 'O' : 'o'; - sprintf(cmd, "crx2rnx < \"%s\" > \"%s\"", tmpfile, uncfile); + sprintf(cmd, R"(crx2rnx < "%s" > "%s")", tmpfile, uncfile); if (execcmd(cmd)) { 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_rtksvr.cc b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc index 052de403b..4687d73d2 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc @@ -446,7 +446,7 @@ void decodefile(rtksvr_t *svr, int index) /* rtk server thread ---------------------------------------------------------*/ void *rtksvrthread(void *arg) { - rtksvr_t *svr = (rtksvr_t *)arg; + auto *svr = (rtksvr_t *)arg; obs_t obs; obsd_t data[MAXOBS * 2]; double tt; diff --git a/src/algorithms/libs/rtklib/rtklib_sbas.cc b/src/algorithms/libs/rtklib/rtklib_sbas.cc index 77b6a0f47..52aa5b0c6 100644 --- a/src/algorithms/libs/rtklib/rtklib_sbas.cc +++ b/src/algorithms/libs/rtklib/rtklib_sbas.cc @@ -603,7 +603,7 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te, /* compare sbas messages -----------------------------------------------------*/ int cmpmsgs(const void *p1, const void *p2) { - sbsmsg_t *q1 = (sbsmsg_t *)p1, *q2 = (sbsmsg_t *)p2; + auto *q1 = (sbsmsg_t *)p1, *q2 = (sbsmsg_t *)p2; return q1->week != q2->week ? q1->week - q2->week : (q1->tow < q2->tow ? -1 : (q1->tow > q2->tow ? 1 : q1->prn - q2->prn)); } diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index be2fd368f..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); } @@ -815,7 +815,7 @@ int readsoldata(FILE *fp, gtime_t ts, gtime_t te, double tint, int qflag, /* compare solution data -----------------------------------------------------*/ int cmpsol(const void *p1, const void *p2) { - sol_t *q1 = (sol_t *)p1, *q2 = (sol_t *)p2; + auto *q1 = (sol_t *)p1, *q2 = (sol_t *)p2; double tt = timediff(q1->time, q2->time); return tt < -0.0 ? -1 : (tt > 0.0 ? 1 : 0); } @@ -1023,7 +1023,7 @@ void freesolstatbuf(solstatbuf_t *solstatbuf) /* compare solution status ---------------------------------------------------*/ int cmpsolstat(const void *p1, const void *p2) { - solstat_t *q1 = (solstat_t *)p1, *q2 = (solstat_t *)p2; + auto *q1 = (solstat_t *)p1, *q2 = (solstat_t *)p2; double tt = timediff(q1->time, q2->time); return tt < -0.0 ? -1 : (tt > 0.0 ? 1 : 0); } diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index 04ae96e01..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; @@ -1534,7 +1534,7 @@ gtime_t nextdltime(const int *topts, int stat) /* ftp thread ----------------------------------------------------------------*/ void *ftpthread(void *arg) { - ftp_t *ftp = (ftp_t *)arg; + auto *ftp = (ftp_t *)arg; FILE *fp; gtime_t time; char remote[1024], local[1024], tmpfile[1024], errfile[1024], *p; @@ -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/libs/short_x2_to_cshort.cc b/src/algorithms/libs/short_x2_to_cshort.cc index 90c842530..6463ab67a 100644 --- a/src/algorithms/libs/short_x2_to_cshort.cc +++ b/src/algorithms/libs/short_x2_to_cshort.cc @@ -53,9 +53,9 @@ int short_x2_to_cshort::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const short *in0 = reinterpret_cast(input_items[0]); - const short *in1 = reinterpret_cast(input_items[1]); - lv_16sc_t *out = reinterpret_cast(output_items[0]); + const auto *in0 = reinterpret_cast(input_items[0]); + const auto *in1 = reinterpret_cast(input_items[1]); + auto *out = reinterpret_cast(output_items[0]); // This could be put into a volk kernel short real_part; short imag_part; diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc index 9c8971dbd..f92c02b48 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.cc +++ b/src/algorithms/observables/adapters/hybrid_observables.cc @@ -38,7 +38,7 @@ using google::LogMessage; HybridObservables::HybridObservables(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_dump_filename = "./observables.dat"; DLOG(INFO) << "role " << role; diff --git a/src/algorithms/observables/adapters/hybrid_observables.h b/src/algorithms/observables/adapters/hybrid_observables.h index 1beb968fa..35015b837 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.h +++ b/src/algorithms/observables/adapters/hybrid_observables.h @@ -47,7 +47,7 @@ class HybridObservables : public ObservablesInterface { public: HybridObservables(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index 99e495ffe..d2d6edd2d 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -42,6 +42,7 @@ #include #include #include +#include using google::LogMessage; @@ -49,7 +50,7 @@ using google::LogMessage; hybrid_observables_cc_sptr hybrid_make_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, bool dump_mat, std::string dump_filename) { - return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels_in, nchannels_out, dump, dump_mat, dump_filename)); + return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename))); } @@ -63,7 +64,7 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in, { d_dump = dump; d_dump_mat = dump_mat and d_dump; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_nchannels_out = nchannels_out; d_nchannels_in = nchannels_in; T_rx_clock_step_samples = 0U; @@ -74,10 +75,10 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in, { std::string dump_path; // Get 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 @@ -89,9 +90,9 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in, d_dump_filename = "observables.dat"; } // 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.append(".dat"); d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename; @@ -175,13 +176,13 @@ int32_t hybrid_observables_cc::save_matfile() { return 1; } - double **RX_time = new double *[d_nchannels_out]; - double **TOW_at_current_symbol_s = new double *[d_nchannels_out]; - double **Carrier_Doppler_hz = new double *[d_nchannels_out]; - double **Carrier_phase_cycles = new double *[d_nchannels_out]; - double **Pseudorange_m = new double *[d_nchannels_out]; - double **PRN = new double *[d_nchannels_out]; - double **Flag_valid_pseudorange = new double *[d_nchannels_out]; + auto **RX_time = new double *[d_nchannels_out]; + auto **TOW_at_current_symbol_s = new double *[d_nchannels_out]; + auto **Carrier_Doppler_hz = new double *[d_nchannels_out]; + auto **Carrier_phase_cycles = new double *[d_nchannels_out]; + auto **Pseudorange_m = new double *[d_nchannels_out]; + auto **PRN = new double *[d_nchannels_out]; + auto **Flag_valid_pseudorange = new double *[d_nchannels_out]; for (uint32_t i = 0; i < d_nchannels_out; i++) { @@ -238,13 +239,13 @@ int32_t hybrid_observables_cc::save_matfile() return 1; } - double *RX_time_aux = new double[d_nchannels_out * num_epoch]; - double *TOW_at_current_symbol_s_aux = new double[d_nchannels_out * num_epoch]; - double *Carrier_Doppler_hz_aux = new double[d_nchannels_out * num_epoch]; - double *Carrier_phase_cycles_aux = new double[d_nchannels_out * num_epoch]; - double *Pseudorange_m_aux = new double[d_nchannels_out * num_epoch]; - double *PRN_aux = new double[d_nchannels_out * num_epoch]; - double *Flag_valid_pseudorange_aux = new double[d_nchannels_out * num_epoch]; + auto *RX_time_aux = new double[d_nchannels_out * num_epoch]; + auto *TOW_at_current_symbol_s_aux = new double[d_nchannels_out * num_epoch]; + auto *Carrier_Doppler_hz_aux = new double[d_nchannels_out * num_epoch]; + auto *Carrier_phase_cycles_aux = new double[d_nchannels_out * num_epoch]; + auto *Pseudorange_m_aux = new double[d_nchannels_out * num_epoch]; + auto *PRN_aux = new double[d_nchannels_out * num_epoch]; + auto *Flag_valid_pseudorange_aux = new double[d_nchannels_out * num_epoch]; uint32_t k = 0U; for (int64_t j = 0; j < num_epoch; j++) { @@ -408,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 { @@ -503,8 +501,8 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto **in = reinterpret_cast(&input_items[0]); + auto **out = reinterpret_cast(&output_items[0]); // Push receiver clock into history buffer (connected to the last of the input channels) // The clock buffer gives time to the channels to compute the tracking observables @@ -615,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/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index 919d635c8..8c128b47b 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -43,7 +43,7 @@ using google::LogMessage; DirectResamplerConditioner::DirectResamplerConditioner( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "short"; @@ -64,7 +64,7 @@ DirectResamplerConditioner::DirectResamplerConditioner( DLOG(INFO) << "dump_ is " << dump_; dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_, sample_freq_out_); @@ -73,7 +73,7 @@ DirectResamplerConditioner::DirectResamplerConditioner( DLOG(INFO) << "Item size " << item_size_; DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")"; } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); resampler_ = direct_resampler_make_conditioner_cs(sample_freq_in_, sample_freq_out_); @@ -82,7 +82,7 @@ DirectResamplerConditioner::DirectResamplerConditioner( DLOG(INFO) << "Item size " << item_size_; DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")"; } - else if (item_type_.compare("cbyte") == 0) + else if (item_type_ == "cbyte") { item_size_ = sizeof(lv_8sc_t); resampler_ = direct_resampler_make_conditioner_cb(sample_freq_in_, sample_freq_out_); diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.h b/src/algorithms/resampler/adapters/direct_resampler_conditioner.h index a874b9268..300ce297f 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.h +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.h @@ -47,7 +47,7 @@ class DirectResamplerConditioner : public GNSSBlockInterface { public: DirectResamplerConditioner(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream); virtual ~DirectResamplerConditioner(); diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index 4c5119a4a..1a0ad9abf 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -39,7 +39,7 @@ using google::LogMessage; MmseResamplerConditioner::MmseResamplerConditioner( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "gr_complex"; @@ -60,7 +60,7 @@ MmseResamplerConditioner::MmseResamplerConditioner( DLOG(INFO) << "dump_ is " << dump_; dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.h b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.h index 462e49e88..b3cc61e03 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.h +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.h @@ -55,7 +55,7 @@ class MmseResamplerConditioner : public GNSSBlockInterface { public: MmseResamplerConditioner(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream); virtual ~MmseResamplerConditioner(); diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc index 23510b8f3..704a93b92 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc @@ -93,8 +93,8 @@ int direct_resampler_conditioner_cb::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const lv_8sc_t *in = reinterpret_cast(input_items[0]); - lv_8sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); int lcv = 0; int count = 0; diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc index befc3956b..44d78782c 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc @@ -90,8 +90,8 @@ int direct_resampler_conditioner_cc::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const gr_complex *in = reinterpret_cast(input_items[0]); - gr_complex *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); int lcv = 0; int count = 0; diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc index 3435117d6..06d8f3a22 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc @@ -91,8 +91,8 @@ int direct_resampler_conditioner_cs::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const lv_16sc_t *in = reinterpret_cast(input_items[0]); - lv_16sc_t *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); int lcv = 0; int count = 0; diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index 2620bbbd1..72dafe542 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -38,12 +38,14 @@ #include "GLONASS_L1_L2_CA.h" #include +#include + using google::LogMessage; SignalGenerator::SignalGenerator(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/gen_source.dat"; @@ -110,7 +112,7 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration, } } - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); DLOG(INFO) << "Item size " << item_size_; @@ -154,7 +156,7 @@ SignalGenerator::~SignalGenerator() = default; void SignalGenerator::connect(gr::top_block_sptr top_block) { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { top_block->connect(gen_source_, 0, vector_to_stream_, 0); DLOG(INFO) << "connected gen_source to vector_to_stream"; @@ -170,7 +172,7 @@ void SignalGenerator::connect(gr::top_block_sptr top_block) void SignalGenerator::disconnect(gr::top_block_sptr top_block) { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { top_block->disconnect(gen_source_, 0, vector_to_stream_, 0); if (dump_) diff --git a/src/algorithms/signal_generator/adapters/signal_generator.h b/src/algorithms/signal_generator/adapters/signal_generator.h index 52a2a0f82..7009eb853 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.h +++ b/src/algorithms/signal_generator/adapters/signal_generator.h @@ -52,7 +52,7 @@ class SignalGenerator : public GNSSBlockInterface { public: SignalGenerator(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 ~SignalGenerator(); 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 92a60cbc7..07c17ab00 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -40,6 +40,7 @@ #include #include #include +#include /* @@ -52,7 +53,7 @@ signal_make_generator_c(std::vector signal1, std::vector &delay_chips, const std::vector &delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB) { - return gnuradio::get_initial_sptr(new signal_generator_c(signal1, system, PRN, CN0_dB, doppler_Hz, delay_chips, delay_sec, + return gnuradio::get_initial_sptr(new signal_generator_c(std::move(signal1), std::move(system), PRN, CN0_dB, doppler_Hz, delay_chips, delay_sec, data_flag, noise_flag, fs_in, vector_length, BW_BB)); } @@ -63,22 +64,22 @@ signal_make_generator_c(std::vector signal1, std::vector signal1, std::vector system, const std::vector &PRN, - const std::vector &CN0_dB, - const std::vector &doppler_Hz, - const std::vector &delay_chips, - const std::vector &delay_sec, + std::vector CN0_dB, + std::vector doppler_Hz, + std::vector delay_chips, + std::vector delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB) : gr::block("signal_gen_cc", gr::io_signature::make(0, 0, sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(gr_complex) * vector_length)), - signal_(signal1), - system_(system), + signal_(std::move(signal1)), + system_(std::move(system)), PRN_(PRN), - CN0_dB_(CN0_dB), - doppler_Hz_(doppler_Hz), - delay_chips_(delay_chips), - delay_sec_(delay_sec), + CN0_dB_(std::move(CN0_dB)), + doppler_Hz_(std::move(doppler_Hz)), + delay_chips_(std::move(delay_chips)), + delay_sec_(std::move(delay_sec)), data_flag_(data_flag), noise_flag_(noise_flag), fs_in_(fs_in), @@ -288,7 +289,7 @@ int signal_generator_c::general_work(int noutput_items __attribute__((unused)), gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_void_star &output_items) { - gr_complex *out = reinterpret_cast(output_items[0]); + auto *out = reinterpret_cast(output_items[0]); work_counter_++; diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h index ddcc0f1fb..d7f9e3654 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h @@ -87,8 +87,8 @@ private: unsigned int fs_in, unsigned int vector_length, float BW_BB); signal_generator_c(std::vector signal1, std::vector system, const std::vector &PRN, - const std::vector &CN0_dB, const std::vector &doppler_Hz, - const std::vector &delay_chips, const std::vector &delay_sec, bool data_flag, bool noise_flag, + std::vector CN0_dB, std::vector doppler_Hz, + std::vector delay_chips, std::vector delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB); void init(); diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index b5f696d83..7dbea2d0e 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -39,14 +39,15 @@ #include #include #include +#include using google::LogMessage; FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + const std::string& role, unsigned int in_streams, unsigned int out_streams, + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "./example_capture.dat"; std::string default_item_type = "short"; @@ -59,8 +60,8 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, filename_ = configuration->property(role + ".filename", default_filename); // override value with commandline flag, if present - if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source; - if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s; + if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source; + if (FLAGS_s != "-") filename_ = FLAGS_s; item_type_ = configuration->property(role + ".item_type", default_item_type); repeat_ = configuration->property(role + ".repeat", false); @@ -74,28 +75,28 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, bool is_complex = false; - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); } - else if (item_type_.compare("float") == 0) + else if (item_type_ == "float") { item_size_ = sizeof(float); } - else if (item_type_.compare("short") == 0) + else if (item_type_ == "short") { item_size_ = sizeof(int16_t); } - else if (item_type_.compare("ishort") == 0) + else if (item_type_ == "ishort") { item_size_ = sizeof(int16_t); is_complex = true; } - else if (item_type_.compare("byte") == 0) + else if (item_type_ == "byte") { item_size_ = sizeof(int8_t); } - else if (item_type_.compare("ibyte") == 0) + else if (item_type_ == "ibyte") { item_size_ = sizeof(int8_t); is_complex = true; @@ -135,7 +136,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, } catch (const std::exception& e) { - if (filename_.compare(default_filename) == 0) + if (filename_ == default_filename) { std::cerr << "The configuration file has not been found." @@ -369,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/file_signal_source.h b/src/algorithms/signal_source/adapters/file_signal_source.h index 4e1347e31..548180a31 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.h +++ b/src/algorithms/signal_source/adapters/file_signal_source.h @@ -53,7 +53,7 @@ class ConfigurationInterface; class FileSignalSource : public GNSSBlockInterface { public: - FileSignalSource(ConfigurationInterface* configuration, std::string role, + FileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, boost::shared_ptr queue); diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.cc b/src/algorithms/signal_source/adapters/gen_signal_source.cc index 1900fdf04..094541f41 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gen_signal_source.cc @@ -37,6 +37,7 @@ #include #include #include +#include using google::LogMessage; @@ -44,8 +45,8 @@ using google::LogMessage; GenSignalSource::GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter, std::string role, boost::shared_ptr queue) : signal_generator_(signal_generator), filter_(filter), - role_(role), - queue_(queue) + role_(std::move(role)), + queue_(std::move(queue)) { connected_ = false; } diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 74bab4803..6e31e2ac4 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -33,11 +33,13 @@ #include "labsat23_source.h" #include +#include + using google::LogMessage; LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr 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, gr::msg_queue::sptr 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/source.bin"; @@ -51,7 +53,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration, samples_ = configuration->property(role + ".samples", 0); filename_ = configuration->property(role + ".filename", default_filename); - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); labsat23_source_ = labsat23_make_source(filename_.c_str(), channel_selector); diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.h b/src/algorithms/signal_source/adapters/labsat_signal_source.h index ef11713e3..e31cd049a 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.h +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.h @@ -47,7 +47,7 @@ class LabsatSignalSource : public GNSSBlockInterface { public: LabsatSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr queue); virtual ~LabsatSignalSource(); 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 71669bc1d..60566ed5e 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -39,14 +39,15 @@ #include #include #include +#include using google::LogMessage; NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + const std::string& role, unsigned int in_streams, unsigned int out_streams, + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "byte"; @@ -57,8 +58,8 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, filename_ = configuration->property(role + ".filename", default_filename); // override value with commandline flag, if present - if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source; - if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s; + if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source; + if (FLAGS_s != "-") filename_ = FLAGS_s; item_type_ = configuration->property(role + ".item_type", default_item_type); repeat_ = configuration->property(role + ".repeat", false); @@ -66,7 +67,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); - if (item_type_.compare("byte") == 0) + if (item_type_ == "byte") { item_size_ = sizeof(char); } @@ -308,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/nsr_file_signal_source.h b/src/algorithms/signal_source/adapters/nsr_file_signal_source.h index c1e0f6bb4..d96b8645b 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.h @@ -53,7 +53,7 @@ class ConfigurationInterface; class NsrFileSignalSource : public GNSSBlockInterface { public: - NsrFileSignalSource(ConfigurationInterface* configuration, std::string role, + NsrFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, boost::shared_ptr queue); diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc index d91783d30..6e644119d 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -37,14 +37,20 @@ #include #include #include +#include using google::LogMessage; RtlTcpSignalSource::RtlTcpSignalSource(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_(std::move(role)), + in_stream_(in_stream), + out_stream_(out_stream), + queue_(queue) { // DUMP PARAMETERS std::string empty = ""; @@ -69,11 +75,11 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration, port_ = configuration->property(role + ".port", default_port); flip_iq_ = configuration->property(role + ".flip_iq", false); - 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 gr block diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h index a1966c3ad..f50adeded 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h @@ -54,8 +54,10 @@ class RtlTcpSignalSource : public GNSSBlockInterface { public: RtlTcpSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + const std::string& role, + unsigned int in_stream, + unsigned int out_stream, + boost::shared_ptr queue); virtual ~RtlTcpSignalSource(); 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 411d3623c..d5692e434 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc @@ -38,14 +38,15 @@ #include #include #include +#include using google::LogMessage; SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + const std::string& role, unsigned int in_streams, unsigned int out_streams, + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "int"; @@ -56,8 +57,8 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration filename_ = configuration->property(role + ".filename", default_filename); // override value with commandline flag, if present - if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source; - if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s; + if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source; + if (FLAGS_s != "-") filename_ = FLAGS_s; item_type_ = configuration->property(role + ".item_type", default_item_type); repeat_ = configuration->property(role + ".repeat", false); @@ -65,7 +66,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); - if (item_type_.compare("int") == 0) + if (item_type_ == "int") { item_size_ = sizeof(int); } @@ -307,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/spir_file_signal_source.h b/src/algorithms/signal_source/adapters/spir_file_signal_source.h index 70a7eb659..25ace35c8 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.h @@ -50,7 +50,7 @@ class ConfigurationInterface; class SpirFileSignalSource : public GNSSBlockInterface { public: - SpirFileSignalSource(ConfigurationInterface* configuration, std::string role, + SpirFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, boost::shared_ptr queue); diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc index bd7cc1a62..ff8f45411 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc @@ -36,13 +36,14 @@ #include #include #include +#include using google::LogMessage; SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, - std::string role, uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + const std::string& role, uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_dump_filename = "../data/my_capture_dump.dat"; diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h index a37a4fe7f..34e1229e2 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h @@ -57,7 +57,7 @@ class ConfigurationInterface; class SpirGSS6450FileSignalSource : public GNSSBlockInterface { public: - SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, std::string role, + SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, const std::string& role, uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue); virtual ~SpirGSS6450FileSignalSource(); 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 256e73952..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 @@ -38,19 +38,20 @@ #include #include #include +#include using google::LogMessage; TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams, boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), - queue_(queue) + queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "byte"; @@ -317,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/two_bit_cpx_file_signal_source.h b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h index 0088e1287..4de90a666 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h @@ -56,7 +56,7 @@ class TwoBitCpxFileSignalSource : public GNSSBlockInterface { public: TwoBitCpxFileSignalSource(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams, boost::shared_ptr queue); diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc index 8197c3365..f06d5040b 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc @@ -40,19 +40,20 @@ #include #include #include +#include using google::LogMessage; TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams, boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), - queue_(queue) + queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "byte"; diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h index 00019ce4c..286b0e3ab 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h @@ -56,7 +56,7 @@ class ConfigurationInterface; class TwoBitPackedFileSignalSource : public GNSSBlockInterface { public: - TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, std::string role, + TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, boost::shared_ptr queue); diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index 2efacec39..80f165a60 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -37,13 +37,14 @@ #include #include #include +#include using google::LogMessage; UhdSignalSource::UhdSignalSource(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 = ""; @@ -57,13 +58,13 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, // available transports on the system (ethernet, usb...). // To narrow down the discovery process to a particular device, // specify a transport key/value pair specific to your device. - if (empty.compare(device_address_) != 0) // if not empty + if (empty != device_address_) // if not empty { dev_addr["addr"] = device_address_; } //filter the device by serial number if required (useful for USB devices) std::string device_serial = configuration->property(role + ".device_serial", empty); - if (empty.compare(device_serial) != 0) // if not empty + if (empty != device_serial) // if not empty { dev_addr["serial"] = device_serial; } @@ -111,17 +112,17 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, // fc32: Complex floating point (32-bit floats) range [-1.0, +1.0]. // sc16: Complex signed integer (16-bit integers) range [-32768, +32767]. // sc8: Complex signed integer (8-bit integers) range [-128, 127]. - if (item_type_.compare("cbyte") == 0) + if (item_type_ == "cbyte") { item_size_ = sizeof(lv_8sc_t); uhd_stream_args_ = uhd::stream_args_t("sc8"); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); uhd_stream_args_ = uhd::stream_args_t("sc16"); } - else if (item_type_.compare("gr_complex") == 0) + else if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); uhd_stream_args_ = uhd::stream_args_t("fc32"); @@ -313,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/adapters/uhd_signal_source.h b/src/algorithms/signal_source/adapters/uhd_signal_source.h index bfe13ddb1..a5a34b08b 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.h +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.h @@ -50,7 +50,7 @@ class UhdSignalSource : public GNSSBlockInterface { public: UhdSignalSource(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 ~UhdSignalSource(); diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc index 34731a1c1..c633d97a5 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc @@ -172,7 +172,7 @@ int labsat23_source::general_work(int noutput_items, __attribute__((unused)) gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - gr_complex *out = reinterpret_cast(output_items[0]); + auto *out = reinterpret_cast(output_items[0]); if (d_header_parsed == false) { @@ -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; @@ -314,7 +314,7 @@ int labsat23_source::general_work(int noutput_items, return -1; } byte_counter++; - uint8_t quantization = static_cast(memblock[byte_counter]); + auto quantization = static_cast(memblock[byte_counter]); switch (quantization) { case 1: @@ -327,7 +327,7 @@ int labsat23_source::general_work(int noutput_items, std::cout << "Unknown quantization ID " << static_cast(quantization) << std::endl; } byte_counter++; - uint8_t channel_a_constellation = static_cast(memblock[byte_counter]); + auto channel_a_constellation = static_cast(memblock[byte_counter]); switch (channel_a_constellation) { case 0: @@ -343,7 +343,7 @@ int labsat23_source::general_work(int noutput_items, std::cout << "Unknown channel A constellation ID " << static_cast(channel_a_constellation) << std::endl; } byte_counter++; - uint8_t channel_b_constellation = static_cast(memblock[byte_counter]); + auto channel_b_constellation = static_cast(memblock[byte_counter]); switch (channel_b_constellation) { case 0: @@ -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/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index 71c09a8c8..0774d3762 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -205,7 +205,7 @@ void rtl_tcp_signal_source_c::set_agc_mode(bool agc) void rtl_tcp_signal_source_c::set_gain(int gain) { - unsigned clipped = static_cast(info_.clip_gain(gain) * 10.0); + auto clipped = static_cast(info_.clip_gain(gain) * 10.0); boost::system::error_code ec = rtl_tcp_command(RTL_TCP_SET_GAIN, clipped, socket_); if (ec) { 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 27f9ae8ef..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; } @@ -138,8 +138,8 @@ int unpack_2bit_samples::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - signed char const *in = reinterpret_cast(input_items[0]); - int8_t *out = reinterpret_cast(output_items[0]); + auto const *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); size_t ninput_bytes = noutput_items / 4; size_t ninput_items = ninput_bytes / item_size_; diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_cpx_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_cpx_samples.cc index fcdfdb5ab..ff9bffec4 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_cpx_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_cpx_samples.cc @@ -63,8 +63,8 @@ int unpack_byte_2bit_cpx_samples::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const signed char *in = reinterpret_cast(input_items[0]); - short *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); byte_2bit_struct sample; int n = 0; diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_samples.cc index 796829500..3161534c9 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_2bit_samples.cc @@ -59,8 +59,8 @@ int unpack_byte_2bit_samples::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const signed char *in = reinterpret_cast(input_items[0]); - float *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); byte_2bit_struct sample; int n = 0; diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.cc index a176e2c32..b20ccf21f 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.cc @@ -54,8 +54,8 @@ int unpack_byte_4bit_samples::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const signed char *in = reinterpret_cast(input_items[0]); - signed char *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); int n = 0; unsigned char tmp_char2; for (int i = 0; i < noutput_items / 2; i++) diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_intspir_1bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_intspir_1bit_samples.cc index 3994d2fa4..f2a805f17 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_intspir_1bit_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_intspir_1bit_samples.cc @@ -54,8 +54,8 @@ int unpack_intspir_1bit_samples::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const signed int *in = reinterpret_cast(input_items[0]); - float *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); int n = 0; int channel = 1; diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc index 180e7d041..02b9e3d30 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc @@ -123,8 +123,8 @@ void unpack_spir_gss6450_samples::decode_4bits_word(uint32_t input_uint32, gr_co int unpack_spir_gss6450_samples::work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) { - const int32_t* in = reinterpret_cast(input_items[0]); - gr_complex* out = reinterpret_cast(output_items[0]); + const auto* in = reinterpret_cast(input_items[0]); + auto* out = reinterpret_cast(output_items[0]); int n_sample = 0; int in_counter = 0; do 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/adapters/galileo_e1b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc index cb79cd8b5..300bb3100 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc @@ -44,7 +44,7 @@ using google::LogMessage; GalileoE1BTelemetryDecoder::GalileoE1BTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.h index 119e294ad..1e921a2a7 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.h @@ -50,7 +50,7 @@ class GalileoE1BTelemetryDecoder : public TelemetryDecoderInterface { public: GalileoE1BTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc index ffca2a78a..7f0b0c49e 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc @@ -47,7 +47,7 @@ using google::LogMessage; GalileoE5aTelemetryDecoder::GalileoE5aTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h index 022636384..cdb21af2d 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h @@ -50,7 +50,7 @@ class GalileoE5aTelemetryDecoder : public TelemetryDecoderInterface { public: GalileoE5aTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc index 6bec2ae43..e01bb5552 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc @@ -43,7 +43,7 @@ using google::LogMessage; GlonassL1CaTelemetryDecoder::GlonassL1CaTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.h index c35fc68e0..7823071f0 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.h @@ -47,7 +47,7 @@ class GlonassL1CaTelemetryDecoder : public TelemetryDecoderInterface { public: GlonassL1CaTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc index cc3aa9b58..fb4d95bea 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc @@ -42,7 +42,7 @@ using google::LogMessage; GlonassL2CaTelemetryDecoder::GlonassL2CaTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.h index 27c7774bd..bd0f5d346 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.h @@ -46,7 +46,7 @@ class GlonassL2CaTelemetryDecoder : public TelemetryDecoderInterface { public: GlonassL2CaTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc index 279ae544f..4075b6662 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc @@ -43,7 +43,7 @@ using google::LogMessage; GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h index ec4efbb86..9436e8ae5 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h @@ -46,7 +46,7 @@ class GpsL1CaTelemetryDecoder : public TelemetryDecoderInterface { public: GpsL1CaTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc index 7bf577643..5e99f3791 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc @@ -43,7 +43,7 @@ using google::LogMessage; GpsL2CTelemetryDecoder::GpsL2CTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.h index fefb15e97..f7e9fb76b 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.h @@ -46,7 +46,7 @@ class GpsL2CTelemetryDecoder : public TelemetryDecoderInterface { public: GpsL2CTelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc index dd053a14a..17a09550f 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc @@ -39,7 +39,7 @@ using google::LogMessage; GpsL5TelemetryDecoder::GpsL5TelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.h index 06da22d47..d9a200fd6 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.h @@ -49,7 +49,7 @@ class GpsL5TelemetryDecoder : public TelemetryDecoderInterface { public: GpsL5TelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index 651671b04..38c731f98 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -41,7 +41,7 @@ using google::LogMessage; SbasL1TelemetryDecoder::SbasL1TelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.h index 9da1b44f9..1616f4ea0 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.h @@ -48,7 +48,7 @@ class SbasL1TelemetryDecoder : public TelemetryDecoderInterface { public: SbasL1TelemetryDecoder(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); 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 da1851fad..25bb90297 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 @@ -260,7 +260,7 @@ galileo_telemetry_decoder_cc::~galileo_telemetry_decoder_cc() void galileo_telemetry_decoder_cc::decode_INAV_word(double *page_part_symbols, int32_t frame_length) { // 1. De-interleave - double *page_part_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); + auto *page_part_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_deint); // 2. Viterbi decoder @@ -274,7 +274,7 @@ void galileo_telemetry_decoder_cc::decode_INAV_word(double *page_part_symbols, i } } - int32_t *page_part_bits = static_cast(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment())); + auto *page_part_bits = static_cast(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment())); viterbi_decoder(page_part_symbols_deint, page_part_bits); volk_gnsssdr_free(page_part_symbols_deint); @@ -354,7 +354,7 @@ void galileo_telemetry_decoder_cc::decode_INAV_word(double *page_part_symbols, i void galileo_telemetry_decoder_cc::decode_FNAV_word(double *page_symbols, int32_t frame_length) { // 1. De-interleave - double *page_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); + auto *page_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); deinterleaver(GALILEO_FNAV_INTERLEAVER_ROWS, GALILEO_FNAV_INTERLEAVER_COLS, page_symbols, page_symbols_deint); // 2. Viterbi decoder @@ -367,7 +367,7 @@ void galileo_telemetry_decoder_cc::decode_FNAV_word(double *page_symbols, int32_ page_symbols_deint[i] = -page_symbols_deint[i]; } } - int32_t *page_bits = static_cast(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment())); + auto *page_bits = static_cast(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment())); viterbi_decoder(page_symbols_deint, page_bits); volk_gnsssdr_free(page_symbols_deint); @@ -460,8 +460,8 @@ int galileo_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( int32_t corr_value = 0; int32_t preamble_diff = 0; - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer - const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer + auto **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer + const auto **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block // 1. Copy the current tracking output @@ -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 49c40a082..cf748c694 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 @@ -74,11 +74,11 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc( // preamble bits to sampled symbols d_preambles_symbols = static_cast(malloc(sizeof(int32_t) * d_symbols_per_preamble)); int32_t n = 0; - for (int32_t i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++) + for (unsigned short d_preambles_bit : d_preambles_bits) { for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++) { - if (d_preambles_bits[i] == 1) + if (d_preambles_bit == 1) { d_preambles_symbols[n] = 1; } @@ -265,8 +265,8 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu int32_t corr_value = 0; int32_t preamble_diff = 0; - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer - const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer + auto **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer + const auto **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block // 1. Copy the current tracking output 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 29b4f14d3..e73dfcb9f 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 @@ -74,11 +74,11 @@ glonass_l2_ca_telemetry_decoder_cc::glonass_l2_ca_telemetry_decoder_cc( // preamble bits to sampled symbols d_preambles_symbols = static_cast(malloc(sizeof(int32_t) * d_symbols_per_preamble)); int32_t n = 0; - for (int32_t i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++) + for (unsigned short d_preambles_bit : d_preambles_bits) { for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++) { - if (d_preambles_bits[i] == 1) + if (d_preambles_bit == 1) { d_preambles_symbols[n] = 1; } @@ -265,8 +265,8 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu int32_t corr_value = 0; int32_t preamble_diff = 0; - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer - const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer + auto **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer + const auto **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block // 1. Copy the current tracking output 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 e4a12bd43..97f7b1887 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 @@ -67,11 +67,11 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( // preamble bits to sampled symbols d_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_preambles_symbols[n] = 1; } @@ -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); } @@ -193,11 +195,11 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe() bool subframe_synchro_confirmation = false; bool CRC_ok = true; - for (int32_t n = 0; n < GPS_SUBFRAME_MS; n++) + for (float d_subframe_symbol : d_subframe_symbols) { // ******* SYMBOL TO BIT ******* // extended correlation to bit period is enabled in tracking! - symbol_accumulator += d_subframe_symbols[n]; // accumulate the input value in d_symbol_accumulator + symbol_accumulator += d_subframe_symbol; // accumulate the input value in d_symbol_accumulator symbol_accumulator_counter++; if (symbol_accumulator_counter == 20) { @@ -311,8 +313,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__ { int32_t preamble_diff_ms = 0; - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer - const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer + auto **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer + const auto **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block // 1. Copy the current tracking output @@ -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 6790c8559..dba641cd0 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 @@ -129,8 +129,8 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // get pointers on in- and output gnss-synchro objects - Gnss_Synchro *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer - const Gnss_Synchro *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer + auto *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer + const auto *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer bool flag_new_cnav_frame = false; cnav_msg_t msg; 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 8aafd598a..b437a9bee 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 @@ -141,8 +141,8 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // get pointers on in- and output gnss-synchro objects - Gnss_Synchro *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer - const Gnss_Synchro *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer + auto *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer + const auto *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer // UPDATE GNSS SYNCHRO DATA Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block @@ -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 cb8a9914a..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 @@ -125,7 +125,7 @@ void sbas_l1_telemetry_decoder_cc::sample_aligner::reset() /* * samples length must be a multiple of two */ -bool sbas_l1_telemetry_decoder_cc::sample_aligner::get_symbols(const std::vector samples, std::vector &symbols) +bool sbas_l1_telemetry_decoder_cc::sample_aligner::get_symbols(const std::vector& samples, std::vector &symbols) { double smpls[3] = {}; double corr_diff; @@ -213,7 +213,7 @@ void sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::reset() } -bool sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::get_bits(const std::vector symbols, std::vector &bits) +bool sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::get_bits(const std::vector& symbols, std::vector &bits) { const int32_t traceback_depth = 5 * d_KK; int32_t nbits_requested = symbols.size() / d_symbols_per_bit; @@ -222,13 +222,13 @@ bool sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::get_bits(const st std::vector symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector std::vector symbols_vd2; // shifted symbol vector -> add past sample in front of input vector symbols_vd2.push_back(d_past_symbol); - for (std::vector::const_iterator symbol_it = symbols.cbegin(); symbol_it != symbols.cend() - 1; ++symbol_it) + for (auto symbol_it = symbols.cbegin(); symbol_it != symbols.cend() - 1; ++symbol_it) { symbols_vd2.push_back(*symbol_it); } // arrays for decoded bits - int32_t *bits_vd1 = new int32_t[nbits_requested]; - int32_t *bits_vd2 = new int32_t[nbits_requested]; + auto *bits_vd1 = new int32_t[nbits_requested]; + auto *bits_vd2 = new int32_t[nbits_requested]; // decode float metric_vd1 = d_vd1->decode_continuous(symbols_vd1.data(), traceback_depth, bits_vd1, nbits_requested, nbits_decoded); float metric_vd2 = d_vd2->decode_continuous(symbols_vd2.data(), traceback_depth, bits_vd2, nbits_requested, nbits_decoded); @@ -258,7 +258,7 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::reset() } -void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const std::vector bits, std::vector>> &msg_candidates) +void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const std::vector& bits, std::vector>> &msg_candidates) { std::stringstream ss; uint32_t sbas_msg_length = 250; @@ -270,7 +270,7 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st ss << "copy bits "; int32_t count = 0; // copy new bits into the working buffer - for (std::vector::const_iterator bit_it = bits.cbegin(); bit_it < bits.cend(); ++bit_it) + for (auto bit_it = bits.cbegin(); bit_it < bits.cend(); ++bit_it) { d_buffer.push_back(*bit_it); ss << *bit_it; @@ -281,12 +281,12 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st while (d_buffer.size() >= sbas_msg_length) { // compare with all preambles - for (std::vector>::iterator preample_it = preambles.begin(); preample_it < preambles.end(); ++preample_it) + for (auto preample_it = preambles.begin(); preample_it < preambles.end(); ++preample_it) { bool preamble_detected = true; bool inv_preamble_detected = true; // compare the buffer bits with the preamble bits - for (std::vector::iterator preample_bit_it = preample_it->begin(); preample_bit_it < preample_it->end(); ++preample_bit_it) + for (auto preample_bit_it = preample_it->begin(); preample_bit_it < preample_it->end(); ++preample_bit_it) { preamble_detected = *preample_bit_it == d_buffer[preample_bit_it - preample_it->begin()] ? preamble_detected : false; inv_preamble_detected = *preample_bit_it != d_buffer[preample_bit_it - preample_it->begin()] ? inv_preamble_detected : false; @@ -299,13 +299,13 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st if (inv_preamble_detected) { // invert bits - for (std::vector::iterator candidate_bit_it = candidate.begin(); candidate_bit_it != candidate.end(); candidate_bit_it++) - *candidate_bit_it = *candidate_bit_it == 0 ? 1 : 0; + for (int & candidate_bit_it : candidate) + candidate_bit_it = candidate_bit_it == 0 ? 1 : 0; } msg_candidates.emplace_back(relative_preamble_start, candidate); ss.str(""); ss << "preamble " << preample_it - preambles.begin() << (inv_preamble_detected ? " inverted" : " normal") << " detected! candidate="; - for (std::vector::iterator bit_it = candidate.begin(); bit_it < candidate.end(); ++bit_it) + for (auto bit_it = candidate.begin(); bit_it < candidate.end(); ++bit_it) ss << *bit_it; VLOG(EVENT) << ss.str(); } @@ -323,13 +323,13 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::reset() } -void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector msg_candidates, std::vector &valid_msgs) +void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector& msg_candidates, std::vector &valid_msgs) { std::stringstream ss; VLOG(FLOW) << "get_valid_frames(): " << "msg_candidates.size()=" << msg_candidates.size(); // for each candidate - for (std::vector::const_iterator candidate_it = msg_candidates.cbegin(); candidate_it < msg_candidates.cend(); ++candidate_it) + for (auto candidate_it = msg_candidates.cbegin(); candidate_it < msg_candidates.cend(); ++candidate_it) { // convert to bytes std::vector candidate_bytes; @@ -352,7 +352,7 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vec ss << "Not a valid message."; } ss << " Relbitoffset=" << candidate_it->first << " content="; - for (std::vector::iterator byte_it = candidate_bytes.begin(); byte_it < candidate_bytes.end(); ++byte_it) + for (auto byte_it = candidate_bytes.begin(); byte_it < candidate_bytes.end(); ++byte_it) { ss << std::setw(2) << std::setfill('0') << std::hex << static_cast((*byte_it)); } @@ -361,13 +361,13 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vec } -void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector msg_candidate, std::vector &bytes) +void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector& msg_candidate, std::vector &bytes) { std::stringstream ss; const size_t bits_per_byte = 8; uint8_t byte = 0; VLOG(LMORE) << "zerropad_back_and_convert_to_bytes():" << byte; - for (std::vector::const_iterator candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it) + for (auto candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it) { int32_t idx_bit = candidate_bit_it - msg_candidate.begin(); int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte); @@ -388,14 +388,14 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_by } -void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector msg_candidate, std::vector &bytes) +void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector& msg_candidate, std::vector &bytes) { std::stringstream ss; const size_t bits_per_byte = 8; uint8_t byte = 0; int32_t idx_bit = 6; // insert 6 zeros at the front to fit the 250bits into a multiple of bytes VLOG(LMORE) << "zerropad_front_and_convert_to_bytes():" << byte; - for (std::vector::const_iterator candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it) + for (auto candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it) { int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte); byte |= static_cast(*candidate_bit_it) << bit_pos_in_current_byte; @@ -422,8 +422,8 @@ int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( VLOG(FLOW) << "general_work(): " << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0]; // get pointers on in- and output gnss-synchro objects - Gnss_Synchro *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer - const Gnss_Synchro *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer + auto *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer + const auto *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block // 1. Copy the current tracking output @@ -460,17 +460,16 @@ int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( // compute message sample stamp // and fill messages in SBAS raw message objects //std::vector sbas_raw_msgs; - for (std::vector::const_iterator it = valid_msgs.cbegin(); - it != valid_msgs.cend(); ++it) + for (const auto & valid_msg : valid_msgs) { int32_t message_sample_offset = - (sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first; + (sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * valid_msg.first; double message_sample_stamp = sample_stamp + static_cast(message_sample_offset) / 1000.0; VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp << " (sample_stamp=" << sample_stamp << " sample_alignment=" << sample_alignment << " symbol_alignment=" << symbol_alignment - << " relative_preamble_start=" << it->first + << " relative_preamble_start=" << valid_msg.first << " message_sample_offset=" << message_sample_offset << ")"; //Sbas_Raw_Msg sbas_raw_msg(message_sample_stamp, this->d_satellite.get_PRN(), it->second); diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h index 27853723f..9bf2f05f3 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h @@ -104,7 +104,7 @@ private: * samples length must be a multiple of two * for block operation */ - bool get_symbols(const std::vector samples, std::vector &symbols); + bool get_symbols(const std::vector& samples, std::vector &symbols); private: int32_t d_n_smpls_in_history; @@ -122,7 +122,7 @@ private: symbol_aligner_and_decoder(); ~symbol_aligner_and_decoder(); void reset(); - bool get_bits(const std::vector symbols, std::vector &bits); + bool get_bits(const std::vector& symbols, std::vector &bits); private: int32_t d_KK; @@ -137,7 +137,7 @@ private: { public: void reset(); - void get_frame_candidates(const std::vector bits, std::vector>> &msg_candidates); + void get_frame_candidates(const std::vector& bits, std::vector>> &msg_candidates); private: std::deque d_buffer; @@ -149,13 +149,13 @@ private: { public: void reset(); - void get_valid_frames(const std::vector msg_candidates, std::vector &valid_msgs); + void get_valid_frames(const std::vector& msg_candidates, std::vector &valid_msgs); private: typedef boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> crc_24_q_type; crc_24_q_type d_checksum_agent; - void zerropad_front_and_convert_to_bytes(const std::vector msg_candidate, std::vector &bytes); - void zerropad_back_and_convert_to_bytes(const std::vector msg_candidate, std::vector &bytes); + void zerropad_front_and_convert_to_bytes(const std::vector& msg_candidate, std::vector &bytes); + void zerropad_back_and_convert_to_bytes(const std::vector& msg_candidate, std::vector &bytes); } d_crc_verifier; }; diff --git a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc index 4d399939a..ef71c4537 100644 --- a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc +++ b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc @@ -180,7 +180,7 @@ int Viterbi_Decoder::do_acs(const double sym[], int nbits) int t, i, state_at_t; float metric; float max_val; - float* pm_t_next = new float[d_states]; + auto* pm_t_next = new float[d_states]; /* t: * - state: state at t @@ -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="< + +#include #include "Galileo_E1.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" @@ -46,8 +48,8 @@ using google::LogMessage; GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( - ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## @@ -78,7 +80,7 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( vector_length = std::round(fs_in / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)); //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = galileo_e1_tcp_connector_make_tracking_cc( diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h index 8a75834d6..01d62b60b 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h @@ -53,7 +53,7 @@ class GalileoE1TcpConnectorTracking : public TrackingInterface { public: GalileoE1TcpConnectorTracking(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.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index e1654c3fe..7bc826568 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -47,7 +47,7 @@ using google::LogMessage; GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( - 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 trk_param = Dll_Pll_Conf(); @@ -128,7 +128,7 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( trk_param.carrier_lock_th = carrier_lock_th; //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = dll_pll_veml_make_tracking(trk_param); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h index c9444f503..a91b8b556 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h @@ -52,7 +52,7 @@ class GalileoE5aDllPllTracking : public TrackingInterface { public: GalileoE5aDllPllTracking(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 1cc05bf07..a285dc0b0 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -48,7 +48,7 @@ using google::LogMessage; GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( - 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) { DLOG(INFO) << "role " << role; @@ -83,7 +83,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( vector_length = std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS)); //################# MAKE TRACKING GNURadio object ################### - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_cc = glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( @@ -99,7 +99,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( early_late_space_chips); DLOG(INFO) << "tracking(" << tracking_cc->unique_id() << ")"; } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); tracking_sc = glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( @@ -142,11 +142,11 @@ void GlonassL1CaDllPllCAidTracking::stop_tracking() void GlonassL1CaDllPllCAidTracking::start_tracking() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->start_tracking(); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->start_tracking(); } @@ -164,11 +164,11 @@ void GlonassL1CaDllPllCAidTracking::set_channel(unsigned int channel) { channel_ = channel; - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->set_channel(channel); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->set_channel(channel); } @@ -181,11 +181,11 @@ void GlonassL1CaDllPllCAidTracking::set_channel(unsigned int channel) void GlonassL1CaDllPllCAidTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->set_gnss_synchro(p_gnss_synchro); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->set_gnss_synchro(p_gnss_synchro); } @@ -216,11 +216,11 @@ void GlonassL1CaDllPllCAidTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_left_block() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return tracking_cc; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return tracking_sc; } @@ -234,11 +234,11 @@ gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_left_block() gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_right_block() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return tracking_cc; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return tracking_sc; } diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h index 26e1f0db9..aa9ab78d5 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h @@ -54,7 +54,7 @@ class GlonassL1CaDllPllCAidTracking : public TrackingInterface { public: GlonassL1CaDllPllCAidTracking(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index 1b1ce8559..d5d530761 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -47,7 +47,7 @@ using google::LogMessage; GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( - 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) { DLOG(INFO) << "role " << role; @@ -75,7 +75,7 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( vector_length = std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS)); //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = glonass_l1_ca_dll_pll_make_tracking_cc( diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h index d5e1a4544..57c4db85e 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h @@ -52,7 +52,7 @@ class GlonassL1CaDllPllTracking : public TrackingInterface { public: GlonassL1CaDllPllTracking(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index dac410e41..c23cc3263 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -46,7 +46,7 @@ using google::LogMessage; GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( - 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) { DLOG(INFO) << "role " << role; @@ -81,7 +81,7 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( vector_length = std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS)); //################# MAKE TRACKING GNURadio object ################### - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_cc = glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( @@ -97,7 +97,7 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( early_late_space_chips); DLOG(INFO) << "tracking(" << tracking_cc->unique_id() << ")"; } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); tracking_sc = glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( @@ -140,11 +140,11 @@ void GlonassL2CaDllPllCAidTracking::stop_tracking() void GlonassL2CaDllPllCAidTracking::start_tracking() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->start_tracking(); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->start_tracking(); } @@ -162,11 +162,11 @@ void GlonassL2CaDllPllCAidTracking::set_channel(unsigned int channel) { channel_ = channel; - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->set_channel(channel); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->set_channel(channel); } @@ -179,11 +179,11 @@ void GlonassL2CaDllPllCAidTracking::set_channel(unsigned int channel) void GlonassL2CaDllPllCAidTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->set_gnss_synchro(p_gnss_synchro); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->set_gnss_synchro(p_gnss_synchro); } @@ -214,11 +214,11 @@ void GlonassL2CaDllPllCAidTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_left_block() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return tracking_cc; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return tracking_sc; } @@ -232,11 +232,11 @@ gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_left_block() gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_right_block() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return tracking_cc; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return tracking_sc; } diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h index 085cf73ac..a35fec269 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h @@ -52,7 +52,7 @@ class GlonassL2CaDllPllCAidTracking : public TrackingInterface { public: GlonassL2CaDllPllCAidTracking(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc index e6c40bdc3..16b223000 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc @@ -45,7 +45,7 @@ using google::LogMessage; GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( - 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) { DLOG(INFO) << "role " << role; @@ -73,7 +73,7 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( vector_length = std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS)); //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = glonass_l2_ca_dll_pll_make_tracking_cc( diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h index 1c2b715ed..7cf16c5ef 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h @@ -51,7 +51,7 @@ class GlonassL2CaDllPllTracking : public TrackingInterface { public: GlonassL2CaDllPllTracking(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_c_aid_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc index 143d31e5f..0b8366d4a 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc @@ -47,7 +47,7 @@ using google::LogMessage; GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( - 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) { DLOG(INFO) << "role " << role; @@ -82,7 +82,7 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); //################# MAKE TRACKING GNURadio object ################### - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_cc = gps_l1_ca_dll_pll_c_aid_make_tracking_cc( @@ -98,7 +98,7 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( early_late_space_chips); DLOG(INFO) << "tracking(" << tracking_cc->unique_id() << ")"; } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); tracking_sc = gps_l1_ca_dll_pll_c_aid_make_tracking_sc( @@ -141,11 +141,11 @@ void GpsL1CaDllPllCAidTracking::stop_tracking() void GpsL1CaDllPllCAidTracking::start_tracking() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->start_tracking(); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->start_tracking(); } @@ -162,11 +162,11 @@ void GpsL1CaDllPllCAidTracking::set_channel(unsigned int channel) { channel_ = channel; - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->set_channel(channel); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->set_channel(channel); } @@ -178,11 +178,11 @@ void GpsL1CaDllPllCAidTracking::set_channel(unsigned int channel) void GpsL1CaDllPllCAidTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { tracking_cc->set_gnss_synchro(p_gnss_synchro); } - else if (item_type_.compare("cshort") == 0) + else if (item_type_ == "cshort") { tracking_sc->set_gnss_synchro(p_gnss_synchro); } @@ -210,11 +210,11 @@ void GpsL1CaDllPllCAidTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_left_block() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return tracking_cc; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return tracking_sc; } @@ -227,11 +227,11 @@ gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_left_block() gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_right_block() { - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { return tracking_cc; } - else if (item_type_.compare("cshort") == 0) + if (item_type_ == "cshort") { return tracking_sc; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h index 6b4dec2e5..04793a841 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h @@ -53,7 +53,7 @@ class GpsL1CaDllPllCAidTracking : public TrackingInterface { public: GpsL1CaDllPllCAidTracking(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.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index fdb489ac2..df14b07c2 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -47,7 +47,7 @@ using google::LogMessage; GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( - 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 trk_param = Dll_Pll_Conf(); @@ -132,7 +132,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( trk_param.carrier_lock_th = carrier_lock_th; //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = dll_pll_veml_make_tracking(trk_param); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h index cbd4797f2..f3d62a2e5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h @@ -51,7 +51,7 @@ class GpsL1CaDllPllTracking : public TrackingInterface { public: GpsL1CaDllPllTracking(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_kf_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc index df5144768..37b4d817b 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc @@ -49,7 +49,7 @@ using google::LogMessage; GpsL1CaKfTracking::GpsL1CaKfTracking( - 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) { DLOG(INFO) << "role " << role; @@ -90,7 +90,7 @@ GpsL1CaKfTracking::GpsL1CaKfTracking( bce_kappa = configuration->property(role + ".bce_kappa", 0); //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = gps_l1_ca_kf_make_tracking_cc( diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h index d8af76ce8..e26198619 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h @@ -53,7 +53,7 @@ class GpsL1CaKfTracking : public TrackingInterface { public: GpsL1CaKfTracking(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_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index dfc97b026..db4370b74 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -37,6 +37,8 @@ #include "gps_l1_ca_tcp_connector_tracking.h" #include + +#include #include "GPS_L1_CA.h" #include "configuration_interface.h" @@ -45,8 +47,8 @@ using google::LogMessage; GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( - ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## @@ -70,7 +72,7 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = gps_l1_ca_tcp_connector_make_tracking_cc( diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h index f2fb94b3a..d81f1af9e 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h @@ -52,7 +52,7 @@ class GpsL1CaTcpConnectorTracking : public TrackingInterface { public: GpsL1CaTcpConnectorTracking(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.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index 8ce730a75..08fecebc4 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -47,7 +47,7 @@ using google::LogMessage; GpsL2MDllPllTracking::GpsL2MDllPllTracking( - 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 trk_param = Dll_Pll_Conf(); @@ -109,7 +109,7 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( trk_param.carrier_lock_th = carrier_lock_th; //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = dll_pll_veml_make_tracking(trk_param); diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h index 23835c405..854fd61e7 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h @@ -51,7 +51,7 @@ class GpsL2MDllPllTracking : public TrackingInterface { public: GpsL2MDllPllTracking(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.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index aa80cc582..22bcb5c25 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -47,7 +47,7 @@ using google::LogMessage; GpsL5DllPllTracking::GpsL5DllPllTracking( - 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 trk_param = Dll_Pll_Conf(); @@ -128,7 +128,7 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( trk_param.carrier_lock_th = carrier_lock_th; //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) + if (item_type == "gr_complex") { item_size_ = sizeof(gr_complex); tracking_ = dll_pll_veml_make_tracking(trk_param); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h index 59a8983fc..83ce4865d 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h @@ -50,7 +50,7 @@ class GpsL5DllPllTracking : public TrackingInterface { public: GpsL5DllPllTracking(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.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 5bfe54caf..be2b6cd77 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -113,7 +113,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl 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; @@ -133,11 +133,11 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl // 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; } @@ -151,7 +151,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl 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; @@ -165,7 +165,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl 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; @@ -207,7 +207,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl 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; @@ -231,7 +231,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl } 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; @@ -423,10 +423,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_dump_filename = trk_parameters.dump_filename; std::string dump_path; // Get 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 @@ -438,9 +438,9 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl 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; @@ -472,15 +472,15 @@ void dll_pll_veml_tracking::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") { gps_l1_ca_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); } - else if (systemName.compare("GPS") == 0 and signal_type.compare("2S") == 0) + else if (systemName == "GPS" and signal_type == "2S") { gps_l2c_m_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN); } - 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) { @@ -494,7 +494,7 @@ void dll_pll_veml_tracking::start_tracking() gps_l5i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN); } } - 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) { @@ -509,9 +509,9 @@ void dll_pll_veml_tracking::start_tracking() galileo_e1_code_gen_sinboc11_float(d_tracking_code, d_acquisition_gnss_synchro->Signal, d_acquisition_gnss_synchro->PRN); } } - else if (systemName.compare("Galileo") == 0 and signal_type.compare("5X") == 0) + else if (systemName == "Galileo" and signal_type == "5X") { - gr_complex *aux_code = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex) * d_code_length_chips, volk_gnsssdr_get_alignment())); + auto *aux_code = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex) * d_code_length_chips, volk_gnsssdr_get_alignment())); galileo_e5_a_code_gen_complex_primary(aux_code, d_acquisition_gnss_synchro->PRN, const_cast(signal_type.c_str())); if (trk_parameters.track_pilot) { @@ -578,7 +578,7 @@ void dll_pll_veml_tracking::start_tracking() dll_pll_veml_tracking::~dll_pll_veml_tracking() { - if (signal_type.compare("1C") == 0) + if (signal_type == "1C") { volk_gnsssdr_free(d_gps_l1ca_preambles_symbols); } @@ -653,17 +653,14 @@ bool dll_pll_veml_tracking::acquire_secondary() { return true; } - else - { - return false; - } + + return false; } bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_time_s) { // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < trk_parameters.cn0_samples) { // fill buffer with prompt correlator output values @@ -671,35 +668,29 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_ d_cn0_estimation_counter++; return true; } + d_cn0_estimation_counter = 0; + // Code lock indicator + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, trk_parameters.cn0_samples, coh_integration_time_s); + // Carrier lock indicator + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, trk_parameters.cn0_samples); + // Loss of lock detection + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) + { + d_carrier_lock_fail_counter++; + } else { - d_cn0_estimation_counter = 0; - // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, trk_parameters.cn0_samples, coh_integration_time_s); - // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, trk_parameters.cn0_samples); - // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) - { - d_carrier_lock_fail_counter++; - } - else - { - 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; - } - 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; } @@ -1082,28 +1073,28 @@ int32_t dll_pll_veml_tracking::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 *carrier_doppler_rate_hz = new float[num_epoch]; - float *code_freq_chips = new float[num_epoch]; - float *code_freq_rate_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 *carrier_doppler_rate_hz = new float[num_epoch]; + auto *code_freq_chips = new float[num_epoch]; + auto *code_freq_rate_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 { @@ -1340,8 +1331,8 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { gr::thread::scoped_lock l(d_setlock); - const gr_complex *in = reinterpret_cast(input_items[0]); - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); + auto **out = reinterpret_cast(&output_items[0]); Gnss_Synchro current_synchro_data = Gnss_Synchro(); switch (d_state) 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 1ae3d7fb7..a7b4d0780 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 @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -63,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, - std::string dump_filename, + const std::string &dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, @@ -103,7 +104,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); // Initialize tracking ========================================== //--- DLL variables -------------------------------------------------------- @@ -525,7 +526,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri // AUX vars (for debug purposes) tmp_float = 0.0; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; @@ -543,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 724207ab3..dedb723f5 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 @@ -57,7 +57,7 @@ galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_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, @@ -87,7 +87,7 @@ private: galileo_e1_tcp_connector_make_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 362596385..c2d7d9364 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 @@ -54,6 +54,7 @@ #include #include #include +#include #define CN0_ESTIMATION_SAMPLES 10 @@ -74,7 +75,7 @@ glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( float early_late_space_chips) { return glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_cc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -94,7 +95,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) //avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_s = pmt::to_double(std::move(msg)); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -125,7 +126,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_correlation_length_samples = static_cast(d_vector_length); // Initialize tracking ========================================== @@ -379,24 +380,24 @@ int32_t glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -591,8 +592,8 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers - const gr_complex *in = reinterpret_cast(input_items[0]); // PRN start block alignment - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); // PRN start block alignment + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -907,7 +908,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // AUX vars (for debug purposes) tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; 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 5884e3704..5a1d08090 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 @@ -53,6 +53,7 @@ #include #include #include +#include #define CN0_ESTIMATION_SAMPLES 10 @@ -72,7 +73,7 @@ glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( float early_late_space_chips) { return glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_sc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -92,7 +93,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) //avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_s = pmt::to_double(std::move(msg)); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -120,7 +121,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_correlation_length_samples = static_cast(d_vector_length); // Initialize tracking ========================================== @@ -333,24 +334,24 @@ int32_t glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -582,8 +583,8 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers - const lv_16sc_t *in = reinterpret_cast(input_items[0]); // PRN start block alignment - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); // PRN start block alignment + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -896,7 +897,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // AUX vars (for debug purposes) tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; 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 de72d6e77..52e612164 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 @@ -52,6 +52,7 @@ #include #include #include +#include #define CN0_ESTIMATION_SAMPLES 10 @@ -68,7 +69,7 @@ glonass_l1_ca_dll_pll_make_tracking_cc( float early_late_space_chips) { return glonass_l1_ca_dll_pll_tracking_cc_sptr(new Glonass_L1_Ca_Dll_Pll_Tracking_cc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, early_late_space_chips)); } @@ -98,7 +99,7 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_current_prn_length_samples = static_cast(d_vector_length); @@ -331,24 +332,24 @@ int32_t Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -549,8 +550,8 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut double code_error_filt_chips = 0.0; // Block input data and block output stream pointers - const gr_complex *in = reinterpret_cast(input_items[0]); // PRN start block alignment - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); // PRN start block alignment + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -749,7 +750,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // AUX vars (for debug purposes) tmp_float = d_rem_code_phase_samples; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; 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 bd53ba4cd..e5aacb3bf 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 @@ -52,6 +52,7 @@ #include #include #include +#include #define CN0_ESTIMATION_SAMPLES 10 @@ -71,7 +72,7 @@ glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( float early_late_space_chips) { return glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_cc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -91,7 +92,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) //avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_s = pmt::to_double(std::move(msg)); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -122,7 +123,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_correlation_length_samples = static_cast(d_vector_length); // Initialize tracking ========================================== @@ -376,24 +377,24 @@ int32_t glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -588,8 +589,8 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers - const gr_complex *in = reinterpret_cast(input_items[0]); // PRN start block alignment - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); // PRN start block alignment + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -904,7 +905,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // AUX vars (for debug purposes) tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; 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 6fcad3386..7f2a5fac1 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 @@ -51,6 +51,7 @@ #include #include #include +#include #define CN0_ESTIMATION_SAMPLES 10 @@ -70,7 +71,7 @@ glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( float early_late_space_chips) { return glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_sc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -90,7 +91,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) //avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_s = pmt::to_double(std::move(msg)); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -119,7 +120,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_correlation_length_samples = static_cast(d_vector_length); // Initialize tracking ========================================== @@ -332,24 +333,24 @@ int32_t glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -581,8 +582,8 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers - const lv_16sc_t *in = reinterpret_cast(input_items[0]); // PRN start block alignment - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); // PRN start block alignment + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -895,7 +896,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // AUX vars (for debug purposes) tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; 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 21b0ec537..b3e14d11f 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 @@ -52,6 +52,7 @@ #include #include #include +#include #define CN0_ESTIMATION_SAMPLES 10 @@ -68,7 +69,7 @@ glonass_l2_ca_dll_pll_make_tracking_cc( float early_late_space_chips) { return glonass_l2_ca_dll_pll_tracking_cc_sptr(new Glonass_L2_Ca_Dll_Pll_Tracking_cc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, early_late_space_chips)); } @@ -98,7 +99,7 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_current_prn_length_samples = static_cast(d_vector_length); @@ -331,24 +332,24 @@ int32_t Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -549,8 +550,8 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut double code_error_filt_chips = 0.0; // Block input data and block output stream pointers - const gr_complex *in = reinterpret_cast(input_items[0]); // PRN start block alignment - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); // PRN start block alignment + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -749,7 +750,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // AUX vars (for debug purposes) tmp_float = d_rem_code_phase_samples; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; 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 40269d5cb..8ad85d13e 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 @@ -45,6 +45,7 @@ #include #include #include +#include using google::LogMessage; @@ -63,7 +64,7 @@ gps_l1_ca_dll_pll_c_aid_make_tracking_cc( float early_late_space_chips) { return gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_cc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -83,7 +84,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) //avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_s = pmt::to_double(std::move(msg)); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -114,7 +115,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_correlation_length_samples = static_cast(d_vector_length); // Initialize tracking ========================================== @@ -358,24 +359,24 @@ int32_t gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -570,8 +571,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers - const gr_complex *in = reinterpret_cast(input_items[0]); - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_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(); @@ -885,7 +886,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib // AUX vars (for debug purposes) tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; @@ -904,8 +905,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 cc510adcc..5caacfd8d 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 @@ -45,6 +45,7 @@ #include #include #include +#include using google::LogMessage; @@ -63,7 +64,7 @@ gps_l1_ca_dll_pll_c_aid_make_tracking_sc( float early_late_space_chips) { return gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_sc( - fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); + fs_in, vector_length, dump, std::move(dump_filename), pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -83,7 +84,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pmt_t DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); if (d_enable_extended_integration == false) //avoid re-setting preamble indicator { - d_preamble_timestamp_s = pmt::to_double(msg); + d_preamble_timestamp_s = pmt::to_double(std::move(msg)); d_enable_extended_integration = true; d_preamble_synchronized = false; } @@ -111,7 +112,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_correlation_length_samples = static_cast(d_vector_length); // Initialize tracking ========================================== @@ -360,24 +361,24 @@ int32_t gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() { return 1; } - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = 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]; - double *acc_carrier_phase_rad = new double[num_epoch]; - double *carrier_doppler_hz = new double[num_epoch]; - double *code_freq_chips = new double[num_epoch]; - double *carr_error_hz = new double[num_epoch]; - double *carr_error_filt_hz = new double[num_epoch]; - double *code_error_chips = new double[num_epoch]; - double *code_error_filt_chips = new double[num_epoch]; - double *CN0_SNV_dB_Hz = new double[num_epoch]; - double *carrier_lock_test = new double[num_epoch]; - double *aux1 = new double[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = 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 double[num_epoch]; + auto *carrier_doppler_hz = new double[num_epoch]; + auto *code_freq_chips = new double[num_epoch]; + auto *carr_error_hz = new double[num_epoch]; + auto *carr_error_filt_hz = new double[num_epoch]; + auto *code_error_chips = new double[num_epoch]; + auto *code_error_filt_chips = new double[num_epoch]; + auto *CN0_SNV_dB_Hz = new double[num_epoch]; + auto *carrier_lock_test = new double[num_epoch]; + auto *aux1 = new double[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -572,8 +573,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers - const lv_16sc_t *in = reinterpret_cast(input_items[0]); //PRN start block alignment - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); //PRN start block alignment + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -886,7 +887,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib // AUX vars (for debug purposes) tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; @@ -905,8 +906,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 91f0eaf11..28148a004 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 @@ -53,6 +53,7 @@ #include #include #include +#include using google::LogMessage; @@ -74,7 +75,7 @@ gps_l1_ca_kf_make_tracking_cc( int32_t bce_kappa) { return gps_l1_ca_kf_tracking_cc_sptr(new Gps_L1_Ca_Kf_Tracking_cc(order, if_freq, - fs_in, vector_length, dump, dump_filename, dll_bw_hz, early_late_space_chips, + fs_in, vector_length, dump, std::move(dump_filename), dll_bw_hz, early_late_space_chips, bce_run, bce_ptrans, bce_strans, bce_nu, bce_kappa)); } @@ -115,7 +116,7 @@ Gps_L1_Ca_Kf_Tracking_cc::Gps_L1_Ca_Kf_Tracking_cc( d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); d_current_prn_length_samples = static_cast(d_vector_length); @@ -427,28 +428,28 @@ int32_t Gps_L1_Ca_Kf_Tracking_cc::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 *carrier_dopplerrate_hz2 = new float[num_epoch]; - float *code_freq_chips = new float[num_epoch]; - float *carr_error_hz = new float[num_epoch]; - float *carr_noise_sigma2 = 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 *carrier_dopplerrate_hz2 = new float[num_epoch]; + auto *code_freq_chips = new float[num_epoch]; + auto *carr_error_hz = new float[num_epoch]; + auto *carr_noise_sigma2 = 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 { @@ -677,8 +678,8 @@ int Gps_L1_Ca_Kf_Tracking_cc::general_work(int noutput_items __attribute__((unus double code_error_filt_chips = 0.0; // Block input data and block output stream pointers - const gr_complex *in = reinterpret_cast(input_items[0]); - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + const auto *in = reinterpret_cast(input_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(); 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 7a936d622..8c9cb9e51 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 @@ -52,6 +52,7 @@ #include #include #include +#include using google::LogMessage; @@ -61,7 +62,7 @@ gps_l1_ca_tcp_connector_make_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) { @@ -94,7 +95,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( d_dump = dump; d_fs_in = fs_in; d_vector_length = vector_length; - d_dump_filename = dump_filename; + d_dump_filename = std::move(dump_filename); //--- DLL variables -------------------------------------------------------- d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips) @@ -562,7 +563,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib // AUX vars (for debug purposes) tmp_float = 0.0; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - double tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); + auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // PRN uint32_t prn_ = d_acquisition_gnss_synchro->PRN; @@ -582,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 f946ed0c8..91bdb0890 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 @@ -54,7 +54,7 @@ gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_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); @@ -86,7 +86,7 @@ private: gps_l1_ca_tcp_connector_make_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/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/INIReader.cc b/src/core/libs/INIReader.cc index 1caaae967..9589365bb 100644 --- a/src/core/libs/INIReader.cc +++ b/src/core/libs/INIReader.cc @@ -49,9 +49,10 @@ #include "ini.h" #include // for tolower #include // for stro +#include -INIReader::INIReader(std::string filename) +INIReader::INIReader(const std::string& filename) { _error = ini_parse(filename.c_str(), ValueHandler, this); } @@ -65,14 +66,14 @@ int INIReader::ParseError() std::string INIReader::Get(std::string section, std::string name, std::string default_value) { - std::string key = MakeKey(section, name); + std::string key = MakeKey(std::move(section), std::move(name)); return _values.count(key) ? _values[key] : default_value; } int64_t INIReader::GetInteger(std::string section, std::string name, int64_t default_value) { - std::string valstr = Get(section, name, ""); + std::string valstr = Get(std::move(section), std::move(name), ""); const char* value = valstr.c_str(); char* end; // This parses "1234" (decimal) and also "0x4D2" (hex) @@ -81,12 +82,12 @@ int64_t INIReader::GetInteger(std::string section, std::string name, int64_t def } -std::string INIReader::MakeKey(std::string section, std::string name) +std::string INIReader::MakeKey(const std::string& section, const std::string& name) { std::string key = section + "." + name; // Convert to lower case to make lookups case-insensitive - for (unsigned int i = 0; i < key.length(); i++) - key[i] = tolower(key[i]); + for (char & i : key) + i = tolower(i); return key; } @@ -94,7 +95,7 @@ std::string INIReader::MakeKey(std::string section, std::string name) int INIReader::ValueHandler(void* user, const char* section, const char* name, const char* value) { - INIReader* reader = static_cast(user); + auto* reader = static_cast(user); reader->_values[MakeKey(section, name)] = value; return 1; } diff --git a/src/core/libs/INIReader.h b/src/core/libs/INIReader.h index 0680cb89e..53a8afb08 100644 --- a/src/core/libs/INIReader.h +++ b/src/core/libs/INIReader.h @@ -60,7 +60,7 @@ class INIReader { public: //! Construct INIReader and parse given filename. See ini.h for more info about the parsing. - INIReader(std::string filename); + INIReader(const std::string& filename); //! Return the result of ini_parse(), i.e., 0 on success, line number of first error on parse error, or -1 on file open error. int ParseError(); @@ -75,7 +75,7 @@ public: private: int _error; std::map _values; - static std::string MakeKey(std::string section, std::string name); + static std::string MakeKey(const std::string& section, const std::string& name); static int ValueHandler(void* user, const char* section, const char* name, const char* value); }; diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 33bf51a47..46b0b0031 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -369,7 +369,7 @@ void gnss_sdr_supl_client::read_supl_data() } -bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name) +bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string& file_name) { std::ifstream ifs; try @@ -389,7 +389,7 @@ bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name) } -bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, std::map eph_map) +bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string& file_name, std::map eph_map) { if (eph_map.empty() == false) { @@ -416,7 +416,7 @@ bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, s } -bool gnss_sdr_supl_client::load_gal_ephemeris_xml(const std::string file_name) +bool gnss_sdr_supl_client::load_gal_ephemeris_xml(const std::string& file_name) { std::ifstream ifs; try @@ -436,7 +436,7 @@ bool gnss_sdr_supl_client::load_gal_ephemeris_xml(const std::string file_name) } -bool save_gal_ephemeris_map_xml(const std::string file_name, std::map eph_map) +bool save_gal_ephemeris_map_xml(const std::string& file_name, std::map eph_map) { if (eph_map.empty() == false) { @@ -463,7 +463,7 @@ bool save_gal_ephemeris_map_xml(const std::string file_name, std::map eph_map) +bool save_cnav_ephemeris_map_xml(const std::string& file_name, std::map eph_map) { if (eph_map.empty() == false) { @@ -510,7 +510,7 @@ bool save_cnav_ephemeris_map_xml(const std::string file_name, std::map eph_map) +bool save_gnav_ephemeris_map_xml(const std::string& file_name, std::map eph_map) { if (eph_map.empty() == false) { @@ -557,7 +557,7 @@ bool save_gnav_ephemeris_map_xml(const std::string file_name, std::map gps_almanac_map) +bool gnss_sdr_supl_client::save_gps_almanac_xml(const std::string& file_name, std::map gps_almanac_map) { if (gps_almanac_map.empty() == false) { @@ -834,7 +834,7 @@ bool gnss_sdr_supl_client::save_gps_almanac_xml(const std::string file_name, std } -bool gnss_sdr_supl_client::load_gal_almanac_xml(const std::string file_name) +bool gnss_sdr_supl_client::load_gal_almanac_xml(const std::string& file_name) { std::ifstream ifs; try @@ -854,7 +854,7 @@ bool gnss_sdr_supl_client::load_gal_almanac_xml(const std::string file_name) } -bool gnss_sdr_supl_client::read_gal_almanac_from_gsa(const std::string file_name) +bool gnss_sdr_supl_client::read_gal_almanac_from_gsa(const std::string& file_name) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(file_name.c_str()); @@ -904,7 +904,7 @@ bool gnss_sdr_supl_client::read_gal_almanac_from_gsa(const std::string file_name } -bool gnss_sdr_supl_client::save_gal_almanac_xml(const std::string file_name, std::map gal_almanac_map) +bool gnss_sdr_supl_client::save_gal_almanac_xml(const std::string& file_name, std::map gal_almanac_map) { if (gal_almanac_map.empty() == false) { @@ -931,7 +931,7 @@ bool gnss_sdr_supl_client::save_gal_almanac_xml(const std::string file_name, std } -bool gnss_sdr_supl_client::load_glo_utc_xml(const std::string file_name) +bool gnss_sdr_supl_client::load_glo_utc_xml(const std::string& file_name) { std::ifstream ifs; try @@ -950,7 +950,7 @@ bool gnss_sdr_supl_client::load_glo_utc_xml(const std::string file_name) } -bool gnss_sdr_supl_client::save_glo_utc_xml(const std::string file_name, Glonass_Gnav_Utc_Model& utc) +bool gnss_sdr_supl_client::save_glo_utc_xml(const std::string& file_name, Glonass_Gnav_Utc_Model& utc) { if (utc.valid) { @@ -977,7 +977,7 @@ bool gnss_sdr_supl_client::save_glo_utc_xml(const std::string file_name, Glonass } -bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name) +bool gnss_sdr_supl_client::load_ref_time_xml(const std::string& file_name) { std::ifstream ifs; try @@ -996,7 +996,7 @@ bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name) } -bool gnss_sdr_supl_client::save_ref_time_xml(const std::string file_name, Agnss_Ref_Time& ref_time) +bool gnss_sdr_supl_client::save_ref_time_xml(const std::string& file_name, Agnss_Ref_Time& ref_time) { if (ref_time.valid == true) { @@ -1023,7 +1023,7 @@ bool gnss_sdr_supl_client::save_ref_time_xml(const std::string file_name, Agnss_ } -bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name) +bool gnss_sdr_supl_client::load_ref_location_xml(const std::string& file_name) { std::ifstream ifs; try @@ -1042,7 +1042,7 @@ bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name) } -bool gnss_sdr_supl_client::save_ref_location_xml(const std::string file_name, Agnss_Ref_Location& ref_location) +bool gnss_sdr_supl_client::save_ref_location_xml(const std::string& file_name, Agnss_Ref_Location& ref_location) { if (ref_location.valid == true) { diff --git a/src/core/libs/gnss_sdr_supl_client.h b/src/core/libs/gnss_sdr_supl_client.h index 2fd599bdf..d25df206a 100644 --- a/src/core/libs/gnss_sdr_supl_client.h +++ b/src/core/libs/gnss_sdr_supl_client.h @@ -77,7 +77,7 @@ private: supl_ctx_t ctx; // assistance data supl_assist_t assist; - bool read_gal_almanac_from_gsa(const std::string file_name); + bool read_gal_almanac_from_gsa(const std::string& file_name); public: // SUPL SERVER INFO @@ -127,18 +127,18 @@ public: /*! * \brief Read GPS NAV ephemeris map from XML file */ - bool load_ephemeris_xml(const std::string file_name); + bool load_ephemeris_xml(const std::string& file_name); /*! * \brief Save ephemeris map to XML file. */ - bool save_ephemeris_map_xml(const std::string file_name, + bool save_ephemeris_map_xml(const std::string& file_name, std::map eph_map); /*! * \brief Read GPS CNAV ephemeris map from XML file */ - bool load_cnav_ephemeris_xml(const std::string file_name); + bool load_cnav_ephemeris_xml(const std::string& file_name); /*! * \brief Save GPS CNAV ephemeris map to XML file. @@ -149,7 +149,7 @@ public: /*! * \brief Read Galileo ephemeris map from XML file */ - bool load_gal_ephemeris_xml(const std::string file_name); + bool load_gal_ephemeris_xml(const std::string& file_name); /*! * \brief Save Galileo ephemeris map to XML file. @@ -160,7 +160,7 @@ public: /*! * \brief Read GLONASS GNAV ephemeris map from XML file */ - bool load_gnav_ephemeris_xml(const std::string file_name); + bool load_gnav_ephemeris_xml(const std::string& file_name); /*! * \brief Save GLONASS GNAV ephemeris map to XML file. @@ -171,103 +171,103 @@ public: /*! * \brief Read GPS utc model from XML file */ - bool load_utc_xml(const std::string file_name); + bool load_utc_xml(const std::string& file_name); /*! * \brief Save UTC model map to XML file */ - bool save_utc_xml(const std::string file_name, Gps_Utc_Model& utc); + bool save_utc_xml(const std::string& file_name, Gps_Utc_Model& utc); /*! * \brief Read CNAV GPS utc model from XML file */ - bool load_cnav_utc_xml(const std::string file_name); + bool load_cnav_utc_xml(const std::string& file_name); /*! * \brief Save CNAV UTC model map to XML file */ - bool save_cnav_utc_xml(const std::string file_name, Gps_CNAV_Utc_Model& utc); + bool save_cnav_utc_xml(const std::string& file_name, Gps_CNAV_Utc_Model& utc); /*! * \brief Read Galileo utc model from XML file */ - bool load_gal_utc_xml(const std::string file_name); + bool load_gal_utc_xml(const std::string& file_name); /*! * \brief Save Galileo UTC model map to XML file */ - bool save_gal_utc_xml(const std::string file_name, Galileo_Utc_Model& utc); + bool save_gal_utc_xml(const std::string& file_name, Galileo_Utc_Model& utc); /*! * \brief Read Galileo almanac map from XML file */ - bool load_gal_almanac_xml(const std::string file_name); + bool load_gal_almanac_xml(const std::string& file_name); /*! * \brief Save Galileo almanac map to XML file */ - bool save_gal_almanac_xml(const std::string file_name, std::map gal_almanac); + bool save_gal_almanac_xml(const std::string& file_name, std::map gal_almanac); /*! * \brief Read GPS almanac map from XML file */ - bool load_gps_almanac_xml(const std::string file_name); + bool load_gps_almanac_xml(const std::string& file_name); /*! * \brief Save GPS almanac map to XML file */ - bool save_gps_almanac_xml(const std::string file_name, std::map gps_almanac_map); + bool save_gps_almanac_xml(const std::string& file_name, std::map gps_almanac_map); /*! * \brief Read iono from XML file */ - bool load_iono_xml(const std::string file_name); + bool load_iono_xml(const std::string& file_name); /*! * \brief Save iono map to XML file */ - bool save_iono_xml(const std::string file_name, Gps_Iono& iono); + bool save_iono_xml(const std::string& file_name, Gps_Iono& iono); /*! * \brief Read Galileo iono from XML file */ - bool load_gal_iono_xml(const std::string file_name); + bool load_gal_iono_xml(const std::string& file_name); /*! * \brief Save Galileo iono map to XML file */ - bool save_gal_iono_xml(const std::string file_name, Galileo_Iono& iono); + bool save_gal_iono_xml(const std::string& file_name, Galileo_Iono& iono); /*! * \brief Read Glonass utc model from XML file */ - bool load_glo_utc_xml(const std::string file_name); + bool load_glo_utc_xml(const std::string& file_name); /*! * \brief Save Glonass UTC model map to XML file */ - bool save_glo_utc_xml(const std::string file_name, Glonass_Gnav_Utc_Model& utc); + bool save_glo_utc_xml(const std::string& file_name, Glonass_Gnav_Utc_Model& utc); /*! * \brief Read ref time from XML file */ - bool load_ref_time_xml(const std::string file_name); + bool load_ref_time_xml(const std::string& file_name); /*! * \brief Save ref time map to XML file */ - bool save_ref_time_xml(const std::string file_name, + bool save_ref_time_xml(const std::string& file_name, Agnss_Ref_Time& ref_time_map); /*! * \brief Read ref location from XML file */ - bool load_ref_location_xml(const std::string file_name); + bool load_ref_location_xml(const std::string& file_name); /*! * \brief Save ref location map to XML file */ - bool save_ref_location_xml(std::string file_name, + bool save_ref_location_xml(const std::string& file_name, Agnss_Ref_Location& ref_location); /* 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/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index bb27826bb..5131dadf2 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -800,7 +800,7 @@ void GNSSFlowgraph::wait() } -bool GNSSFlowgraph::send_telemetry_msg(pmt::pmt_t msg) +bool GNSSFlowgraph::send_telemetry_msg(const pmt::pmt_t& msg) { // Push ephemeris to PVT telemetry msg in port using a channel out port // it uses the first channel as a message producer (it is already connected to PVT) diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index b279f6f67..6ad1063ea 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -128,7 +128,7 @@ public: * * It is used to assist the receiver with external ephemeris data */ - bool send_telemetry_msg(pmt::pmt_t msg); + bool send_telemetry_msg(const pmt::pmt_t& msg); /*! * \brief Returns a smart pointer to the PVT object diff --git a/src/core/receiver/in_memory_configuration.cc b/src/core/receiver/in_memory_configuration.cc index ffca0eed1..4801d2eb2 100644 --- a/src/core/receiver/in_memory_configuration.cc +++ b/src/core/receiver/in_memory_configuration.cc @@ -50,15 +50,12 @@ InMemoryConfiguration::~InMemoryConfiguration() std::string InMemoryConfiguration::property(std::string property_name, std::string default_value) { - std::map::iterator iter = properties_.find(property_name); + auto iter = properties_.find(property_name); if (iter != properties_.end()) { 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 db4a9f9a4..b360a5c02 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -83,8 +83,8 @@ void Glonass_Gnav_Navigation_Message::reset() // Data update information d_previous_tb = 0.0; - for (uint32_t i = 0; i < GLONASS_CA_NBR_SATS; i++) - d_previous_Na[i] = 0.0; + 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 @@ -126,66 +126,66 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset(GLONASS_GNAV_CRC_I_INDEX.size()); i++) + for (int i : GLONASS_GNAV_CRC_I_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_I_INDEX[i] - 1]; + sum_bits += string_bits[i - 1]; } C1 = string_bits[0] ^ (sum_bits % 2); // Compute C2 term sum_bits = 0; - for (int32_t j = 0; j < static_cast(GLONASS_GNAV_CRC_J_INDEX.size()); j++) + for (int j : GLONASS_GNAV_CRC_J_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_J_INDEX[j] - 1]; + sum_bits += string_bits[j - 1]; } C2 = (string_bits[1]) ^ (sum_bits % 2); // Compute C3 term sum_bits = 0; - for (int32_t k = 0; k < static_cast(GLONASS_GNAV_CRC_K_INDEX.size()); k++) + for (int k : GLONASS_GNAV_CRC_K_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_K_INDEX[k] - 1]; + sum_bits += string_bits[k - 1]; } C3 = string_bits[2] ^ (sum_bits % 2); // Compute C4 term sum_bits = 0; - for (int32_t l = 0; l < static_cast(GLONASS_GNAV_CRC_L_INDEX.size()); l++) + for (int l : GLONASS_GNAV_CRC_L_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_L_INDEX[l] - 1]; + sum_bits += string_bits[l - 1]; } C4 = string_bits[3] ^ (sum_bits % 2); // Compute C5 term sum_bits = 0; - for (int32_t m = 0; m < static_cast(GLONASS_GNAV_CRC_M_INDEX.size()); m++) + for (int m : GLONASS_GNAV_CRC_M_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_M_INDEX[m] - 1]; + sum_bits += string_bits[m - 1]; } C5 = string_bits[4] ^ (sum_bits % 2); // Compute C6 term sum_bits = 0; - for (int32_t n = 0; n < static_cast(GLONASS_GNAV_CRC_N_INDEX.size()); n++) + for (int n : GLONASS_GNAV_CRC_N_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_N_INDEX[n] - 1]; + sum_bits += string_bits[n - 1]; } C6 = string_bits[5] ^ (sum_bits % 2); // Compute C7 term sum_bits = 0; - for (int32_t p = 0; p < static_cast(GLONASS_GNAV_CRC_P_INDEX.size()); p++) + for (int p : GLONASS_GNAV_CRC_P_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_P_INDEX[p] - 1]; + sum_bits += string_bits[p - 1]; } C7 = string_bits[6] ^ (sum_bits % 2); // Compute C_Sigma term sum_bits = 0; sum_hamming = 0; - for (int32_t q = 0; q < static_cast(GLONASS_GNAV_CRC_Q_INDEX.size()); q++) + for (int q : GLONASS_GNAV_CRC_Q_INDEX) { - sum_bits += string_bits[GLONASS_GNAV_CRC_Q_INDEX[q] - 1]; + sum_bits += string_bits[q - 1]; } for (int32_t q = 0; q < 8; q++) { @@ -200,7 +200,7 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset bits, const std::vector> parameter) +bool Glonass_Gnav_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector>& parameter) { bool value; @@ -228,7 +228,7 @@ bool Glonass_Gnav_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector> parameter) +uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) { uint64_t value = 0ULL; int32_t num_of_slices = parameter.size(); @@ -247,7 +247,7 @@ uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) +int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector>& parameter) { int64_t value = 0LL; int64_t sign = 0LL; @@ -310,7 +310,7 @@ uint32_t Glonass_Gnav_Navigation_Message::get_frame_number(uint32_t satellite_sl } -int32_t Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) +int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame_string) { int32_t J = 0; d_string_ID = 0U; @@ -733,8 +733,8 @@ bool Glonass_Gnav_Navigation_Message::have_new_utc_model() // Check if we have flag_utc_model_str_5 = false; // clear the flag return true; } - else - return false; + + return false; } diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.h b/src/core/system_parameters/glonass_gnav_navigation_message.h index e13f41511..58b060518 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.h +++ b/src/core/system_parameters/glonass_gnav_navigation_message.h @@ -51,9 +51,9 @@ class Glonass_Gnav_Navigation_Message { private: - uint64_t read_navigation_unsigned(std::bitset bits, const std::vector> parameter); - int64_t read_navigation_signed(std::bitset bits, const std::vector> parameter); - bool read_navigation_bool(std::bitset bits, const std::vector> parameter); + uint64_t read_navigation_unsigned(std::bitset bits, const std::vector>& parameter); + int64_t read_navigation_signed(std::bitset bits, const std::vector>& parameter); + bool read_navigation_bool(std::bitset bits, const std::vector>& parameter); public: bool flag_CRC_test; @@ -159,7 +159,7 @@ public: * \param frame_string [in] is the string message within the parsed frame * \returns Returns the ID of the decoded string */ - int32_t string_decoder(std::string frame_string); + int32_t string_decoder(const std::string& frame_string); /*! * Default constructor diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index 6a6429a9f..b249905d3 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -111,7 +111,7 @@ Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite &rhs) { void Gnss_Satellite::set_system(const std::string& system_) { // Set the satellite system {"GPS", "Glonass", "SBAS", "Galileo", "Compass"} - std::set::iterator it = system_set.find(system_); + auto it = system_set.find(system_); if (it != system_set.cend()) { diff --git a/src/core/system_parameters/gps_cnav_navigation_message.cc b/src/core/system_parameters/gps_cnav_navigation_message.cc index b0605bae9..7ffd0c7d0 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.cc +++ b/src/core/system_parameters/gps_cnav_navigation_message.cc @@ -337,10 +337,7 @@ bool Gps_CNAV_Navigation_Message::have_new_ephemeris() // Check if we have a ne b_flag_ephemeris_2 = false; // clear the flag return true; } - else - { - return false; - } + return false; } else { @@ -362,10 +359,7 @@ bool Gps_CNAV_Navigation_Message::have_new_iono() // Check if we have a new ion b_flag_iono_valid = false; // clear the flag return true; } - else - { - return false; - } + return false; } @@ -382,10 +376,7 @@ bool Gps_CNAV_Navigation_Message::have_new_utc_model() // Check if we have a ne b_flag_utc_valid = false; // clear the flag return true; } - else - { - return false; - } + return false; } diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index 33db275f8..5cd896eb3 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -178,10 +178,8 @@ bool Rtcm::check_CRC(const std::string& message) const { return true; } - else - { - return false; - } + + return false; } @@ -225,9 +223,9 @@ std::string Rtcm::binary_data_to_bin(const std::string& s) const std::string s_aux; std::stringstream ss; - for (uint32_t i = 0; i < s.length(); i++) + for (char i : s) { - uint8_t val = static_cast(s.at(i)); + auto val = static_cast(i); std::bitset<8> bs(val); ss << bs; } @@ -329,7 +327,7 @@ int32_t Rtcm::bin_to_sint(const std::string& s) const int32_t sign; // Check for sign bit as defined RTCM doc - if (s.substr(0, 1).compare("0") == 0) + if (s.substr(0, 1) == "0") { sign = 1; // Get the magnitude of the value @@ -488,7 +486,7 @@ std::bitset<58> Rtcm::get_MT1001_sat_content(const Gps_Ephemeris& eph, double ob std::string Rtcm::print_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -537,7 +535,7 @@ std::string Rtcm::print_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, co std::string Rtcm::print_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -608,7 +606,7 @@ std::bitset<74> Rtcm::get_MT1002_sat_content(const Gps_Ephemeris& eph, double ob std::string Rtcm::print_MT1003(const Gps_Ephemeris& ephL1, const Gps_CNAV_Ephemeris& ephL2, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -717,7 +715,7 @@ std::bitset<101> Rtcm::get_MT1003_sat_content(const Gps_Ephemeris& ephL1, const std::string Rtcm::print_MT1004(const Gps_Ephemeris& ephL1, const Gps_CNAV_Ephemeris& ephL2, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -1169,7 +1167,7 @@ std::bitset<64> Rtcm::get_MT1009_sat_content(const Glonass_Gnav_Ephemeris& eph, std::string Rtcm::print_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -1218,7 +1216,7 @@ std::string Rtcm::print_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, d std::string Rtcm::print_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -1293,7 +1291,7 @@ std::bitset<79> Rtcm::get_MT1010_sat_content(const Glonass_Gnav_Ephemeris& eph, std::string Rtcm::print_MT1011(const Glonass_Gnav_Ephemeris& ephL1, const Glonass_Gnav_Ephemeris& ephL2, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -1404,7 +1402,7 @@ std::bitset<107> Rtcm::get_MT1011_sat_content(const Glonass_Gnav_Ephemeris& ephL std::string Rtcm::print_MT1012(const Glonass_Gnav_Ephemeris& ephL1, const Glonass_Gnav_Ephemeris& ephL2, double obs_time, const std::map& observables, uint16_t station_id) { - uint32_t ref_id = static_cast(station_id); + auto ref_id = static_cast(station_id); uint32_t smooth_int = 0; bool sync_flag = false; bool divergence_free = false; @@ -2357,7 +2355,7 @@ std::string Rtcm::get_MSM_header(uint32_t msg_number, std::string header = DF002.to_string() + DF003.to_string(); // GNSS Epoch Time Specific to each constellation - if ((sys.compare("R") == 0)) + if ((sys == "R")) { // GLONASS Epoch Time Rtcm::set_DF034(obs_time); @@ -3228,22 +3226,22 @@ std::vector > Rtcm::sort_by_signal(const std::v std::string sig_b_(b.second.Signal); std::string sig_b = sig_b_.substr(0, 2); - if (system_a.compare("G") == 0) + if (system_a == "G") { value_a = gps_signal_map.at(sig_a); } - if (system_a.compare("E") == 0) + if (system_a == "E") { value_a = galileo_signal_map.at(sig_a); } - if (system_b.compare("G") == 0) + if (system_b == "G") { value_b = gps_signal_map.at(sig_b); } - if (system_b.compare("E") == 0) + if (system_b == "E") { value_b = galileo_signal_map.at(sig_b); } @@ -3562,7 +3560,7 @@ int32_t Rtcm::set_DF003(uint32_t ref_station_ID) int32_t Rtcm::set_DF004(double obs_time) { // TOW in milliseconds from the beginning of the GPS week, measured in GPS time - uint64_t tow = static_cast(std::round(obs_time * 1000)); + auto tow = static_cast(std::round(obs_time * 1000)); if (tow > 604799999) { LOG(WARNING) << "To large TOW! Set to the last millisecond of the week"; @@ -3653,7 +3651,7 @@ int32_t Rtcm::set_DF010(bool code_indicator) int32_t Rtcm::set_DF011(const Gnss_Synchro& gnss_synchro) { double ambiguity = std::floor(gnss_synchro.Pseudorange_m / 299792.458); - uint64_t gps_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 299792.458) / 0.02)); + auto gps_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 299792.458) / 0.02)); DF011 = std::bitset<24>(gps_L1_pseudorange); return 0; } @@ -3667,7 +3665,7 @@ int32_t Rtcm::set_DF012(const Gnss_Synchro& gnss_synchro) double gps_L1_pseudorange_c = gps_L1_pseudorange * 0.02 + ambiguity * 299792.458; double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / GPS_TWO_PI; double L1_phaserange_c_r = std::fmod(L1_phaserange_c - gps_L1_pseudorange_c / lambda + 1500.0, 3000.0) - 1500.0; - int64_t gps_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); + auto gps_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); DF012 = std::bitset<20>(gps_L1_phaserange_minus_L1_pseudorange); return 0; } @@ -3685,7 +3683,7 @@ int32_t Rtcm::set_DF013(const Gps_Ephemeris& eph, double obs_time, const Gnss_Sy int32_t Rtcm::set_DF014(const Gnss_Synchro& gnss_synchro) { - uint32_t gps_L1_pseudorange_ambiguity = static_cast(std::floor(gnss_synchro.Pseudorange_m / 299792.458)); + auto gps_L1_pseudorange_ambiguity = static_cast(std::floor(gnss_synchro.Pseudorange_m / 299792.458)); DF014 = std::bitset<8>(gps_L1_pseudorange_ambiguity); return 0; } @@ -3698,7 +3696,7 @@ int32_t Rtcm::set_DF015(const Gnss_Synchro& gnss_synchro) { CN0_dB_Hz_est = 63.75; } - uint32_t CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); + auto CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); DF015 = std::bitset<8>(CN0_dB_Hz); return 0; } @@ -3758,7 +3756,7 @@ int32_t Rtcm::set_DF020(const Gnss_Synchro& gnss_synchro) { CN0_dB_Hz_est = 63.75; } - uint32_t CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); + auto CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); DF020 = std::bitset<8>(CN0_dB_Hz); return 0; } @@ -3794,7 +3792,7 @@ int32_t Rtcm::set_DF024(bool galileo_indicator) int32_t Rtcm::set_DF025(double antenna_ECEF_X_m) { - int64_t ant_ref_x = static_cast(std::round(antenna_ECEF_X_m * 10000)); + auto ant_ref_x = static_cast(std::round(antenna_ECEF_X_m * 10000)); DF025 = std::bitset<38>(ant_ref_x); return 0; } @@ -3802,7 +3800,7 @@ int32_t Rtcm::set_DF025(double antenna_ECEF_X_m) int32_t Rtcm::set_DF026(double antenna_ECEF_Y_m) { - int64_t ant_ref_y = static_cast(std::round(antenna_ECEF_Y_m * 10000)); + auto ant_ref_y = static_cast(std::round(antenna_ECEF_Y_m * 10000)); DF026 = std::bitset<38>(ant_ref_y); return 0; } @@ -3810,7 +3808,7 @@ int32_t Rtcm::set_DF026(double antenna_ECEF_Y_m) int32_t Rtcm::set_DF027(double antenna_ECEF_Z_m) { - int64_t ant_ref_z = static_cast(std::round(antenna_ECEF_Z_m * 10000)); + auto ant_ref_z = static_cast(std::round(antenna_ECEF_Z_m * 10000)); DF027 = std::bitset<38>(ant_ref_z); return 0; } @@ -3818,7 +3816,7 @@ int32_t Rtcm::set_DF027(double antenna_ECEF_Z_m) int32_t Rtcm::set_DF028(double height) { - uint32_t h_ = static_cast(std::round(height * 10000)); + auto h_ = static_cast(std::round(height * 10000)); DF028 = std::bitset<16>(h_); return 0; } @@ -3834,7 +3832,7 @@ int32_t Rtcm::set_DF031(uint32_t antenna_setup_id) int32_t Rtcm::set_DF034(double obs_time) { // TOW in milliseconds from the beginning of the GLONASS day, measured in GLONASS time - uint64_t tk = static_cast(std::round(obs_time * 1000)); + auto tk = static_cast(std::round(obs_time * 1000)); if (tk > 86400999) { LOG(WARNING) << "To large GLONASS Epoch Time (tk)! Set to the last millisecond of the day"; @@ -3945,7 +3943,7 @@ int32_t Rtcm::set_DF040(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF041(const Gnss_Synchro& gnss_synchro) { double ambiguity = std::floor(gnss_synchro.Pseudorange_m / 599584.92); - uint64_t glonass_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02)); + auto glonass_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02)); DF041 = std::bitset<25>(glonass_L1_pseudorange); return 0; } @@ -3959,7 +3957,7 @@ int32_t Rtcm::set_DF042(const Gnss_Synchro& gnss_synchro) double glonass_L1_pseudorange_c = glonass_L1_pseudorange * 0.02 + ambiguity * 299792.458; double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / GLONASS_TWO_PI; double L1_phaserange_c_r = std::fmod(L1_phaserange_c - glonass_L1_pseudorange_c / lambda + 1500.0, 3000.0) - 1500.0; - int64_t glonass_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); + auto glonass_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); DF042 = std::bitset<20>(glonass_L1_phaserange_minus_L1_pseudorange); return 0; } @@ -3977,7 +3975,7 @@ int32_t Rtcm::set_DF043(const Glonass_Gnav_Ephemeris& eph, double obs_time, cons int32_t Rtcm::set_DF044(const Gnss_Synchro& gnss_synchro) { - uint32_t glonass_L1_pseudorange_ambiguity = static_cast(std::floor(gnss_synchro.Pseudorange_m / 599584.916)); + auto glonass_L1_pseudorange_ambiguity = static_cast(std::floor(gnss_synchro.Pseudorange_m / 599584.916)); DF044 = std::bitset<7>(glonass_L1_pseudorange_ambiguity); return 0; } @@ -3991,7 +3989,7 @@ int32_t Rtcm::set_DF045(const Gnss_Synchro& gnss_synchro) LOG(WARNING) << "GLONASS L1 CNR must be between 0 and 63.75, but CNR " << CN0_dB_Hz_est << " was found. Setting to 63.75 dB-Hz"; CN0_dB_Hz_est = 63.75; } - uint32_t CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); + auto CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); DF045 = std::bitset<8>(CN0_dB_Hz); return 0; } @@ -4051,7 +4049,7 @@ int32_t Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro) { CN0_dB_Hz_est = 63.75; } - uint32_t CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); + auto CN0_dB_Hz = static_cast(std::round(CN0_dB_Hz_est / 0.25)); DF050 = std::bitset<8>(CN0_dB_Hz); return 0; } @@ -4089,7 +4087,7 @@ int32_t Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time) int32_t Rtcm::set_DF071(const Gps_Ephemeris& gps_eph) { - uint32_t iode = static_cast(gps_eph.d_IODE_SF2); + auto iode = static_cast(gps_eph.d_IODE_SF2); DF071 = std::bitset<8>(iode); return 0; } @@ -4097,7 +4095,7 @@ int32_t Rtcm::set_DF071(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF076(const Gps_Ephemeris& gps_eph) { - uint32_t week_number = static_cast(gps_eph.i_GPS_week); + auto week_number = static_cast(gps_eph.i_GPS_week); DF076 = std::bitset<10>(week_number); return 0; } @@ -4105,7 +4103,7 @@ int32_t Rtcm::set_DF076(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF077(const Gps_Ephemeris& gps_eph) { - uint16_t ura = static_cast(gps_eph.i_SV_accuracy); + auto ura = static_cast(gps_eph.i_SV_accuracy); DF077 = std::bitset<4>(ura); return 0; } @@ -4113,7 +4111,7 @@ int32_t Rtcm::set_DF077(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF078(const Gps_Ephemeris& gps_eph) { - uint16_t code_on_L2 = static_cast(gps_eph.i_code_on_L2); + auto code_on_L2 = static_cast(gps_eph.i_code_on_L2); DF078 = std::bitset<2>(code_on_L2); return 0; } @@ -4121,7 +4119,7 @@ int32_t Rtcm::set_DF078(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF079(const Gps_Ephemeris& gps_eph) { - uint32_t idot = static_cast(std::round(gps_eph.d_IDOT / I_DOT_LSB)); + auto idot = static_cast(std::round(gps_eph.d_IDOT / I_DOT_LSB)); DF079 = std::bitset<14>(idot); return 0; } @@ -4129,7 +4127,7 @@ int32_t Rtcm::set_DF079(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF080(const Gps_Ephemeris& gps_eph) { - uint16_t iode = static_cast(gps_eph.d_IODE_SF2); + auto iode = static_cast(gps_eph.d_IODE_SF2); DF080 = std::bitset<8>(iode); return 0; } @@ -4137,7 +4135,7 @@ int32_t Rtcm::set_DF080(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF081(const Gps_Ephemeris& gps_eph) { - uint32_t toc = static_cast(std::round(gps_eph.d_Toc / T_OC_LSB)); + auto toc = static_cast(std::round(gps_eph.d_Toc / T_OC_LSB)); DF081 = std::bitset<16>(toc); return 0; } @@ -4145,7 +4143,7 @@ int32_t Rtcm::set_DF081(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF082(const Gps_Ephemeris& gps_eph) { - int16_t af2 = static_cast(std::round(gps_eph.d_A_f2 / A_F2_LSB)); + auto af2 = static_cast(std::round(gps_eph.d_A_f2 / A_F2_LSB)); DF082 = std::bitset<8>(af2); return 0; } @@ -4153,7 +4151,7 @@ int32_t Rtcm::set_DF082(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF083(const Gps_Ephemeris& gps_eph) { - int32_t af1 = static_cast(std::round(gps_eph.d_A_f1 / A_F1_LSB)); + auto af1 = static_cast(std::round(gps_eph.d_A_f1 / A_F1_LSB)); DF083 = std::bitset<16>(af1); return 0; } @@ -4161,7 +4159,7 @@ int32_t Rtcm::set_DF083(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF084(const Gps_Ephemeris& gps_eph) { - int64_t af0 = static_cast(std::round(gps_eph.d_A_f0 / A_F0_LSB)); + auto af0 = static_cast(std::round(gps_eph.d_A_f0 / A_F0_LSB)); DF084 = std::bitset<22>(af0); return 0; } @@ -4169,7 +4167,7 @@ int32_t Rtcm::set_DF084(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF085(const Gps_Ephemeris& gps_eph) { - uint32_t iodc = static_cast(gps_eph.d_IODC); + auto iodc = static_cast(gps_eph.d_IODC); DF085 = std::bitset<10>(iodc); return 0; } @@ -4177,7 +4175,7 @@ int32_t Rtcm::set_DF085(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF086(const Gps_Ephemeris& gps_eph) { - int32_t crs = static_cast(std::round(gps_eph.d_Crs / C_RS_LSB)); + auto crs = static_cast(std::round(gps_eph.d_Crs / C_RS_LSB)); DF086 = std::bitset<16>(crs); return 0; } @@ -4185,7 +4183,7 @@ int32_t Rtcm::set_DF086(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF087(const Gps_Ephemeris& gps_eph) { - int32_t delta_n = static_cast(std::round(gps_eph.d_Delta_n / DELTA_N_LSB)); + auto delta_n = static_cast(std::round(gps_eph.d_Delta_n / DELTA_N_LSB)); DF087 = std::bitset<16>(delta_n); return 0; } @@ -4193,7 +4191,7 @@ int32_t Rtcm::set_DF087(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF088(const Gps_Ephemeris& gps_eph) { - int64_t m0 = static_cast(std::round(gps_eph.d_M_0 / M_0_LSB)); + auto m0 = static_cast(std::round(gps_eph.d_M_0 / M_0_LSB)); DF088 = std::bitset<32>(m0); return 0; } @@ -4201,14 +4199,14 @@ int32_t Rtcm::set_DF088(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF089(const Gps_Ephemeris& gps_eph) { - int32_t cuc = static_cast(std::round(gps_eph.d_Cuc / C_UC_LSB)); + auto cuc = static_cast(std::round(gps_eph.d_Cuc / C_UC_LSB)); DF089 = std::bitset<16>(cuc); return 0; } int32_t Rtcm::set_DF090(const Gps_Ephemeris& gps_eph) { - uint64_t ecc = static_cast(std::round(gps_eph.d_e_eccentricity / E_LSB)); + auto ecc = static_cast(std::round(gps_eph.d_e_eccentricity / E_LSB)); DF090 = std::bitset<32>(ecc); return 0; } @@ -4216,7 +4214,7 @@ int32_t Rtcm::set_DF090(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF091(const Gps_Ephemeris& gps_eph) { - int32_t cus = static_cast(std::round(gps_eph.d_Cus / C_US_LSB)); + auto cus = static_cast(std::round(gps_eph.d_Cus / C_US_LSB)); DF091 = std::bitset<16>(cus); return 0; } @@ -4224,7 +4222,7 @@ int32_t Rtcm::set_DF091(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF092(const Gps_Ephemeris& gps_eph) { - uint64_t sqr_a = static_cast(std::round(gps_eph.d_sqrt_A / SQRT_A_LSB)); + auto sqr_a = static_cast(std::round(gps_eph.d_sqrt_A / SQRT_A_LSB)); DF092 = std::bitset<32>(sqr_a); return 0; } @@ -4232,7 +4230,7 @@ int32_t Rtcm::set_DF092(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF093(const Gps_Ephemeris& gps_eph) { - uint32_t toe = static_cast(std::round(gps_eph.d_Toe / T_OE_LSB)); + auto toe = static_cast(std::round(gps_eph.d_Toe / T_OE_LSB)); DF093 = std::bitset<16>(toe); return 0; } @@ -4240,7 +4238,7 @@ int32_t Rtcm::set_DF093(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF094(const Gps_Ephemeris& gps_eph) { - int32_t cic = static_cast(std::round(gps_eph.d_Cic / C_IC_LSB)); + auto cic = static_cast(std::round(gps_eph.d_Cic / C_IC_LSB)); DF094 = std::bitset<16>(cic); return 0; } @@ -4248,7 +4246,7 @@ int32_t Rtcm::set_DF094(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF095(const Gps_Ephemeris& gps_eph) { - int64_t Omega0 = static_cast(std::round(gps_eph.d_OMEGA0 / OMEGA_0_LSB)); + auto Omega0 = static_cast(std::round(gps_eph.d_OMEGA0 / OMEGA_0_LSB)); DF095 = std::bitset<32>(Omega0); return 0; } @@ -4256,7 +4254,7 @@ int32_t Rtcm::set_DF095(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF096(const Gps_Ephemeris& gps_eph) { - int32_t cis = static_cast(std::round(gps_eph.d_Cis / C_IS_LSB)); + auto cis = static_cast(std::round(gps_eph.d_Cis / C_IS_LSB)); DF096 = std::bitset<16>(cis); return 0; } @@ -4264,7 +4262,7 @@ int32_t Rtcm::set_DF096(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF097(const Gps_Ephemeris& gps_eph) { - int64_t i0 = static_cast(std::round(gps_eph.d_i_0 / I_0_LSB)); + auto i0 = static_cast(std::round(gps_eph.d_i_0 / I_0_LSB)); DF097 = std::bitset<32>(i0); return 0; } @@ -4272,7 +4270,7 @@ int32_t Rtcm::set_DF097(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF098(const Gps_Ephemeris& gps_eph) { - int32_t crc = static_cast(std::round(gps_eph.d_Crc / C_RC_LSB)); + auto crc = static_cast(std::round(gps_eph.d_Crc / C_RC_LSB)); DF098 = std::bitset<16>(crc); return 0; } @@ -4280,7 +4278,7 @@ int32_t Rtcm::set_DF098(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF099(const Gps_Ephemeris& gps_eph) { - int64_t omega = static_cast(std::round(gps_eph.d_OMEGA / OMEGA_LSB)); + auto omega = static_cast(std::round(gps_eph.d_OMEGA / OMEGA_LSB)); DF099 = std::bitset<32>(omega); return 0; } @@ -4288,7 +4286,7 @@ int32_t Rtcm::set_DF099(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF100(const Gps_Ephemeris& gps_eph) { - int64_t omegadot = static_cast(std::round(gps_eph.d_OMEGA_DOT / OMEGA_DOT_LSB)); + auto omegadot = static_cast(std::round(gps_eph.d_OMEGA_DOT / OMEGA_DOT_LSB)); DF100 = std::bitset<24>(omegadot); return 0; } @@ -4296,7 +4294,7 @@ int32_t Rtcm::set_DF100(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF101(const Gps_Ephemeris& gps_eph) { - int16_t tgd = static_cast(std::round(gps_eph.d_TGD / T_GD_LSB)); + auto tgd = static_cast(std::round(gps_eph.d_TGD / T_GD_LSB)); DF101 = std::bitset<8>(tgd); return 0; } @@ -4304,7 +4302,7 @@ int32_t Rtcm::set_DF101(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF102(const Gps_Ephemeris& gps_eph) { - uint16_t sv_heath = static_cast(gps_eph.i_SV_health); + auto sv_heath = static_cast(gps_eph.i_SV_health); DF102 = std::bitset<6>(sv_heath); return 0; } @@ -4334,7 +4332,7 @@ int32_t Rtcm::set_DF105(uint32_t glonass_gnav_alm_health_ind) int32_t Rtcm::set_DF106(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { // Convert the value from (15, 30, 45, 60) to (00, 01, 10, 11) - uint32_t P_1 = static_cast(std::round(glonass_gnav_eph.d_P_1 / 15.0 - 1.0)); + auto P_1 = static_cast(std::round(glonass_gnav_eph.d_P_1 / 15.0 - 1.0)); DF106 = std::bitset<2>(P_1); return 0; } @@ -4378,7 +4376,7 @@ int32_t Rtcm::set_DF109(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF110(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - uint32_t t_b = static_cast(std::round(glonass_gnav_eph.d_t_b / (15 * 60))); + auto t_b = static_cast(std::round(glonass_gnav_eph.d_t_b / (15 * 60))); DF110 = std::bitset<7>(t_b); return 0; } @@ -4386,7 +4384,7 @@ int32_t Rtcm::set_DF110(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF111(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t VXn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_VXn / TWO_N20))); + auto VXn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_VXn / TWO_N20))); uint32_t VXn_sgn = glo_sgn(glonass_gnav_eph.d_VXn); DF111 = std::bitset<24>(VXn_mag); @@ -4397,7 +4395,7 @@ int32_t Rtcm::set_DF111(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF112(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t Xn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Xn / TWO_N11))); + auto Xn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Xn / TWO_N11))); uint32_t Xn_sgn = glo_sgn(glonass_gnav_eph.d_Xn); DF112 = std::bitset<27>(Xn_mag); @@ -4408,7 +4406,7 @@ int32_t Rtcm::set_DF112(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF113(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t AXn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_AXn / TWO_N30))); + auto AXn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_AXn / TWO_N30))); uint32_t AXn_sgn = glo_sgn(glonass_gnav_eph.d_AXn); DF113 = std::bitset<5>(AXn_mag); @@ -4419,7 +4417,7 @@ int32_t Rtcm::set_DF113(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF114(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t VYn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_VYn / TWO_N20))); + auto VYn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_VYn / TWO_N20))); uint32_t VYn_sgn = glo_sgn(glonass_gnav_eph.d_VYn); DF114 = std::bitset<24>(VYn_mag); @@ -4430,7 +4428,7 @@ int32_t Rtcm::set_DF114(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF115(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t Yn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Yn / TWO_N11))); + auto Yn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Yn / TWO_N11))); uint32_t Yn_sgn = glo_sgn(glonass_gnav_eph.d_Yn); DF115 = std::bitset<27>(Yn_mag); @@ -4441,7 +4439,7 @@ int32_t Rtcm::set_DF115(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF116(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t AYn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_AYn / TWO_N30))); + auto AYn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_AYn / TWO_N30))); uint32_t AYn_sgn = glo_sgn(glonass_gnav_eph.d_AYn); DF116 = std::bitset<5>(AYn_mag); @@ -4452,7 +4450,7 @@ int32_t Rtcm::set_DF116(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF117(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t VZn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_VZn / TWO_N20))); + auto VZn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_VZn / TWO_N20))); uint32_t VZn_sgn = glo_sgn(glonass_gnav_eph.d_VZn); DF117 = std::bitset<24>(VZn_mag); @@ -4463,7 +4461,7 @@ int32_t Rtcm::set_DF117(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF118(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t Zn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Zn / TWO_N11))); + auto Zn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Zn / TWO_N11))); uint32_t Zn_sgn = glo_sgn(glonass_gnav_eph.d_Zn); DF118 = std::bitset<27>(Zn_mag); @@ -4474,7 +4472,7 @@ int32_t Rtcm::set_DF118(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF119(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t AZn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_AZn / TWO_N30))); + auto AZn_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_AZn / TWO_N30))); uint32_t AZn_sgn = glo_sgn(glonass_gnav_eph.d_AZn); DF119 = std::bitset<5>(AZn_mag); @@ -4493,7 +4491,7 @@ int32_t Rtcm::set_DF120(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF121(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t gamma_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_gamma_n / TWO_N40))); + auto gamma_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_gamma_n / TWO_N40))); uint32_t gamma_sgn = glo_sgn(glonass_gnav_eph.d_gamma_n); DF121 = std::bitset<11>(gamma_mag); @@ -4504,7 +4502,7 @@ int32_t Rtcm::set_DF121(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF122(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - uint32_t P = static_cast(std::round(glonass_gnav_eph.d_P)); + auto P = static_cast(std::round(glonass_gnav_eph.d_P)); DF122 = std::bitset<2>(P); return 0; } @@ -4512,7 +4510,7 @@ int32_t Rtcm::set_DF122(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF123(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - uint32_t ln = static_cast((glonass_gnav_eph.d_l3rd_n)); + auto ln = static_cast((glonass_gnav_eph.d_l3rd_n)); DF123 = std::bitset<1>(ln); return 0; } @@ -4520,7 +4518,7 @@ int32_t Rtcm::set_DF123(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF124(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t tau_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_tau_n / TWO_N30))); + auto tau_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_tau_n / TWO_N30))); uint32_t tau_sgn = glo_sgn(glonass_gnav_eph.d_tau_n); DF124 = std::bitset<22>(tau_mag); @@ -4531,7 +4529,7 @@ int32_t Rtcm::set_DF124(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF125(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - int32_t delta_tau_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Delta_tau_n / TWO_N30))); + auto delta_tau_mag = static_cast(std::round(fabs(glonass_gnav_eph.d_Delta_tau_n / TWO_N30))); uint32_t delta_tau_sgn = glo_sgn(glonass_gnav_eph.d_Delta_tau_n); DF125 = std::bitset<5>(delta_tau_mag); @@ -4542,7 +4540,7 @@ int32_t Rtcm::set_DF125(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF126(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - uint32_t ecc = static_cast(std::round(glonass_gnav_eph.d_E_n)); + auto ecc = static_cast(std::round(glonass_gnav_eph.d_E_n)); DF126 = std::bitset<5>(ecc); return 0; } @@ -4558,7 +4556,7 @@ int32_t Rtcm::set_DF127(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF128(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - uint32_t F_t = static_cast(std::round(glonass_gnav_eph.d_F_T)); + auto F_t = static_cast(std::round(glonass_gnav_eph.d_F_T)); DF128 = std::bitset<4>(F_t); return 0; } @@ -4566,7 +4564,7 @@ int32_t Rtcm::set_DF128(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF129(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - uint32_t N_t = static_cast(std::round(glonass_gnav_eph.d_N_T)); + auto N_t = static_cast(std::round(glonass_gnav_eph.d_N_T)); DF129 = std::bitset<11>(N_t); return 0; } @@ -4574,7 +4572,7 @@ int32_t Rtcm::set_DF129(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF130(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) { - uint32_t M = static_cast(std::round(glonass_gnav_eph.d_M)); + auto M = static_cast(std::round(glonass_gnav_eph.d_M)); DF130 = std::bitset<2>(M); return 0; } @@ -4582,7 +4580,7 @@ int32_t Rtcm::set_DF130(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF131(uint32_t fifth_str_additional_data_ind) { - uint32_t fith_str_data = static_cast(fifth_str_additional_data_ind); + auto fith_str_data = static_cast(fifth_str_additional_data_ind); DF131 = std::bitset<1>(fith_str_data); return 0; } @@ -4590,7 +4588,7 @@ int32_t Rtcm::set_DF131(uint32_t fifth_str_additional_data_ind) int32_t Rtcm::set_DF132(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) { - uint32_t N_A = static_cast(std::round(glonass_gnav_utc_model.d_N_A)); + auto N_A = static_cast(std::round(glonass_gnav_utc_model.d_N_A)); DF132 = std::bitset<11>(N_A); return 0; } @@ -4598,7 +4596,7 @@ int32_t Rtcm::set_DF132(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) int32_t Rtcm::set_DF133(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) { - int32_t tau_c = static_cast(std::round(glonass_gnav_utc_model.d_tau_c / TWO_N31)); + auto tau_c = static_cast(std::round(glonass_gnav_utc_model.d_tau_c / TWO_N31)); DF133 = std::bitset<32>(tau_c); return 0; } @@ -4606,7 +4604,7 @@ int32_t Rtcm::set_DF133(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) int32_t Rtcm::set_DF134(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) { - uint32_t N_4 = static_cast(std::round(glonass_gnav_utc_model.d_N_4)); + auto N_4 = static_cast(std::round(glonass_gnav_utc_model.d_N_4)); DF134 = std::bitset<5>(N_4); return 0; } @@ -4614,7 +4612,7 @@ int32_t Rtcm::set_DF134(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) int32_t Rtcm::set_DF135(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) { - int32_t tau_gps = static_cast(std::round(glonass_gnav_utc_model.d_tau_gps) / TWO_N30); + auto tau_gps = static_cast(std::round(glonass_gnav_utc_model.d_tau_gps) / TWO_N30); DF135 = std::bitset<22>(tau_gps); return 0; } @@ -4638,7 +4636,7 @@ int32_t Rtcm::set_DF137(const Gps_Ephemeris& gps_eph) int32_t Rtcm::set_DF248(double obs_time) { // TOW in milliseconds from the beginning of the Galileo week, measured in Galileo time - uint64_t tow = static_cast(std::round(obs_time * 1000)); + auto tow = static_cast(std::round(obs_time * 1000)); if (tow > 604799999) { LOG(WARNING) << "To large TOW! Set to the last millisecond of the week"; @@ -4663,7 +4661,7 @@ int32_t Rtcm::set_DF252(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF289(const Galileo_Ephemeris& gal_eph) { - uint32_t galileo_week_number = static_cast(gal_eph.WN_5); + auto galileo_week_number = static_cast(gal_eph.WN_5); if (galileo_week_number > 4095) { LOG(WARNING) << "Error decoding Galileo week number (it has a 4096 roll-off, but " << galileo_week_number << " was detected)"; @@ -4675,7 +4673,7 @@ int32_t Rtcm::set_DF289(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF290(const Galileo_Ephemeris& gal_eph) { - uint32_t iod_nav = static_cast(gal_eph.IOD_nav_1); + auto iod_nav = static_cast(gal_eph.IOD_nav_1); if (iod_nav > 1023) { LOG(WARNING) << "Error decoding Galileo IODnav (it has a max of 1023, but " << iod_nav << " was detected)"; @@ -4687,7 +4685,7 @@ int32_t Rtcm::set_DF290(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF291(const Galileo_Ephemeris& gal_eph) { - uint16_t SISA = static_cast(gal_eph.SISA_3); + auto SISA = static_cast(gal_eph.SISA_3); //SISA = 0; // SIS Accuracy, data content definition not given in Galileo OS SIS ICD, Issue 1.1, Sept 2010 DF291 = std::bitset<8>(SISA); return 0; @@ -4696,7 +4694,7 @@ int32_t Rtcm::set_DF291(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF292(const Galileo_Ephemeris& gal_eph) { - int32_t idot = static_cast(std::round(gal_eph.iDot_2 / FNAV_idot_2_LSB)); + auto idot = static_cast(std::round(gal_eph.iDot_2 / FNAV_idot_2_LSB)); DF292 = std::bitset<14>(idot); return 0; } @@ -4704,7 +4702,7 @@ int32_t Rtcm::set_DF292(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF293(const Galileo_Ephemeris& gal_eph) { - uint32_t toc = static_cast(gal_eph.t0c_4); + auto toc = static_cast(gal_eph.t0c_4); if (toc > 604740) { LOG(WARNING) << "Error decoding Galileo ephemeris time (max of 604740, but " << toc << " was detected)"; @@ -4716,7 +4714,7 @@ int32_t Rtcm::set_DF293(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF294(const Galileo_Ephemeris& gal_eph) { - int16_t af2 = static_cast(std::round(gal_eph.af2_4 / FNAV_af2_1_LSB)); + auto af2 = static_cast(std::round(gal_eph.af2_4 / FNAV_af2_1_LSB)); DF294 = std::bitset<6>(af2); return 0; } @@ -4724,7 +4722,7 @@ int32_t Rtcm::set_DF294(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF295(const Galileo_Ephemeris& gal_eph) { - int64_t af1 = static_cast(std::round(gal_eph.af1_4 / FNAV_af1_1_LSB)); + auto af1 = static_cast(std::round(gal_eph.af1_4 / FNAV_af1_1_LSB)); DF295 = std::bitset<21>(af1); return 0; } @@ -4740,7 +4738,7 @@ int32_t Rtcm::set_DF296(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF297(const Galileo_Ephemeris& gal_eph) { - int32_t crs = static_cast(std::round(gal_eph.C_rs_3 / FNAV_Crs_3_LSB)); + auto crs = static_cast(std::round(gal_eph.C_rs_3 / FNAV_Crs_3_LSB)); DF297 = std::bitset<16>(crs); return 0; } @@ -4748,7 +4746,7 @@ int32_t Rtcm::set_DF297(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF298(const Galileo_Ephemeris& gal_eph) { - int32_t delta_n = static_cast(std::round(gal_eph.delta_n_3 / FNAV_deltan_3_LSB)); + auto delta_n = static_cast(std::round(gal_eph.delta_n_3 / FNAV_deltan_3_LSB)); DF298 = std::bitset<16>(delta_n); return 0; } @@ -4756,7 +4754,7 @@ int32_t Rtcm::set_DF298(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF299(const Galileo_Ephemeris& gal_eph) { - int64_t m0 = static_cast(std::round(gal_eph.M0_1 / FNAV_M0_2_LSB)); + auto m0 = static_cast(std::round(gal_eph.M0_1 / FNAV_M0_2_LSB)); DF299 = std::bitset<32>(m0); return 0; } @@ -4772,7 +4770,7 @@ int32_t Rtcm::set_DF300(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF301(const Galileo_Ephemeris& gal_eph) { - uint64_t ecc = static_cast(std::round(gal_eph.e_1 / FNAV_e_2_LSB)); + auto ecc = static_cast(std::round(gal_eph.e_1 / FNAV_e_2_LSB)); DF301 = std::bitset<32>(ecc); return 0; } @@ -4780,7 +4778,7 @@ int32_t Rtcm::set_DF301(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF302(const Galileo_Ephemeris& gal_eph) { - int32_t cus = static_cast(std::round(gal_eph.C_us_3 / FNAV_Cus_3_LSB)); + auto cus = static_cast(std::round(gal_eph.C_us_3 / FNAV_Cus_3_LSB)); DF302 = std::bitset<16>(cus); return 0; } @@ -4788,7 +4786,7 @@ int32_t Rtcm::set_DF302(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF303(const Galileo_Ephemeris& gal_eph) { - uint64_t sqr_a = static_cast(std::round(gal_eph.A_1 / FNAV_a12_2_LSB)); + auto sqr_a = static_cast(std::round(gal_eph.A_1 / FNAV_a12_2_LSB)); DF303 = std::bitset<32>(sqr_a); return 0; } @@ -4796,7 +4794,7 @@ int32_t Rtcm::set_DF303(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF304(const Galileo_Ephemeris& gal_eph) { - uint32_t toe = static_cast(std::round(gal_eph.t0e_1 / FNAV_t0e_3_LSB)); + auto toe = static_cast(std::round(gal_eph.t0e_1 / FNAV_t0e_3_LSB)); DF304 = std::bitset<14>(toe); return 0; } @@ -4804,7 +4802,7 @@ int32_t Rtcm::set_DF304(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF305(const Galileo_Ephemeris& gal_eph) { - int32_t cic = static_cast(std::round(gal_eph.C_ic_4 / FNAV_Cic_4_LSB)); + auto cic = static_cast(std::round(gal_eph.C_ic_4 / FNAV_Cic_4_LSB)); DF305 = std::bitset<16>(cic); return 0; } @@ -4812,7 +4810,7 @@ int32_t Rtcm::set_DF305(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF306(const Galileo_Ephemeris& gal_eph) { - int64_t Omega0 = static_cast(std::round(gal_eph.OMEGA_0_2 / FNAV_omega0_2_LSB)); + auto Omega0 = static_cast(std::round(gal_eph.OMEGA_0_2 / FNAV_omega0_2_LSB)); DF306 = std::bitset<32>(Omega0); return 0; } @@ -4820,7 +4818,7 @@ int32_t Rtcm::set_DF306(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF307(const Galileo_Ephemeris& gal_eph) { - int32_t cis = static_cast(std::round(gal_eph.C_is_4 / FNAV_Cis_4_LSB)); + auto cis = static_cast(std::round(gal_eph.C_is_4 / FNAV_Cis_4_LSB)); DF307 = std::bitset<16>(cis); return 0; } @@ -4828,7 +4826,7 @@ int32_t Rtcm::set_DF307(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF308(const Galileo_Ephemeris& gal_eph) { - int64_t i0 = static_cast(std::round(gal_eph.i_0_2 / FNAV_i0_3_LSB)); + auto i0 = static_cast(std::round(gal_eph.i_0_2 / FNAV_i0_3_LSB)); DF308 = std::bitset<32>(i0); return 0; } @@ -4844,7 +4842,7 @@ int32_t Rtcm::set_DF309(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF310(const Galileo_Ephemeris& gal_eph) { - int32_t omega = static_cast(std::round(gal_eph.omega_2 / FNAV_omega0_2_LSB)); + auto omega = static_cast(std::round(gal_eph.omega_2 / FNAV_omega0_2_LSB)); DF310 = std::bitset<32>(omega); return 0; } @@ -4852,7 +4850,7 @@ int32_t Rtcm::set_DF310(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF311(const Galileo_Ephemeris& gal_eph) { - int64_t Omegadot = static_cast(std::round(gal_eph.OMEGA_dot_3 / FNAV_omegadot_2_LSB)); + auto Omegadot = static_cast(std::round(gal_eph.OMEGA_dot_3 / FNAV_omegadot_2_LSB)); DF311 = std::bitset<24>(Omegadot); return 0; } @@ -4860,7 +4858,7 @@ int32_t Rtcm::set_DF311(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF312(const Galileo_Ephemeris& gal_eph) { - int32_t bdg_E1_E5a = static_cast(std::round(gal_eph.BGD_E1E5a_5 / FNAV_BGD_1_LSB)); + auto bdg_E1_E5a = static_cast(std::round(gal_eph.BGD_E1E5a_5 / FNAV_BGD_1_LSB)); DF312 = std::bitset<10>(bdg_E1_E5a); return 0; } @@ -4868,7 +4866,7 @@ int32_t Rtcm::set_DF312(const Galileo_Ephemeris& gal_eph) int32_t Rtcm::set_DF313(const Galileo_Ephemeris& gal_eph) { - uint32_t bdg_E5b_E1 = static_cast(std::round(gal_eph.BGD_E1E5b_5)); + auto bdg_E5b_E1 = static_cast(std::round(gal_eph.BGD_E1E5b_5)); //bdg_E5b_E1 = 0; //reserved DF313 = std::bitset<10>(bdg_E5b_E1); return 0; @@ -5166,23 +5164,23 @@ int32_t Rtcm::set_DF399(const Gnss_Synchro& gnss_synchro) std::string sig_(gnss_synchro.Signal); std::string sig = sig_.substr(0, 2); - if (sig.compare("1C") == 0) + if (sig == "1C") { lambda = GPS_C_m_s / GPS_L1_FREQ_HZ; } - if (sig.compare("2S") == 0) + if (sig == "2S") { lambda = GPS_C_m_s / GPS_L2_FREQ_HZ; } - if (sig.compare("5X") == 0) + if (sig == "5X") { lambda = GPS_C_m_s / Galileo_E5a_FREQ_HZ; } - if (sig.compare("1B") == 0) + if (sig == "1B") { lambda = GPS_C_m_s / Galileo_E1_FREQ_HZ; } - if (sig.compare("7X") == 0) + if (sig == "7X") { lambda = GPS_C_m_s / 1.207140e9; // Galileo_E1b_FREQ_HZ; } @@ -5235,31 +5233,31 @@ int32_t Rtcm::set_DF401(const Gnss_Synchro& gnss_synchro) std::string sig = sig_.substr(0, 2); std::string sys(&gnss_synchro.System, 1); - if ((sig.compare("1C") == 0) && (sys.compare("G") == 0)) + if ((sig == "1C") && (sys == "G")) { lambda = GPS_C_m_s / GPS_L1_FREQ_HZ; } - if ((sig.compare("2S")) == 0 && (sys.compare("G") == 0)) + if ((sig.compare("2S")) == 0 && (sys == "G")) { lambda = GPS_C_m_s / GPS_L2_FREQ_HZ; } - if ((sig.compare("5X")) == 0 && (sys.compare("E") == 0)) + if ((sig.compare("5X")) == 0 && (sys == "E")) { lambda = GPS_C_m_s / Galileo_E5a_FREQ_HZ; } - if ((sig.compare("1B")) == 0 && (sys.compare("E") == 0)) + if ((sig.compare("1B")) == 0 && (sys == "E")) { lambda = GPS_C_m_s / Galileo_E1_FREQ_HZ; } - if ((sig.compare("7X")) == 0 && (sys.compare("E") == 0)) + if ((sig.compare("7X")) == 0 && (sys == "E")) { lambda = GPS_C_m_s / 1.207140e9; // Galileo_E1b_FREQ_HZ; } - if ((sig.compare("1C") == 0) && (sys.compare("R") == 0)) + if ((sig == "1C") && (sys == "R")) { lambda = GLONASS_C_m_s / ((GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)))); } - if ((sig.compare("2C") == 0) && (sys.compare("R") == 0)) + if ((sig == "2C") && (sys == "R")) { // TODO Need to add slot number and freq number to gnss_syncro lambda = GLONASS_C_m_s / (GLONASS_L2_CA_FREQ_HZ); diff --git a/src/core/system_parameters/rtcm.h b/src/core/system_parameters/rtcm.h index d8cb53180..6194bc6ff 100644 --- a/src/core/system_parameters/rtcm.h +++ b/src/core/system_parameters/rtcm.h @@ -854,7 +854,7 @@ private: std::string message; Rtcm_Message msg; queue_->wait_and_pop(message); //message += '\n'; - if (message.compare("Goodbye") == 0) break; + if (message == "Goodbye") break; const char* char_msg = message.c_str(); msg.body_length(message.length()); std::memcpy(msg.body(), char_msg, msg.body_length()); diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index ad324bc47..111e71613 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -1011,11 +1011,9 @@ bool Gnuplot::set_GNUPlotPath(const std::string &path) Gnuplot::m_sGNUPlotPath = path; return true; } - else - { - Gnuplot::m_sGNUPlotPath.clear(); - return false; - } + + Gnuplot::m_sGNUPlotPath.clear(); + return false; } @@ -1068,8 +1066,8 @@ void stringtok(Container &container, container.push_back(in.substr(i)); return; } - else - container.push_back(in.substr(i, j - i)); + + container.push_back(in.substr(i, j - i)); // set up for next loop i = j + 1; @@ -1876,7 +1874,7 @@ Gnuplot &Gnuplot::cmd(const std::string &cmdstr) { return *this; } - else if (cmdstr.find("splot") != std::string::npos) + if (cmdstr.find("splot") != std::string::npos) { two_dim = false; nplots++; @@ -2052,10 +2050,7 @@ bool Gnuplot::file_exists(const std::string &filename, int mode) { return true; } - else - { - return false; - } + return false; } @@ -2158,8 +2153,8 @@ void Gnuplot::remove_tmpfiles() { if ((tmpfile_list).size() > 0) { - for (unsigned int i = 0; i < tmpfile_list.size(); i++) - if (remove(tmpfile_list[i].c_str()) != 0) + for (auto & i : tmpfile_list) + if (remove(i.c_str()) != 0) std::cout << "Problem closing files" << std::endl; Gnuplot::tmpfile_num -= tmpfile_list.size(); diff --git a/src/tests/system-tests/libs/rtklib_solver_dump_reader.cc b/src/tests/system-tests/libs/rtklib_solver_dump_reader.cc index b32f12bc5..a2c25debc 100644 --- a/src/tests/system-tests/libs/rtklib_solver_dump_reader.cc +++ b/src/tests/system-tests/libs/rtklib_solver_dump_reader.cc @@ -30,6 +30,7 @@ #include "rtklib_solver_dump_reader.h" #include +#include bool rtklib_solver_dump_reader::read_binary_obs() { @@ -80,10 +81,7 @@ bool rtklib_solver_dump_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -98,10 +96,7 @@ int64_t rtklib_solver_dump_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } @@ -111,7 +106,7 @@ bool rtklib_solver_dump_reader::open_obs_file(std::string out_file) { try { - d_dump_filename = out_file; + d_dump_filename = std::move(out_file); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); return true; diff --git a/src/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc b/src/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc index 15cd3335d..1082fb233 100644 --- a/src/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc +++ b/src/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc @@ -31,6 +31,7 @@ #include "spirent_motion_csv_dump_reader.h" #include #include +#include spirent_motion_csv_dump_reader::spirent_motion_csv_dump_reader() @@ -185,10 +186,7 @@ bool spirent_motion_csv_dump_reader::restart() } return true; } - else - { - return false; - } + return false; } @@ -205,10 +203,7 @@ int64_t spirent_motion_csv_dump_reader::num_epochs() } return nepoch - header_lines; } - else - { - return 0; - } + return 0; } @@ -218,7 +213,7 @@ bool spirent_motion_csv_dump_reader::open_obs_file(std::string out_file) { try { - d_dump_filename = out_file; + d_dump_filename = std::move(out_file); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str()); std::string line; diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index f030130e1..e5efd2150 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -87,7 +87,7 @@ private: std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - void print_results(arma::mat R_eb_enu); + void print_results(const arma::mat& R_eb_enu); std::shared_ptr config; std::shared_ptr config_f; std::string generated_kml_file; @@ -782,7 +782,7 @@ void PositionSystemTest::check_results() } -void PositionSystemTest::print_results(arma::mat R_eb_enu) +void PositionSystemTest::print_results(const arma::mat& R_eb_enu) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); if (gnuplot_executable.empty()) diff --git a/src/tests/unit-tests/arithmetic/matio_test.cc b/src/tests/unit-tests/arithmetic/matio_test.cc index e75f3118e..d8a51f46b 100644 --- a/src/tests/unit-tests/arithmetic/matio_test.cc +++ b/src/tests/unit-tests/arithmetic/matio_test.cc @@ -65,7 +65,7 @@ TEST(MatioTest, WriteAndReadDoubles) ASSERT_FALSE(reinterpret_cast(matvar_read) == nullptr) << "Error reading variable in .mat file"; matvar_read = Mat_VarRead(matfp_read, "x"); - double *x_read = reinterpret_cast(matvar_read->data); + auto *x_read = reinterpret_cast(matvar_read->data); Mat_Close(matfp_read); for (int i = 0; i < 10; i++) @@ -91,10 +91,10 @@ TEST(MatioTest, WriteAndReadGrComplex) float x_real[size]; float x_imag[size]; unsigned int i = 0; - for (std::vector::const_iterator it = x_v.cbegin(); it != x_v.cend(); it++) + for (auto it : x_v) { - x_real[i] = it->real(); - x_imag[i] = it->imag(); + x_real[i] = it.real(); + x_imag[i] = it.imag(); i++; } @@ -108,10 +108,10 @@ TEST(MatioTest, WriteAndReadGrComplex) float y_real[size_y]; float y_imag[size_y]; i = 0; - for (std::vector::const_iterator it = x2.cbegin(); it != x2.cend(); it++) + for (auto it : x2) { - y_real[i] = it->real(); - y_imag[i] = it->imag(); + y_real[i] = it.real(); + y_imag[i] = it.imag(); i++; } @@ -139,9 +139,9 @@ TEST(MatioTest, WriteAndReadGrComplex) ASSERT_FALSE(reinterpret_cast(matvar_read) == nullptr) << "Error reading variable in .mat file"; matvar_read = Mat_VarRead(matfp_read, "x"); - mat_complex_split_t *x_read_st = reinterpret_cast(matvar_read->data); - float *x_read_real = reinterpret_cast(x_read_st->Re); - float *x_read_imag = reinterpret_cast(x_read_st->Im); + auto *x_read_st = reinterpret_cast(matvar_read->data); + auto *x_read_real = reinterpret_cast(x_read_st->Re); + auto *x_read_imag = reinterpret_cast(x_read_st->Im); std::vector x_v_read; for (unsigned int i = 0; i < size; i++) { diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 5d2c18514..624e02bd5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -88,7 +89,7 @@ void GpsL1CaPcpsAcquisitionTest_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) @@ -173,9 +174,9 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() { //load the measured values std::string basename = "./tmp-acq-gps1/acquisition_G_1C"; - unsigned int sat = static_cast(gnss_synchro.PRN); + auto sat = static_cast(gnss_synchro.PRN); - unsigned int samples_per_code = static_cast(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !! + auto samples_per_code = static_cast(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !! acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1); if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl; @@ -198,7 +199,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() { 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("lines"); @@ -345,7 +346,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); - float delay_error_chips = static_cast(delay_error_samples * 1023 / 4000); + auto delay_error_chips = static_cast(delay_error_samples * 1023 / 4000); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; diff --git a/src/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc b/src/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc index e5168f4ed..bfd403b46 100644 --- a/src/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc @@ -92,9 +92,8 @@ int DataTypeAdapter::run_ishort_to_cshort_block() EXPECT_EQ(expected_implementation, ishort_to_cshort->implementation()); std::ofstream ofs(file_name_input.c_str(), std::ofstream::binary); - for (std::vector::const_iterator i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i) + for (short aux : input_data_shorts) { - short aux = *i; ofs.write(reinterpret_cast(&aux), sizeof(short)); } ofs.close(); @@ -121,9 +120,8 @@ int DataTypeAdapter::run_ishort_to_complex_block() EXPECT_EQ(expected_implementation, ishort_to_complex->implementation()); std::ofstream ofs(file_name_input.c_str(), std::ofstream::binary); - for (std::vector::const_iterator i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i) + for (short aux : input_data_shorts) { - short aux = *i; ofs.write(reinterpret_cast(&aux), sizeof(short)); } ofs.close(); @@ -150,9 +148,9 @@ int DataTypeAdapter::run_ibyte_to_cshort_block() EXPECT_EQ(expected_implementation, ibyte_to_cshort->implementation()); std::ofstream ofs(file_name_input.c_str()); - for (std::vector::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i) + for (signed char input_data_byte : input_data_bytes) { - ofs << *i; + ofs << input_data_byte; } ofs.close(); @@ -178,9 +176,9 @@ int DataTypeAdapter::run_ibyte_to_complex_block() EXPECT_EQ(expected_implementation, ibyte_to_complex->implementation()); std::ofstream ofs(file_name_input.c_str()); - for (std::vector::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i) + for (signed char input_data_byte : input_data_bytes) { - ofs << *i; + ofs << input_data_byte; } ofs.close(); @@ -206,9 +204,9 @@ int DataTypeAdapter::run_ibyte_to_cbyte_block() EXPECT_EQ(expected_implementation, ibyte_to_cbyte->implementation()); std::ofstream ofs(file_name_input.c_str()); - for (std::vector::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i) + for (signed char input_data_byte : input_data_bytes) { - ofs << *i; + ofs << input_data_byte; } ofs.close(); @@ -234,9 +232,9 @@ int DataTypeAdapter::run_byte_to_short_block() EXPECT_EQ(expected_implementation, byte_to_short->implementation()); std::ofstream ofs(file_name_input.c_str()); - for (std::vector::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i) + for (signed char input_data_byte : input_data_bytes) { - ofs << *i; + ofs << input_data_byte; } ofs.close(); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc index a21271d79..f401b1bc9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc @@ -119,7 +119,7 @@ bool acquisition_dump_reader::read_binary_acq() std::vector >::iterator it1; std::vector::iterator it2; - float* aux = static_cast(var_->data); + auto* aux = static_cast(var_->data); int k = 0; float normalization_factor = std::pow(d_samples_per_code, 4) * input_power; for (it1 = mag.begin(); it1 != mag.end(); it1++) diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc index c15db4f01..dc5a7a40b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc @@ -33,6 +33,7 @@ #include "acquisition_msg_rx.h" #include #include +#include #include #include @@ -47,7 +48,7 @@ void Acquisition_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; top_block->stop(); // stop the flowgraph } 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 08f891810..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 @@ -30,6 +30,7 @@ #include "observables_dump_reader.h" #include +#include bool observables_dump_reader::read_binary_obs() { @@ -62,10 +63,7 @@ bool observables_dump_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -81,10 +79,7 @@ int64_t observables_dump_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } @@ -94,7 +89,7 @@ bool observables_dump_reader::open_obs_file(std::string out_file) { try { - d_dump_filename = out_file; + d_dump_filename = std::move(out_file); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); return true; 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 64508e56e..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 @@ -30,6 +30,7 @@ #include "tlm_dump_reader.h" #include +#include bool tlm_dump_reader::read_binary_obs() { @@ -55,10 +56,7 @@ bool tlm_dump_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -74,10 +72,7 @@ int64_t tlm_dump_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } @@ -87,7 +82,7 @@ bool tlm_dump_reader::open_obs_file(std::string out_file) { try { - d_dump_filename = out_file; + d_dump_filename = std::move(out_file); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); std::cout << "TLM dump enabled, Log file: " << d_dump_filename.c_str() << std::endl; 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 5ed6a0fec..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 @@ -30,6 +30,7 @@ #include "tracking_dump_reader.h" #include +#include bool tracking_dump_reader::read_binary_obs() { @@ -74,10 +75,7 @@ bool tracking_dump_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -95,10 +93,9 @@ int64_t tracking_dump_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + + + return 0; } @@ -108,7 +105,7 @@ bool tracking_dump_reader::open_obs_file(std::string out_file) { try { - d_dump_filename = out_file; + d_dump_filename = std::move(out_file); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); return true; 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 2c03737cd..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 @@ -30,6 +30,7 @@ #include "tracking_true_obs_reader.h" #include +#include bool tracking_true_obs_reader::read_binary_obs() { @@ -57,10 +58,7 @@ bool tracking_true_obs_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -76,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; } @@ -90,7 +85,7 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file) try { d_dump_file.clear(); - d_dump_filename = out_file; + d_dump_filename = std::move(out_file); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); return true; 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 f662f76dc..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 @@ -30,6 +30,7 @@ #include "true_observables_reader.h" #include +#include bool true_observables_reader::read_binary_obs() { @@ -62,10 +63,7 @@ bool true_observables_reader::restart() d_dump_file.seekg(0, std::ios::beg); return true; } - else - { - return false; - } + return false; } @@ -81,10 +79,7 @@ int64_t true_observables_reader::num_epochs() int64_t nepoch = size / epoch_size_bytes; return nepoch; } - else - { - return 0; - } + return 0; } @@ -94,7 +89,7 @@ bool true_observables_reader::open_obs_file(std::string out_file) { try { - d_dump_filename = out_file; + d_dump_filename = std::move(out_file); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); std::cout << "True observables Log file opened: " << d_dump_filename.c_str() << std::endl; diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc b/src/tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc index 68891bff0..d0ce537df 100644 --- a/src/tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc @@ -52,9 +52,9 @@ std::vector packData(std::vector const &raw_data, int shift = (big_endian ? 6 : 0); unsigned int j = 0; - for (unsigned int i = 0; i < raw_data.size(); ++i) + for (signed char i : raw_data) { - unsigned val = static_cast((raw_data[i] - 1) / 2 & 0x03); + auto val = static_cast((i - 1) / 2 & 0x03); packed_data[j] |= val << shift; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc index 34abf6f46..f59a87a1c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc @@ -56,10 +56,10 @@ TEST(TrackingLoopFilterTest, FirstOrderLoop) float g1 = noise_bandwidth * 4.0; float result = 0.0; - for (unsigned int i = 0; i < sample_data.size(); ++i) + for (float i : sample_data) { - result = theFilter.apply(sample_data[i]); - EXPECT_FLOAT_EQ(result, sample_data[i] * g1); + result = theFilter.apply(i); + EXPECT_FLOAT_EQ(result, i * g1); } } diff --git a/src/utils/front-end-cal/front_end_cal.cc b/src/utils/front-end-cal/front_end_cal.cc index a9ec8be37..4590f47b6 100644 --- a/src/utils/front-end-cal/front_end_cal.cc +++ b/src/utils/front-end-cal/front_end_cal.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include "gps_navigation_message.h" #include "gps_ephemeris.h" #include "gps_cnav_ephemeris.h" @@ -77,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; } @@ -235,7 +233,7 @@ int FrontEndCal::Get_SUPL_Assist() void FrontEndCal::set_configuration(std::shared_ptr configuration) { - configuration_ = configuration; + configuration_ = std::move(configuration); } @@ -255,10 +253,7 @@ bool FrontEndCal::get_ephemeris() { return true; } - else - { - return false; - } + return false; } else { @@ -273,10 +268,7 @@ bool FrontEndCal::get_ephemeris() { return true; } - else - { - return false; - } + return false; } } @@ -376,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); } diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 920447aca..a826331c6 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -73,6 +73,7 @@ #include #include #include +#include #include @@ -124,7 +125,7 @@ void FrontEndCal_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; channel_internal_queue.push(rx_message); } @@ -173,7 +174,7 @@ void wait_message() } -bool front_end_capture(std::shared_ptr configuration) +bool front_end_capture(const std::shared_ptr& configuration) { gr::top_block_sptr top_block; GNSSBlockFactory block_factory; @@ -433,9 +434,9 @@ int main(int argc, char** argv) { std::cout << " " << PRN << " "; double doppler_measurement_hz = 0; - for (std::vector::iterator it = gnss_sync_vector.begin(); it != gnss_sync_vector.end(); ++it) + for (auto & it : gnss_sync_vector) { - doppler_measurement_hz += (*it).Acq_doppler_hz; + doppler_measurement_hz += it.Acq_doppler_hz; } doppler_measurement_hz = doppler_measurement_hz / gnss_sync_vector.size(); doppler_measurements_map.insert(std::pair(PRN, doppler_measurement_hz)); @@ -540,21 +541,21 @@ int main(int argc, char** argv) std::cout << "SV ID Measured [Hz] Predicted [Hz]" << std::endl; - for (std::map::iterator it = doppler_measurements_map.begin(); it != doppler_measurements_map.end(); ++it) + for (auto & it : doppler_measurements_map) { try { double doppler_estimated_hz; - doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it->first, current_TOW, lat_deg, lon_deg, altitude_m); - std::cout << " " << it->first << " " << it->second << " " << doppler_estimated_hz << std::endl; + doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it.first, current_TOW, lat_deg, lon_deg, altitude_m); + std::cout << " " << it.first << " " << it.second << " " << doppler_estimated_hz << std::endl; // 7. Compute front-end IF and sampling frequency estimation // Compare with the measurements and compute clock drift using FE model double estimated_fs_Hz, estimated_f_if_Hz, f_osc_err_ppm; - front_end_cal.GPS_L1_front_end_model_E4000(doppler_estimated_hz, it->second, fs_in_, &estimated_fs_Hz, &estimated_f_if_Hz, &f_osc_err_ppm); + front_end_cal.GPS_L1_front_end_model_E4000(doppler_estimated_hz, it.second, fs_in_, &estimated_fs_Hz, &estimated_f_if_Hz, &f_osc_err_ppm); - f_if_estimation_Hz_map.insert(std::pair(it->first, estimated_f_if_Hz)); - f_fs_estimation_Hz_map.insert(std::pair(it->first, estimated_fs_Hz)); - f_ppm_estimation_Hz_map.insert(std::pair(it->first, f_osc_err_ppm)); + f_if_estimation_Hz_map.insert(std::pair(it.first, estimated_f_if_Hz)); + f_fs_estimation_Hz_map.insert(std::pair(it.first, estimated_fs_Hz)); + f_ppm_estimation_Hz_map.insert(std::pair(it.first, f_osc_err_ppm)); } catch (const std::logic_error& e) { @@ -566,7 +567,7 @@ int main(int argc, char** argv) } catch (int ex) { - std::cout << " " << it->first << " " << it->second << " (Eph not found)" << std::endl; + std::cout << " " << it.first << " " << it.second << " (Eph not found)" << std::endl; } } @@ -576,11 +577,11 @@ int main(int argc, char** argv) double mean_osc_err_ppm = 0; int n_elements = f_if_estimation_Hz_map.size(); - for (std::map::iterator it = f_if_estimation_Hz_map.begin(); it != f_if_estimation_Hz_map.end(); ++it) + for (auto & it : f_if_estimation_Hz_map) { - mean_f_if_Hz += (*it).second; - mean_fs_Hz += f_fs_estimation_Hz_map.find((*it).first)->second; - mean_osc_err_ppm += f_ppm_estimation_Hz_map.find((*it).first)->second; + mean_f_if_Hz += it.second; + mean_fs_Hz += f_fs_estimation_Hz_map.find(it.first)->second; + mean_osc_err_ppm += f_ppm_estimation_Hz_map.find(it.first)->second; } mean_f_if_Hz /= n_elements; @@ -597,13 +598,13 @@ int main(int argc, char** argv) << "Corrected Doppler vs. Predicted" << std::endl; std::cout << "SV ID Corrected [Hz] Predicted [Hz]" << std::endl; - for (std::map::iterator it = doppler_measurements_map.begin(); it != doppler_measurements_map.end(); ++it) + for (auto & it : doppler_measurements_map) { try { double doppler_estimated_hz; - doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it->first, current_TOW, lat_deg, lon_deg, altitude_m); - std::cout << " " << it->first << " " << it->second - mean_f_if_Hz << " " << doppler_estimated_hz << std::endl; + doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it.first, current_TOW, lat_deg, lon_deg, altitude_m); + std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " " << doppler_estimated_hz << std::endl; } catch (const std::logic_error& e) { @@ -615,7 +616,7 @@ int main(int argc, char** argv) } catch (int ex) { - std::cout << " " << it->first << " " << it->second - mean_f_if_Hz << " (Eph not found)" << std::endl; + std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " (Eph not found)" << std::endl; } } diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index 31fcd3ebb..f01c5eb8c 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -77,68 +77,74 @@ int main(int argc, char** argv) // Uncompress if RINEX file is gzipped std::string rinex_filename(argv[1]); std::string input_filename = rinex_filename; - std::size_t found = rinex_filename.find_last_of("."); + std::size_t found = rinex_filename.find_last_of('.'); if (found != std::string::npos) { - if ((rinex_filename.substr(found + 1, found + 3).compare("gz") == 0)) + if (rinex_filename.size() >= found + 3) { - std::ifstream file(rinex_filename, std::ios_base::in | std::ios_base::binary); - if (file.fail()) + if ((rinex_filename.substr(found + 1, found + 3) == "gz")) { - std::cerr << "Could not open file " << rinex_filename << std::endl; - return 1; - } - boost::iostreams::filtering_streambuf in; - try - { - in.push(boost::iostreams::gzip_decompressor()); - } - catch (const boost::exception& e) - { - std::cerr << "Could not decompress file " << rinex_filename << std::endl; - return 1; - } - in.push(file); - std::string rinex_filename_unzipped = rinex_filename.substr(0, found); - std::ofstream output_file(rinex_filename_unzipped.c_str(), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); - if (file.fail()) - { - std::cerr << "Could not create file " << rinex_filename_unzipped << std::endl; - return 1; - } - boost::iostreams::copy(in, output_file); - input_filename = rinex_filename_unzipped; - } - if ((rinex_filename.substr(found + 1, found + 2).compare("Z") == 0)) - { - std::ifstream file(rinex_filename, std::ios_base::in | std::ios_base::binary); - if (file.fail()) - { - std::cerr << "Could not open file" << rinex_filename << std::endl; - return 1; - } - file.close(); - std::string uncompress_executable(UNCOMPRESS_EXECUTABLE); - if (!uncompress_executable.empty()) - { - // option k is not always available, so we save a copy of the original file - std::string argum = std::string("/bin/cp " + rinex_filename + " " + rinex_filename + ".aux"); - int s1 = std::system(argum.c_str()); - std::string argum2 = std::string(uncompress_executable + " -f " + rinex_filename); - int s2 = std::system(argum2.c_str()); - std::string argum3 = std::string("/bin/mv " + rinex_filename + +".aux" + " " + rinex_filename); - int s3 = std::system(argum3.c_str()); - input_filename = rinex_filename.substr(0, found); - if ((s1 != 0) or (s2 != 0) or (s3 != 0)) + std::ifstream file(rinex_filename, std::ios_base::in | std::ios_base::binary); + if (file.fail()) { - std::cerr << "Failure uncompressing file." << std::endl; + std::cerr << "Could not open file " << rinex_filename << std::endl; return 1; } + boost::iostreams::filtering_streambuf in; + try + { + in.push(boost::iostreams::gzip_decompressor()); + } + catch (const boost::exception& e) + { + std::cerr << "Could not decompress file " << rinex_filename << std::endl; + return 1; + } + in.push(file); + std::string rinex_filename_unzipped = rinex_filename.substr(0, found); + std::ofstream output_file(rinex_filename_unzipped.c_str(), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); + if (file.fail()) + { + std::cerr << "Could not create file " << rinex_filename_unzipped << std::endl; + return 1; + } + boost::iostreams::copy(in, output_file); + input_filename = rinex_filename_unzipped; } - else + } + if (rinex_filename.size() >= found + 2) + { + if ((rinex_filename.substr(found + 1, found + 2) == "Z")) { - std::cerr << "uncompress program not found." << std::endl; - return 1; + std::ifstream file(rinex_filename, std::ios_base::in | std::ios_base::binary); + if (file.fail()) + { + std::cerr << "Could not open file" << rinex_filename << std::endl; + return 1; + } + file.close(); + std::string uncompress_executable(UNCOMPRESS_EXECUTABLE); + if (!uncompress_executable.empty()) + { + // option k is not always available, so we save a copy of the original file + std::string argum = std::string("/bin/cp " + rinex_filename + " " + rinex_filename + ".aux"); + int s1 = std::system(argum.c_str()); + std::string argum2 = std::string(uncompress_executable + " -f " + rinex_filename); + int s2 = std::system(argum2.c_str()); + std::string argum3 = std::string("/bin/mv " + rinex_filename + +".aux" + " " + rinex_filename); + int s3 = std::system(argum3.c_str()); + input_filename = rinex_filename.substr(0, found); + if ((s1 != 0) or (s2 != 0) or (s3 != 0)) + { + std::cerr << "Failure uncompressing file." << std::endl; + return 1; + } + } + else + { + std::cerr << "uncompress program not found." << std::endl; + return 1; + } } } } @@ -164,7 +170,7 @@ int main(int argc, char** argv) rnffs >> hdr; // Check that it really is a RINEX navigation file - if (hdr.fileType.substr(0, 1).compare("N") != 0) + if (hdr.fileType.substr(0, 1) != "N") { std::cerr << "This is not a valid RINEX navigation file, or file not found." << std::endl; std::cerr << "No XML file will be created." << std::endl; @@ -172,7 +178,7 @@ int main(int argc, char** argv) } // Collect UTC parameters from RINEX header - if (hdr.fileSys.compare("G: (GPS)") == 0 || hdr.fileSys.compare("MIXED") == 0) + if (hdr.fileSys == "G: (GPS)" || hdr.fileSys == "MIXED") { gps_utc_model.valid = (hdr.valid > 2147483648) ? true : false; gps_utc_model.d_A1 = hdr.mapTimeCorr["GPUT"].A0; @@ -195,7 +201,7 @@ int main(int argc, char** argv) gps_iono.d_beta2 = hdr.mapIonoCorr["GPSB"].param[2]; gps_iono.d_beta3 = hdr.mapIonoCorr["GPSB"].param[3]; } - if (hdr.fileSys.compare("E: (GAL)") == 0 || hdr.fileSys.compare("MIXED") == 0) + if (hdr.fileSys == "E: (GAL)" || hdr.fileSys == "MIXED") { gal_utc_model.A0_6 = hdr.mapTimeCorr["GAUT"].A0; gal_utc_model.A1_6 = hdr.mapTimeCorr["GAUT"].A1; @@ -221,7 +227,7 @@ int main(int argc, char** argv) // Read navigation data while (rnffs >> rne) { - if (rne.satSys.compare("G") == 0 or rne.satSys.empty()) + if (rne.satSys == "G" or rne.satSys.empty()) { // Fill GPS ephemeris object Gps_Ephemeris eph; @@ -266,7 +272,7 @@ int main(int argc, char** argv) eph_map[i] = eph; i++; } - if (rne.satSys.compare("E") == 0) + if (rne.satSys == "E") { // Fill Galileo ephemeris object Galileo_Ephemeris eph;