1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-09-28 07:08:24 +00:00

The Rinex Printer destructor now erases Rinex files if they are empty.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@162 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-02-16 19:17:06 +00:00
parent 2406a7772a
commit 2dd2a22930
2 changed files with 20 additions and 2 deletions

View File

@ -55,8 +55,11 @@ DEFINE_string(RINEX_version, "3.01", "Specifies the RINEX version (2.11 or 3.01)
Rinex_Printer::Rinex_Printer()
{
Rinex_Printer::navFile.open(Rinex_Printer::createFilename("RINEX_FILE_TYPE_GPS_NAV"), std::ios::out | std::ios::app);
Rinex_Printer::obsFile.open(Rinex_Printer::createFilename("RINEX_FILE_TYPE_OBS"), std::ios::out | std::ios::app);
navfilename = Rinex_Printer::createFilename("RINEX_FILE_TYPE_GPS_NAV");
obsfilename = Rinex_Printer::createFilename("RINEX_FILE_TYPE_OBS");
Rinex_Printer::navFile.open(navfilename, std::ios::out | std::ios::app);
Rinex_Printer::obsFile.open(obsfilename, std::ios::out | std::ios::app);
satelliteSystem["GPS"] = "G";
satelliteSystem["GLONASS"] = "R";
@ -153,8 +156,20 @@ Rinex_Printer::Rinex_Printer()
Rinex_Printer::~Rinex_Printer()
{
// close RINEX files
long posn, poso;
posn = navFile.tellp();
poso = obsFile.tellp();
Rinex_Printer::navFile.close();
Rinex_Printer::obsFile.close();
// If nothing written, erase the files.
if (posn == 0)
{
remove(navfilename.c_str());
}
if (poso == 0)
{
remove(obsfilename.c_str());
}
}

View File

@ -148,6 +148,9 @@ private:
*/
std::string createFilename(std::string type);
std::string navfilename;
std::string obsfilename;
/*
* Generates the data for the PGM / RUN BY / DATE line
*/