1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-06-28 08:02:58 +00:00

Clean code

This commit is contained in:
Carles Fernandez 2016-10-30 10:20:34 +01:00
parent 2ddc78992f
commit 0e10be6534

View File

@ -182,7 +182,6 @@ Rinex_Printer::Rinex_Printer()
} }
Rinex_Printer::~Rinex_Printer() Rinex_Printer::~Rinex_Printer()
{ {
// close RINEX files // close RINEX files
@ -609,7 +608,6 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono & io
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- End of Header // -------- End of Header
line.clear(); line.clear();
line += std::string(60, ' '); line += std::string(60, ' ');
@ -2623,7 +2621,6 @@ void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_CNAV_Ephemeri
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- TIME OF FIRST OBS // -------- TIME OF FIRST OBS
line.clear(); line.clear();
boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation); boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation);
@ -2660,6 +2657,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_CNAV_Ephemeri
void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, const double d_TOW_first_observation) void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, const double d_TOW_first_observation)
{ {
if(eph_cnav.d_i_0){} // avoid warning, not needed
std::string line; std::string line;
// -------- Line 1 // -------- Line 1
@ -2849,7 +2847,6 @@ void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_Ephemeris & e
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- TIME OF FIRST OBS // -------- TIME OF FIRST OBS
line.clear(); line.clear();
boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation); boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation);
@ -3813,7 +3810,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_CNAV_Ephemeris
} }
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3);
// Receiver clock offset (optional) // Receiver clock offset (optional)
//line += rightJustify(asString(clockOffset, 12), 15); //line += rightJustify(asString(clockOffset, 12), 15);
@ -3880,13 +3876,12 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_CNAV_Ephemeris
if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' '); if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' ');
out << lineObs << std::endl; out << lineObs << std::endl;
} }
} }
void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges) void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges)
{ {
if(eph_cnav.d_i_0){} // avoid warning, not needed
// RINEX observations timestamps are GPS timestamps. // RINEX observations timestamps are GPS timestamps.
std::string line; std::string line;
@ -3953,7 +3948,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph
// Get common observables // Get common observables
std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > > common_pseudoranges; std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > > common_pseudoranges;
std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > >::const_iterator common_pseudoranges_iter; std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > >::const_iterator common_pseudoranges_iter;
std::map<int, Gnss_Synchro> pseudorangesL1_with_L2;
for(pseudoranges_iter = pseudorangesL1.begin(); for(pseudoranges_iter = pseudorangesL1.begin();
pseudoranges_iter != pseudorangesL1.end(); pseudoranges_iter != pseudorangesL1.end();
@ -3971,7 +3965,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph
Gnss_Synchro pr2 = pseudoranges_iter2->second; Gnss_Synchro pr2 = pseudoranges_iter2->second;
p = std::make_pair(pr1, pr2); p = std::make_pair(pr1, pr2);
common_pseudoranges.push_back(p); common_pseudoranges.push_back(p);
pseudorangesL1_with_L2.insert(std::pair<int, Gnss_Synchro>(pseudoranges_iter->first, pseudoranges_iter->second));
} }
} }
} }
@ -4098,7 +4091,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
{ {
// RINEX observations timestamps are Galileo timestamps. // RINEX observations timestamps are Galileo timestamps.
// See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html // See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html
std::string line; std::string line;
boost::posix_time::ptime p_galileo_time = Rinex_Printer::compute_Galileo_time(eph, obs_time); boost::posix_time::ptime p_galileo_time = Rinex_Printer::compute_Galileo_time(eph, obs_time);
@ -4336,11 +4328,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep
} }
// represents GPS time (week, TOW) in the date time format of the Gregorian calendar.
// -> Leap years are considered, but leap seconds not.
void Rinex_Printer::to_date_time(int gps_week, int gps_tow, int &year, int &month, int &day, int &hour, int &minute, int &second) void Rinex_Printer::to_date_time(int gps_week, int gps_tow, int &year, int &month, int &day, int &hour, int &minute, int &second)
{ {
// represents GPS time (week, TOW) in the date time format of the Gregorian calendar.
// -> Leap years are considered, but leap seconds are not.
int days_per_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int days_per_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// seconds in a not leap year // seconds in a not leap year
@ -4407,7 +4398,6 @@ void Rinex_Printer::to_date_time(int gps_week, int gps_tow, int &year, int &mont
} }
void Rinex_Printer::log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_message) void Rinex_Printer::log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_message)
{ {
// line 1: PRN / EPOCH / RCVR // line 1: PRN / EPOCH / RCVR
@ -4522,6 +4512,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep
return p_time; return p_time;
} }
boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeris & eph, const double obs_time) boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeris & eph, const double obs_time)
{ {
// The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here. // The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here.