1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

Improve const correctness in PVT libs

This commit is contained in:
Carles Fernandez 2020-07-26 23:56:36 +02:00
parent 0aa6d6afc3
commit f5e76e7613
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
15 changed files with 453 additions and 453 deletions

View File

@ -177,7 +177,7 @@ bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_nam
} }
bool GeoJSON_Printer::print_position(const Pvt_Solution* position, bool print_average_values) bool GeoJSON_Printer::print_position(const Pvt_Solution* const position, bool print_average_values)
{ {
double latitude; double latitude;
double longitude; double longitude;

View File

@ -39,7 +39,7 @@ public:
explicit GeoJSON_Printer(const std::string& base_path = "."); explicit GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer(); ~GeoJSON_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const Pvt_Solution* position, bool print_average_values); bool print_position(const Pvt_Solution* const position, bool print_average_values);
bool close_file(); bool close_file();
private: private:

View File

@ -162,7 +162,7 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name)
} }
bool Gpx_Printer::print_position(const Pvt_Solution* position, bool print_average_values) bool Gpx_Printer::print_position(const Pvt_Solution* const position, bool print_average_values)
{ {
double latitude; double latitude;
double longitude; double longitude;

View File

@ -39,7 +39,7 @@ public:
explicit Gpx_Printer(const std::string& base_path = "."); explicit Gpx_Printer(const std::string& base_path = ".");
~Gpx_Printer(); ~Gpx_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const Pvt_Solution* position, bool print_average_values); bool print_position(const Pvt_Solution* const position, bool print_average_values);
bool close_file(); bool close_file();
private: private:

View File

@ -231,7 +231,7 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name)
} }
bool Kml_Printer::print_position(const Pvt_Solution* position, bool print_average_values) bool Kml_Printer::print_position(const Pvt_Solution* const position, bool print_average_values)
{ {
double latitude; double latitude;
double longitude; double longitude;

View File

@ -38,7 +38,7 @@ public:
explicit Kml_Printer(const std::string& base_path = std::string(".")); explicit Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer(); ~Kml_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const Pvt_Solution* position, bool print_average_values); bool print_position(const Pvt_Solution* const position, bool print_average_values);
bool close_file(); bool close_file();
private: private:

View File

@ -40,7 +40,7 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addre
} }
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt* monitor_pvt) bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt* const monitor_pvt)
{ {
std::string outbound_data; std::string outbound_data;
if (use_protobuf == false) if (use_protobuf == false)

View File

@ -38,7 +38,7 @@ class Monitor_Pvt_Udp_Sink
{ {
public: public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled); Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
bool write_monitor_pvt(const Monitor_Pvt* monitor_pvt); bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt);
private: private:
Serdes_Monitor_Pvt serdes; Serdes_Monitor_Pvt serdes;

View File

@ -208,7 +208,7 @@ void Nmea_Printer::close_serial()
} }
bool Nmea_Printer::Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_average_values) bool Nmea_Printer::Print_Nmea_Line(const Rtklib_Solver* const pvt_data, bool print_average_values)
{ {
// set the new PVT data // set the new PVT data
d_PVT_data = pvt_data; d_PVT_data = pvt_data;
@ -273,7 +273,7 @@ bool Nmea_Printer::Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_ave
} }
char Nmea_Printer::checkSum(const std::string& sentence) char Nmea_Printer::checkSum(const std::string& sentence) const
{ {
char check = 0; char check = 0;
// iterate over the string, XOR each byte with the total sum: // iterate over the string, XOR each byte with the total sum:
@ -286,7 +286,7 @@ char Nmea_Printer::checkSum(const std::string& sentence)
} }
std::string Nmea_Printer::latitude_to_hm(double lat) std::string Nmea_Printer::latitude_to_hm(double lat) const
{ {
bool north; bool north;
if (lat < 0.0) if (lat < 0.0)
@ -324,7 +324,7 @@ std::string Nmea_Printer::latitude_to_hm(double lat)
} }
std::string Nmea_Printer::longitude_to_hm(double longitude) std::string Nmea_Printer::longitude_to_hm(double longitude) const
{ {
bool east; bool east;
if (longitude < 0.0) if (longitude < 0.0)
@ -361,7 +361,7 @@ std::string Nmea_Printer::longitude_to_hm(double longitude)
} }
std::string Nmea_Printer::get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time) std::string Nmea_Printer::get_UTC_NMEA_time(const boost::posix_time::ptime d_position_UTC_time) const
{ {
// UTC Time: hhmmss.sss // UTC Time: hhmmss.sss
std::stringstream sentence_str; std::stringstream sentence_str;
@ -409,7 +409,7 @@ std::string Nmea_Printer::get_UTC_NMEA_time(boost::posix_time::ptime d_position_
} }
std::string Nmea_Printer::get_GPRMC() std::string Nmea_Printer::get_GPRMC() const
{ {
// Sample -> $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,*10 // Sample -> $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,*10
std::stringstream sentence_str; std::stringstream sentence_str;
@ -420,7 +420,7 @@ std::string Nmea_Printer::get_GPRMC()
} }
std::string Nmea_Printer::get_GPGSA() std::string Nmea_Printer::get_GPGSA() const
{ {
// $GPGSA,A,3,07,02,26,27,09,04,15, , , , , ,1.8,1.0,1.5*33 // $GPGSA,A,3,07,02,26,27,09,04,15, , , , , ,1.8,1.0,1.5*33
// GSA-GNSS DOP and Active Satellites // GSA-GNSS DOP and Active Satellites
@ -432,7 +432,7 @@ std::string Nmea_Printer::get_GPGSA()
} }
std::string Nmea_Printer::get_GPGSV() std::string Nmea_Printer::get_GPGSV() const
{ {
// GSV-GNSS Satellites in View // GSV-GNSS Satellites in View
// $GPGSV,2,1,07,07,79,048,42,02,51,062,43,26,36,256,42,27,27,138,42*71 // $GPGSV,2,1,07,07,79,048,42,02,51,062,43,26,36,256,42,27,27,138,42*71
@ -445,7 +445,7 @@ std::string Nmea_Printer::get_GPGSV()
} }
std::string Nmea_Printer::get_GPGGA() std::string Nmea_Printer::get_GPGGA() const
{ {
std::stringstream sentence_str; std::stringstream sentence_str;
std::array<unsigned char, 1024> buff{}; std::array<unsigned char, 1024> buff{};

View File

@ -54,19 +54,19 @@ public:
/*! /*!
* \brief Print NMEA PVT and satellite info to the initialized device * \brief Print NMEA PVT and satellite info to the initialized device
*/ */
bool Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_average_values); bool Print_Nmea_Line(const Rtklib_Solver* const pvt_data, bool print_average_values);
private: private:
int init_serial(const std::string& serial_device); // serial port control int init_serial(const std::string& serial_device); // serial port control
void close_serial(); void close_serial();
std::string get_GPGGA(); // fix data std::string get_GPGGA() const; // fix data
std::string get_GPGSV(); // satellite data std::string get_GPGSV() const; // satellite data
std::string get_GPGSA(); // overall satellite reception data std::string get_GPGSA() const; // overall satellite reception data
std::string get_GPRMC(); // minimum recommended data std::string get_GPRMC() const; // minimum recommended data
std::string get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time); std::string get_UTC_NMEA_time(const boost::posix_time::ptime d_position_UTC_time) const;
std::string longitude_to_hm(double longitude); std::string longitude_to_hm(double longitude) const;
std::string latitude_to_hm(double lat); std::string latitude_to_hm(double lat) const;
char checkSum(const std::string& sentence); char checkSum(const std::string& sentence) const;
const Rtklib_Solver* d_PVT_data; const Rtklib_Solver* d_PVT_data;

File diff suppressed because it is too large Load Diff

View File

@ -85,38 +85,30 @@ public:
*/ */
~Rinex_Printer(); ~Rinex_Printer();
std::fstream obsFile; //!< Output file stream for RINEX observation file
std::fstream navFile; //!< Output file stream for RINEX navigation data file
std::fstream sbsFile; //!< Output file stream for RINEX SBAS raw data file
std::fstream navGalFile; //!< Output file stream for RINEX Galileo navigation data file
std::fstream navGloFile; //!< Output file stream for RINEX GLONASS navigation data file
std::fstream navBdsFile; //!< Output file stream for RINEX Galileo navigation data file
std::fstream navMixFile; //!< Output file stream for RINEX Mixed navigation data file
/*! /*!
* \brief Generates the GPS L1 C/A Navigation Data header * \brief Generates the GPS L1 C/A Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model, const Gps_Ephemeris& eph); void rinex_nav_header(std::fstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model, const Gps_Ephemeris& eph) const;
/*! /*!
* \brief Generates the GPS L2C(M) Navigation Data header * \brief Generates the GPS L2C(M) Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& iono, const Gps_CNAV_Utc_Model& utc_model); void rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& iono, const Gps_CNAV_Utc_Model& utc_model) const;
/*! /*!
* \brief Generates the Galileo Navigation Data header * \brief Generates the Galileo Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Galileo_Iono& iono, const Galileo_Utc_Model& utc_model); void rinex_nav_header(std::fstream& out, const Galileo_Iono& iono, const Galileo_Utc_Model& utc_model) const;
/*! /*!
* \brief Generates the Mixed (GPS/Galileo) Navigation Data header * \brief Generates the Mixed (GPS/Galileo) Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model); void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model) const;
/*! /*!
* \brief Generates the Mixed (GPS CNAV/Galileo) Navigation Data header * \brief Generates the Mixed (GPS CNAV/Galileo) Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& iono, const Gps_CNAV_Utc_Model& utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model); void rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& iono, const Gps_CNAV_Utc_Model& utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model) const;
/*! /*!
* \brief Generates the GLONASS L1, L2 C/A Navigation Data header * \brief Generates the GLONASS L1, L2 C/A Navigation Data header
@ -126,7 +118,7 @@ public:
/*! /*!
* \brief Generates the Mixed (Galileo/GLONASS) Navigation Data header * \brief Generates the Mixed (Galileo/GLONASS) Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) const;
/*! /*!
* \brief Generates the Mixed (GPS L1 C/A/GLONASS L1, L2) Navigation Data header * \brief Generates the Mixed (GPS L1 C/A/GLONASS L1, L2) Navigation Data header
@ -141,12 +133,12 @@ public:
/*! /*!
* \brief Generates the BDS B1I or B3I Navigation Data header * \brief Generates the BDS B1I or B3I Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono& iono, const Beidou_Dnav_Utc_Model& utc_model); void rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono& iono, const Beidou_Dnav_Utc_Model& utc_model) const;
/*! /*!
* \brief Generates the Mixed GPS L1,L5 + BDS B1I, B3I Navigation Data header * \brief Generates the Mixed GPS L1,L5 + BDS B1I, B3I Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model); void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model) const;
/*! /*!
* \brief Generates the Mixed GPS L2C + BDS B1I, B3I Navigation Data header * \brief Generates the Mixed GPS L2C + BDS B1I, B3I Navigation Data header
@ -156,77 +148,77 @@ public:
/*! /*!
* \brief Generates the Mixed GLONASS L1,L2 + BDS B1I, B3I Navigation Data header * \brief Generates the Mixed GLONASS L1,L2 + BDS B1I, B3I Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glo_gnav_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model); void rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glo_gnav_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model) const;
/*! /*!
* \brief Generates the Mixed (Galileo/BDS B1I, B3I) Navigation Data header * \brief Generates the Mixed (Galileo/BDS B1I, B3I) Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model); void rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model) const;
/*! /*!
* \brief Generates the GPS Observation data header * \brief Generates the GPS Observation data header
*/ */
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const double d_TOW_first_observation); void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, double d_TOW_first_observation);
/*! /*!
* \brief Generates the GPS L2 Observation data header * \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, double d_TOW_first_observation, const std::string& gps_bands = "2S");
/*! /*!
* \brief Generates the dual frequency GPS L1 & L2/L5 Observation data header * \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, 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". * \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, 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". * \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, 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". * \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, 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". * \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, 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". * \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, 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". * \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& glonass_bands = "1C"); void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double d_TOW_first_observation, const std::string& glonass_bands = "1C");
/*! /*!
* \brief Generates the Mixed (Galileo/GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". * \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& glonass_bands = "1C"); void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double d_TOW_first_observation, const std::string& galileo_bands = "1B", const std::string& glonass_bands = "1C");
/*! /*!
* \brief Generates the Mixed (GPS L2C/GLONASS) Observation data header. Example: galileo_bands("1G")... Default: "1G". * \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& glonass_bands = "1G"); void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double d_TOW_first_observation, const std::string& glonass_bands = "1G");
/*! /*!
* \brief Generates the a Beidou B1I Observation data header. Example: beidou_bands("B1") * \brief Generates the a Beidou B1I Observation data header. Example: beidou_bands("B1")
*/ */
void rinex_obs_header(std::fstream& out, const Beidou_Dnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands); void rinex_obs_header(std::fstream& out, const Beidou_Dnav_Ephemeris& eph, double d_TOW_first_observation, const std::string& bands);
/*! /*!
* \brief Generates the SBAS raw data header * \brief Generates the SBAS raw data header
*/ */
void rinex_sbs_header(std::fstream& out); void rinex_sbs_header(std::fstream& out) const;
/*! /*!
* \brief Computes the BDS Time and returns a boost::posix_time::ptime object * \brief Computes the BDS Time and returns a boost::posix_time::ptime object
@ -235,27 +227,27 @@ public:
* \param eph BeiDou DNAV Ephemeris object * \param eph BeiDou DNAV Ephemeris object
* \param obs_time Observation time in BDT seconds of week * \param obs_time Observation time in BDT seconds of week
*/ */
boost::posix_time::ptime compute_BDS_time(const Beidou_Dnav_Ephemeris& eph, const double obs_time); boost::posix_time::ptime compute_BDS_time(const Beidou_Dnav_Ephemeris& eph, double obs_time) const;
/*! /*!
* \brief Computes the UTC time and returns a boost::posix_time::ptime object * \brief Computes the UTC time and returns a boost::posix_time::ptime object
*/ */
boost::posix_time::ptime compute_UTC_time(const Gps_Navigation_Message& nav_msg); boost::posix_time::ptime compute_UTC_time(const Gps_Navigation_Message& nav_msg) const;
/*! /*!
* \brief Computes the GPS time and returns a boost::posix_time::ptime object * \brief Computes the GPS time and returns a boost::posix_time::ptime object
*/ */
boost::posix_time::ptime compute_GPS_time(const Gps_Ephemeris& eph, const double obs_time); boost::posix_time::ptime compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const;
/*! /*!
* \brief Computes the GPS time and returns a boost::posix_time::ptime object * \brief Computes the GPS time and returns a boost::posix_time::ptime object
*/ */
boost::posix_time::ptime compute_GPS_time(const Gps_CNAV_Ephemeris& eph, const double obs_time); boost::posix_time::ptime compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const;
/*! /*!
* \brief Computes the Galileo time and returns a boost::posix_time::ptime object * \brief Computes the Galileo time and returns a boost::posix_time::ptime object
*/ */
boost::posix_time::ptime compute_Galileo_time(const Galileo_Ephemeris& eph, const double obs_time); boost::posix_time::ptime compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const;
/*! /*!
* \brief Computes the UTC Time and returns a boost::posix_time::ptime object * \brief Computes the UTC Time and returns a boost::posix_time::ptime object
@ -264,19 +256,19 @@ public:
* \param eph GLONASS GNAV Ephemeris object * \param eph GLONASS GNAV Ephemeris object
* \param obs_time Observation time in GPS seconds of week * \param obs_time Observation time in GPS seconds of week
*/ */
boost::posix_time::ptime compute_UTC_time(const Glonass_Gnav_Ephemeris& eph, const double obs_time); boost::posix_time::ptime compute_UTC_time(const Glonass_Gnav_Ephemeris& eph, double obs_time) const;
/*! /*!
* \brief Computes number of leap seconds of GPS relative to UTC * \brief Computes number of leap seconds of GPS relative to UTC
* \param eph GLONASS GNAV Ephemeris object * \param eph GLONASS GNAV Ephemeris object
* \param gps_obs_time Observation time in GPS seconds of week * \param gps_obs_time Observation time in GPS seconds of week
*/ */
double get_leap_second(const Glonass_Gnav_Ephemeris& eph, const double gps_obs_time); double get_leap_second(const Glonass_Gnav_Ephemeris& eph, double gps_obs_time) const;
/*! /*!
* \brief Writes data from the GPS L1 C/A navigation message into the RINEX file * \brief Writes data from the GPS L1 C/A navigation message into the RINEX file
*/ */
void log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps_Ephemeris>& eph_map); void log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps_Ephemeris>& eph_map) const;
/*! /*!
* \brief Writes data from the GPS L2 navigation message into the RINEX file * \brief Writes data from the GPS L2 navigation message into the RINEX file
@ -286,7 +278,7 @@ public:
/*! /*!
* \brief Writes data from the Galileo navigation message into the RINEX file * \brief Writes data from the Galileo navigation message into the RINEX file
*/ */
void log_rinex_nav(std::fstream& out, const std::map<int32_t, Galileo_Ephemeris>& eph_map); void log_rinex_nav(std::fstream& out, const std::map<int32_t, Galileo_Ephemeris>& eph_map) const;
/*! /*!
* \brief Writes data from the Mixed (GPS/Galileo) navigation message into the RINEX file * \brief Writes data from the Mixed (GPS/Galileo) navigation message into the RINEX file
@ -301,12 +293,12 @@ public:
/*! /*!
* \brief Writes data from the GLONASS GNAV navigation message into the RINEX file * \brief Writes data from the GLONASS GNAV navigation message into the RINEX file
*/ */
void log_rinex_nav(std::fstream& out, const std::map<int32_t, Glonass_Gnav_Ephemeris>& eph_map); void log_rinex_nav(std::fstream& out, const std::map<int32_t, Glonass_Gnav_Ephemeris>& eph_map) const;
/*! /*!
* \brief Writes data from the Mixed (GPS/GLONASS GNAV) navigation message into the RINEX file * \brief Writes data from the Mixed (GPS/GLONASS GNAV) navigation message into the RINEX file
*/ */
void log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps_Ephemeris>& gps_eph_map, const std::map<int32_t, Glonass_Gnav_Ephemeris>& glonass_gnav_eph_map); void log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps_Ephemeris>& gps_eph_map, const std::map<int32_t, Glonass_Gnav_Ephemeris>& glonass_gnav_eph_map) const;
/*! /*!
* \brief Writes data from the Mixed (GPS/GLONASS GNAV) navigation message into the RINEX file * \brief Writes data from the Mixed (GPS/GLONASS GNAV) navigation message into the RINEX file
@ -321,113 +313,118 @@ public:
/*! /*!
* \brief Writes data from the Beidou B1I navigation message into the RINEX file * \brief Writes data from the Beidou B1I navigation message into the RINEX file
*/ */
void log_rinex_nav(std::fstream& out, const std::map<int32_t, Beidou_Dnav_Ephemeris>& eph_map); void log_rinex_nav(std::fstream& out, const std::map<int32_t, Beidou_Dnav_Ephemeris>& eph_map) const;
/*! /*!
* \brief Writes GPS L1 observables into the RINEX file * \brief Writes GPS L1 observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables); void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables) const;
/*! /*!
* \brief Writes GPS L2 observables into the RINEX file * \brief Writes GPS L2 observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables); void log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables) const;
/*! /*!
* \brief Writes dual frequency GPS L1 and L2 observables into the RINEX file * \brief Writes dual frequency GPS L1 and L2 observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, bool triple_band = false); void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, bool triple_band = false) const;
/*! /*!
* \brief Writes Galileo observables into the RINEX file. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". * \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<int32_t, Gnss_Synchro>& observables, const std::string& galileo_bands = "1B"); void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& galileo_bands = "1B") const;
/*! /*!
* \brief Writes Mixed GPS / Galileo observables into the RINEX file * \brief Writes Mixed GPS / Galileo observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables); void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables) const;
/*! /*!
* \brief Writes Mixed GPS / Galileo observables into the RINEX file * \brief Writes Mixed GPS / Galileo observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const Galileo_Ephemeris& galileo_eph, double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables); void log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const Galileo_Ephemeris& galileo_eph, double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables) const;
/*! /*!
* \brief Writes Mixed GPS / Galileo observables into the RINEX file * \brief Writes Mixed GPS / Galileo observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Galileo_Ephemeris& galileo_eph, double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables, bool triple_band = false); void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Galileo_Ephemeris& galileo_eph, double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables, bool triple_band = false) const;
/*! /*!
* \brief Writes GLONASS GNAV observables into the RINEX file. Example: glonass_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". * \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<int32_t, Gnss_Synchro>& 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<int32_t, Gnss_Synchro>& observables, const std::string& glonass_bands = "1C") const;
/*! /*!
* \brief Writes Mixed GPS L1 C/A - GLONASS observables into the RINEX file * \brief Writes Mixed GPS L1 C/A - GLONASS observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables); void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables) const;
/*! /*!
* \brief Writes Mixed GPS L2C - GLONASS observables into the RINEX file * \brief Writes Mixed GPS L2C - GLONASS observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables); void log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double gps_obs_time, const std::map<int32_t, Gnss_Synchro>& observables) const;
/*! /*!
* \brief Writes Mixed Galileo/GLONASS observables into the RINEX file * \brief Writes Mixed Galileo/GLONASS observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double galileo_obs_time, const std::map<int32_t, Gnss_Synchro>& observables); void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double galileo_obs_time, const std::map<int32_t, Gnss_Synchro>& observables) const;
/*! /*!
* \brief Writes BDS B1I observables into the RINEX file * \brief Writes BDS B1I observables into the RINEX file
*/ */
void log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& bds_bands); void log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& bds_bands) const;
/*! /*!
* \brief Represents GPS time in the date time format. Leap years are considered, but leap seconds are not. * \brief Represents GPS time in the date time format. Leap years are considered, but leap seconds are not.
*/ */
void to_date_time(int gps_week, int gps_tow, int& year, int& month, int& day, int& hour, int& minute, int& second); void to_date_time(int gps_week, int gps_tow, int& year, int& month, int& day, int& hour, int& minute, int& second) const;
/*! /*!
* \brief Writes raw SBAS messages into the RINEX file * \brief Writes raw SBAS messages into the RINEX file
*/ */
// void log_rinex_sbs(std::fstream & out, const Sbas_Raw_Msg & sbs_message); // void log_rinex_sbs(std::fstream & out, const Sbas_Raw_Msg & sbs_message);
void update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& gps_iono, const Gps_Ephemeris& eph); void update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& gps_iono, const Gps_Ephemeris& eph) const;
void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono); void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono) const;
void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model); void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model) const;
void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model); void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model) const;
void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& utc_model); void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& utc_model) const;
void update_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void update_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) const;
void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc, const Gps_Ephemeris& eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc, const Gps_Ephemeris& eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) const;
void update_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_iono, const Gps_CNAV_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void update_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_iono, const Gps_CNAV_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) const;
void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) const;
void update_nav_header(std::fstream& out, const Beidou_Dnav_Utc_Model& utc_model, const Beidou_Dnav_Iono& beidou_dnav_iono); void update_nav_header(std::fstream& out, const Beidou_Dnav_Utc_Model& utc_model, const Beidou_Dnav_Iono& beidou_dnav_iono) const;
void update_obs_header(std::fstream& out, const Gps_Utc_Model& utc_model); void update_obs_header(std::fstream& out, const Gps_Utc_Model& utc_model) const;
void update_obs_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model); void update_obs_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model) const;
void update_obs_header(std::fstream& out, const Galileo_Utc_Model& galileo_utc_model); void update_obs_header(std::fstream& out, const Galileo_Utc_Model& galileo_utc_model) const;
void update_obs_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model); void update_obs_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) const;
void update_obs_header(std::fstream& out, const Beidou_Dnav_Utc_Model& utc_model); void update_obs_header(std::fstream& out, const Beidou_Dnav_Utc_Model& utc_model) const;
std::map<std::string, std::string> satelliteSystem; //!< GPS, GLONASS, SBAS payload, Galileo or Beidou void set_pre_2009_file(bool pre_2009_file);
std::map<std::string, std::string> observationType; //!< PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH
std::map<std::string, std::string> observationCode; //!< GNSS observation descriptors std::fstream obsFile; //!< Output file stream for RINEX observation file
std::string stringVersion; //!< RINEX version (2.10/2.11 or 3.01/3.02) std::fstream navFile; //!< Output file stream for RINEX navigation data file
std::fstream sbsFile; //!< Output file stream for RINEX SBAS raw data file
std::fstream navGalFile; //!< Output file stream for RINEX Galileo navigation data file
std::fstream navGloFile; //!< Output file stream for RINEX GLONASS navigation data file
std::fstream navBdsFile; //!< Output file stream for RINEX Galileo navigation data file
std::fstream navMixFile; //!< Output file stream for RINEX Mixed navigation data file
std::string navfilename; std::string navfilename;
std::string obsfilename; std::string obsfilename;
@ -437,13 +434,11 @@ public:
std::string navBdsfilename; std::string navBdsfilename;
std::string navMixfilename; std::string navMixfilename;
void set_pre_2009_file(bool pre_2009_file);
private: private:
/* /*
* Generation of RINEX signal strength indicators * Generation of RINEX signal strength indicators
*/ */
int signalStrength(const double snr); int signalStrength(double snr) const;
/* Creates RINEX file names according to the naming convention /* Creates RINEX file names according to the naming convention
* *
@ -461,17 +456,17 @@ private:
* "RINEX_FILE_TYPE_SBAS" - SBAS broadcast data file. * "RINEX_FILE_TYPE_SBAS" - SBAS broadcast data file.
* "RINEX_FILE_TYPE_CLK" - Clock file. * "RINEX_FILE_TYPE_CLK" - Clock file.
*/ */
std::string createFilename(const std::string& type, const std::string& base_name); std::string createFilename(const std::string& type, const std::string& base_name) const;
/* /*
* Generates the data for the PGM / RUN BY / DATE line * Generates the data for the PGM / RUN BY / DATE line
*/ */
std::string getLocalTime(); std::string getLocalTime() const;
/* /*
* Checks that the line is 80 characters length * Checks that the line is 80 characters length
*/ */
void lengthCheck(const std::string& line); void lengthCheck(const std::string& line) const;
/* /*
* If the string is bigger than length, truncate it from the right. * If the string is bigger than length, truncate it from the right.
@ -487,8 +482,8 @@ private:
* \param[in] pad character to pad string with (blank by default). * \param[in] pad character to pad string with (blank by default).
* \return a reference to \a s. */ * \return a reference to \a s. */
inline std::string& leftJustify(std::string& s, inline std::string& leftJustify(std::string& s,
const std::string::size_type length, std::string::size_type length,
const char pad = ' '); char pad = ' ') const;
/* /*
* If the string is bigger than length, truncate it from the right. * If the string is bigger than length, truncate it from the right.
@ -504,8 +499,8 @@ private:
* \param[in] pad character to pad string with (blank by default). * \param[in] pad character to pad string with (blank by default).
* \return a reference to \a s. */ * \return a reference to \a s. */
inline std::string leftJustify(const std::string& s, inline std::string leftJustify(const std::string& s,
const std::string::size_type length, std::string::size_type length,
const char pad = ' ') char pad = ' ') const
{ {
std::string t(s); std::string t(s);
return leftJustify(t, length, pad); return leftJustify(t, length, pad);
@ -519,8 +514,8 @@ private:
* the pad character (\a pad). The default pad * the pad character (\a pad). The default pad
* character is a blank. */ * character is a blank. */
inline std::string& rightJustify(std::string& s, inline std::string& rightJustify(std::string& s,
const std::string::size_type length, std::string::size_type length,
const char pad = ' '); char pad = ' ') const;
/* /*
* Right-justifies the receiver in a string of the specified * Right-justifies the receiver in a string of the specified
@ -529,8 +524,8 @@ private:
* the pad character (\a pad). The default pad * the pad character (\a pad). The default pad
* character is a blank.*/ * character is a blank.*/
inline std::string rightJustify(const std::string& s, inline std::string rightJustify(const std::string& s,
const std::string::size_type length, std::string::size_type length,
const char pad = ' ') char pad = ' ') const
{ {
std::string t(s); std::string t(s);
return rightJustify(t, length, pad); return rightJustify(t, length, pad);
@ -547,11 +542,11 @@ private:
* exponentials above three characters in length. If false, it removes * exponentials above three characters in length. If false, it removes
* that check. * that check.
*/ */
inline std::string doub2sci(const double& d, inline std::string doub2sci(double d,
const std::string::size_type length, std::string::size_type length,
const std::string::size_type expLen, std::string::size_type expLen,
const bool showSign = true, bool showSign = true,
const bool checkSwitch = true); bool checkSwitch = true) const;
/* /*
@ -569,10 +564,10 @@ private:
* zero. For example -> 0.87654E-0004 or -0.1234E00005. * zero. For example -> 0.87654E-0004 or -0.1234E00005.
*/ */
inline std::string& sci2for(std::string& aStr, inline std::string& sci2for(std::string& aStr,
const std::string::size_type startPos = 0, std::string::size_type startPos = 0,
const std::string::size_type length = std::string::npos, std::string::size_type length = std::string::npos,
const std::string::size_type expLen = 3, std::string::size_type expLen = 3,
const bool checkSwitch = true); bool checkSwitch = true) const;
/* /*
@ -587,10 +582,10 @@ private:
* that check. * that check.
* @return a string containing \a d in FORTRAN notation. * @return a string containing \a d in FORTRAN notation.
*/ */
inline std::string doub2for(const double& d, inline std::string doub2for(double d,
const std::string::size_type length, std::string::size_type length,
const std::string::size_type expLen, std::string::size_type expLen,
const bool checkSwitch = true); bool checkSwitch = true) const;
/* /*
@ -598,20 +593,20 @@ private:
* @param s string containing a number. * @param s string containing a number.
* @return double representation of string. * @return double representation of string.
*/ */
inline double asDouble(const std::string& s) inline double asDouble(const std::string& s) const
{ {
return strtod(s.c_str(), nullptr); return strtod(s.c_str(), nullptr);
} }
inline int toInt(std::string bitString, int sLength); inline int toInt(const std::string& bitString, int sLength) const;
/* /*
* Convert a string to an integer. * Convert a string to an integer.
* @param s string containing a number. * @param s string containing a number.
* @return int64_t integer representation of string. * @return int64_t integer representation of string.
*/ */
inline int64_t asInt(const std::string& s) inline int64_t asInt(const std::string& s) const
{ {
return strtol(s.c_str(), nullptr, 10); return strtol(s.c_str(), nullptr, 10);
} }
@ -623,8 +618,8 @@ private:
* @param precision the number of decimal places you want displayed. * @param precision the number of decimal places you want displayed.
* @return string representation of \a x. * @return string representation of \a x.
*/ */
inline std::string asString(const double x, inline std::string asString(double x,
const std::string::size_type precision = 17); std::string::size_type precision = 17) const;
/* /*
@ -633,8 +628,8 @@ private:
* @param precision the number of decimal places you want displayed. * @param precision the number of decimal places you want displayed.
* @return string representation of \a x. * @return string representation of \a x.
*/ */
inline std::string asString(const long double x, inline std::string asString(long double x,
const std::string::size_type precision = 21); std::string::size_type precision = 21) const;
/* /*
@ -644,9 +639,14 @@ private:
* @return string representation of \a x. * @return string representation of \a x.
*/ */
template <class X> template <class X>
inline std::string asString(const X x); inline std::string asString(const X x) const;
inline std::string asFixWidthString(const int x, const int width, char fill_digit); inline std::string asFixWidthString(int x, int width, char fill_digit) const;
std::map<std::string, std::string> satelliteSystem; // GPS, GLONASS, SBAS payload, Galileo or Beidou
std::map<std::string, std::string> observationType; // PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH
std::map<std::string, std::string> observationCode; // GNSS observation descriptors
std::string stringVersion; // RINEX version (2.10/2.11 or 3.01/3.02)
double fake_cnav_iode; double fake_cnav_iode;
int version; // RINEX version (2 for 2.10/2.11 and 3 for 3.01) int version; // RINEX version (2 for 2.10/2.11 and 3 for 3.01)
@ -658,8 +658,8 @@ private:
// Implementation of inline functions (modified versions from GPSTk https://github.com/SGL-UT/GPSTk) // Implementation of inline functions (modified versions from GPSTk https://github.com/SGL-UT/GPSTk)
inline std::string& Rinex_Printer::leftJustify(std::string& s, inline std::string& Rinex_Printer::leftJustify(std::string& s,
const std::string::size_type length, std::string::size_type length,
const char pad) char pad) const
{ {
if (length < s.length()) if (length < s.length())
{ {
@ -676,8 +676,8 @@ inline std::string& Rinex_Printer::leftJustify(std::string& s,
// if the string is bigger than length, truncate it from the left. // if the string is bigger than length, truncate it from the left.
// otherwise, add pad characters to its left. // otherwise, add pad characters to its left.
inline std::string& Rinex_Printer::rightJustify(std::string& s, inline std::string& Rinex_Printer::rightJustify(std::string& s,
const std::string::size_type length, std::string::size_type length,
const char pad) char pad) const
{ {
if (length < s.length()) if (length < s.length())
{ {
@ -691,12 +691,12 @@ inline std::string& Rinex_Printer::rightJustify(std::string& s,
} }
inline std::string Rinex_Printer::doub2for(const double& d, inline std::string Rinex_Printer::doub2for(double d,
const std::string::size_type length, std::string::size_type length,
const std::string::size_type expLen, std::string::size_type expLen,
const bool checkSwitch) bool checkSwitch) const
{ {
short exponentLength = expLen; int16_t exponentLength = expLen;
/* Validate the assumptions regarding the input arguments */ /* Validate the assumptions regarding the input arguments */
if (exponentLength < 0) if (exponentLength < 0)
@ -716,14 +716,14 @@ inline std::string Rinex_Printer::doub2for(const double& d,
} }
inline std::string Rinex_Printer::doub2sci(const double& d, inline std::string Rinex_Printer::doub2sci(double d,
const std::string::size_type length, std::string::size_type length,
const std::string::size_type expLen, std::string::size_type expLen,
const bool showSign, bool showSign,
const bool checkSwitch) bool checkSwitch) const
{ {
std::string toReturn; std::string toReturn;
short exponentLength = expLen; int16_t exponentLength = expLen;
/* Validate the assumptions regarding the input arguments */ /* Validate the assumptions regarding the input arguments */
if (exponentLength < 0) if (exponentLength < 0)
@ -758,10 +758,10 @@ inline std::string Rinex_Printer::doub2sci(const double& d,
inline std::string& Rinex_Printer::sci2for(std::string& aStr, inline std::string& Rinex_Printer::sci2for(std::string& aStr,
const std::string::size_type startPos, std::string::size_type startPos,
const std::string::size_type length, std::string::size_type length,
const std::string::size_type expLen, std::string::size_type expLen,
const bool checkSwitch) bool checkSwitch) const
{ {
std::string::size_type idx = aStr.find('.', startPos); std::string::size_type idx = aStr.find('.', startPos);
int expAdd = 0; int expAdd = 0;
@ -854,7 +854,7 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr,
} // end sci2for } // end sci2for
inline std::string asString(const long double x, const std::string::size_type precision) inline std::string asString(long double x, std::string::size_type precision)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << std::fixed << std::setprecision(precision) << x; ss << std::fixed << std::setprecision(precision) << x;
@ -862,7 +862,7 @@ inline std::string asString(const long double x, const std::string::size_type pr
} }
inline std::string Rinex_Printer::asString(const double x, const std::string::size_type precision) inline std::string Rinex_Printer::asString(double x, std::string::size_type precision) const
{ {
std::ostringstream ss; std::ostringstream ss;
ss << std::fixed << std::setprecision(precision) << x; ss << std::fixed << std::setprecision(precision) << x;
@ -870,7 +870,7 @@ inline std::string Rinex_Printer::asString(const double x, const std::string::si
} }
inline std::string Rinex_Printer::asFixWidthString(const int x, const int width, char fill_digit) inline std::string Rinex_Printer::asFixWidthString(int x, int width, char fill_digit) const
{ {
std::ostringstream ss; std::ostringstream ss;
ss << std::setfill(fill_digit) << std::setw(width) << x; ss << std::setfill(fill_digit) << std::setw(width) << x;
@ -884,7 +884,7 @@ inline int64_t asInt(const std::string& s)
} }
inline int Rinex_Printer::toInt(std::string bitString, int sLength) inline int Rinex_Printer::toInt(const std::string& bitString, int sLength) const
{ {
int tempInt; int tempInt;
int num = 0; int num = 0;
@ -898,7 +898,7 @@ inline int Rinex_Printer::toInt(std::string bitString, int sLength)
template <class X> template <class X>
inline std::string Rinex_Printer::asString(const X x) inline std::string Rinex_Printer::asString(const X x) const
{ {
std::ostringstream ss; std::ostringstream ss;
ss << x; ss << x;

View File

@ -496,8 +496,8 @@ std::string Rtcm::print_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, co
observables_iter != observables.cend(); observables_iter != observables.cend();
observables_iter++) observables_iter++)
{ {
std::string system_(&observables_iter->second.System, 1); const std::string system_(&observables_iter->second.System, 1);
std::string sig_(observables_iter->second.Signal); const std::string sig_(observables_iter->second.Signal);
if ((system_ == "G") && (sig_ == "1C")) if ((system_ == "G") && (sig_ == "1C"))
{ {
observablesL1.insert(std::pair<int32_t, Gnss_Synchro>(observables_iter->first, observables_iter->second)); observablesL1.insert(std::pair<int32_t, Gnss_Synchro>(observables_iter->first, observables_iter->second));
@ -3467,7 +3467,7 @@ uint32_t Rtcm::lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gn
const boost::posix_time::ptime current_time = Rtcm::compute_Galileo_time(eph, obs_time); const boost::posix_time::ptime current_time = Rtcm::compute_Galileo_time(eph, obs_time);
boost::posix_time::ptime last_lock_time; boost::posix_time::ptime last_lock_time;
std::string sig_(gnss_synchro.Signal); const std::string sig_(gnss_synchro.Signal);
if (sig_ == "1B") if (sig_ == "1B")
{ {
last_lock_time = Rtcm::gal_E1_last_lock_time[65 - gnss_synchro.PRN]; last_lock_time = Rtcm::gal_E1_last_lock_time[65 - gnss_synchro.PRN];
@ -3509,7 +3509,7 @@ uint32_t Rtcm::lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, con
const boost::posix_time::ptime current_time = Rtcm::compute_GLONASS_time(eph, obs_time); const boost::posix_time::ptime current_time = Rtcm::compute_GLONASS_time(eph, obs_time);
boost::posix_time::ptime last_lock_time; boost::posix_time::ptime last_lock_time;
std::string sig_(gnss_synchro.Signal); const std::string sig_(gnss_synchro.Signal);
if (sig_ == "1C") if (sig_ == "1C")
{ {
last_lock_time = Rtcm::glo_L1_last_lock_time[65 - gnss_synchro.PRN]; last_lock_time = Rtcm::glo_L1_last_lock_time[65 - gnss_synchro.PRN];
@ -5088,10 +5088,10 @@ int32_t Rtcm::set_DF395(const std::map<int32_t, Gnss_Synchro>& gnss_synchro)
gnss_synchro_iter != gnss_synchro.cend(); gnss_synchro_iter != gnss_synchro.cend();
gnss_synchro_iter++) gnss_synchro_iter++)
{ {
std::string sig_(gnss_synchro_iter->second.Signal); const std::string sig_(gnss_synchro_iter->second.Signal);
sig = sig_.substr(0, 2); sig = sig_.substr(0, 2);
std::string sys(&gnss_synchro_iter->second.System, 1); const std::string sys(&gnss_synchro_iter->second.System, 1);
if ((sig == "1C") && (sys == "G")) if ((sig == "1C") && (sys == "G"))
{ {
@ -5167,10 +5167,10 @@ std::string Rtcm::set_DF396(const std::map<int32_t, Gnss_Synchro>& observables)
{ {
list_of_sats.push_back(observables_iter->second.PRN); list_of_sats.push_back(observables_iter->second.PRN);
std::string sig_(observables_iter->second.Signal); const std::string sig_(observables_iter->second.Signal);
sig = sig_.substr(0, 2); sig = sig_.substr(0, 2);
std::string sys(&observables_iter->second.System, 1); const std::string sys(&observables_iter->second.System, 1);
if ((sig == "1C") && (sys == "G")) if ((sig == "1C") && (sys == "G"))
{ {
@ -5219,9 +5219,9 @@ std::string Rtcm::set_DF396(const std::map<int32_t, Gnss_Synchro>& observables)
observables_iter != observables.cend(); observables_iter != observables.cend();
observables_iter++) observables_iter++)
{ {
std::string sig_(observables_iter->second.Signal); const std::string sig_(observables_iter->second.Signal);
sig = sig_.substr(0, 2); sig = sig_.substr(0, 2);
std::string sys(&observables_iter->second.System, 1); const std::string sys(&observables_iter->second.System, 1);
if ((sig == "1C") && (sys == "G") && (list_of_signals.at(row) == 32 - 2) && (observables_iter->second.PRN == list_of_sats.at(sat))) if ((sig == "1C") && (sys == "G") && (list_of_signals.at(row) == 32 - 2) && (observables_iter->second.PRN == list_of_sats.at(sat)))
{ {

View File

@ -533,7 +533,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{ {
// GPS L1 // GPS L1
// 1 GPS - find the ephemeris for the current GPS SV observation. The SV PRN ID is the map key // 1 GPS - find the ephemeris for the current GPS SV observation. The SV PRN ID is the map key
std::string sig_(gnss_observables_iter->second.Signal); const std::string sig_(gnss_observables_iter->second.Signal);
if (sig_ == "1C") if (sig_ == "1C")
{ {
gps_ephemeris_iter = gps_ephemeris_map.find(gnss_observables_iter->second.PRN); gps_ephemeris_iter = gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -977,7 +977,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
this->set_time_offset_s(rx_position_and_time[3]); this->set_time_offset_s(rx_position_and_time[3]);
DLOG(INFO) << "RTKLIB Position at RX TOW = " << gnss_observables_map.begin()->second.RX_time DLOG(INFO) << "RTKLIB Position at RX TOW = " << gnss_observables_map.cbegin()->second.RX_time
<< " in ECEF (X,Y,Z,t[meters]) = " << rx_position_and_time[0] << ", " << rx_position_and_time[1] << ", " << rx_position_and_time[2] << ", " << rx_position_and_time[4]; << " in ECEF (X,Y,Z,t[meters]) = " << rx_position_and_time[0] << ", " << rx_position_and_time[1] << ", " << rx_position_and_time[2] << ", " << rx_position_and_time[4];
// gtime_t rtklib_utc_time = gpst2utc(pvt_sol.time); // Corrected RX Time (Non integer multiply of 1 ms of granularity) // gtime_t rtklib_utc_time = gpst2utc(pvt_sol.time); // Corrected RX Time (Non integer multiply of 1 ms of granularity)
@ -996,11 +996,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// ######## PVT MONITOR ######### // ######## PVT MONITOR #########
// TOW // TOW
monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms; monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
// WEEK // WEEK
monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009()); monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009());
// PVT GPS time // PVT GPS time
monitor_pvt.RX_time = gnss_observables_map.begin()->second.RX_time; monitor_pvt.RX_time = gnss_observables_map.cbegin()->second.RX_time;
// User clock offset [s] // User clock offset [s]
monitor_pvt.user_clk_offset = rx_position_and_time[3]; monitor_pvt.user_clk_offset = rx_position_and_time[3];
@ -1021,11 +1021,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
monitor_pvt.cov_zx = pvt_sol.qr[5]; monitor_pvt.cov_zx = pvt_sol.qr[5];
// GEO user position Latitude [deg] // GEO user position Latitude [deg]
monitor_pvt.latitude = get_latitude(); monitor_pvt.latitude = this->get_latitude();
// GEO user position Longitude [deg] // GEO user position Longitude [deg]
monitor_pvt.longitude = get_longitude(); monitor_pvt.longitude = this->get_longitude();
// GEO user position Height [m] // GEO user position Height [m]
monitor_pvt.height = get_height(); monitor_pvt.height = this->get_height();
// NUMBER OF VALID SATS // NUMBER OF VALID SATS
monitor_pvt.valid_sats = pvt_sol.ns; monitor_pvt.valid_sats = pvt_sol.ns;
@ -1061,13 +1061,13 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
double tmp_double; double tmp_double;
uint32_t tmp_uint32; uint32_t tmp_uint32;
// TOW // TOW
tmp_uint32 = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms; tmp_uint32 = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t)); d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// WEEK // WEEK
tmp_uint32 = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009()); tmp_uint32 = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009());
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t)); d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// PVT GPS time // PVT GPS time
tmp_double = gnss_observables_map.begin()->second.RX_time; tmp_double = gnss_observables_map.cbegin()->second.RX_time;
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// User clock offset [s] // User clock offset [s]
tmp_double = rx_position_and_time[3]; tmp_double = rx_position_and_time[3];
@ -1102,13 +1102,13 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// GEO user position Latitude [deg] // GEO user position Latitude [deg]
tmp_double = get_latitude(); tmp_double = this->get_latitude();
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// GEO user position Longitude [deg] // GEO user position Longitude [deg]
tmp_double = get_longitude(); tmp_double = this->get_longitude();
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// GEO user position Height [m] // GEO user position Height [m]
tmp_double = get_height(); tmp_double = this->get_height();
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// NUMBER OF VALID SATS // NUMBER OF VALID SATS
@ -1135,5 +1135,5 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
} }
} }
} }
return is_valid_position(); return this->is_valid_position();
} }

View File

@ -71,7 +71,7 @@ public:
return *this; return *this;
} }
inline std::string createProtobuffer(const Monitor_Pvt* monitor) //!< Serialization into a string inline std::string createProtobuffer(const Monitor_Pvt* const monitor) //!< Serialization into a string
{ {
monitor_.Clear(); monitor_.Clear();
@ -111,7 +111,7 @@ public:
return data; return data;
} }
inline Monitor_Pvt readProtobuffer(const gnss_sdr::MonitorPvt& mon) //!< Deserialization inline Monitor_Pvt readProtobuffer(const gnss_sdr::MonitorPvt& mon) const //!< Deserialization
{ {
Monitor_Pvt monitor; Monitor_Pvt monitor;