1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Code uniformization

This commit is contained in:
Carles Fernandez 2019-07-26 15:48:29 +02:00
parent 7017132b8f
commit 712d9ff06b
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -117,6 +117,44 @@ Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag
} }
} }
Rtklib_Solver::~Rtklib_Solver()
{
if (d_dump_file.is_open() == true)
{
auto pos = d_dump_file.tellp();
try
{
d_dump_file.close();
}
catch (const std::exception &ex)
{
LOG(WARNING) << "Exception in destructor closing the RTKLIB dump file " << ex.what();
}
if (pos == 0)
{
errorlib::error_code ec;
if (!fs::remove(fs::path(d_dump_filename), ec))
{
std::cerr << "Problem removing temporary file " << d_dump_filename << '\n';
}
d_flag_dump_mat_enabled = false;
}
}
if (d_flag_dump_mat_enabled)
{
try
{
save_matfile();
}
catch (const std::exception &ex)
{
LOG(WARNING) << "Exception in destructor saving the PVT .mat dump file " << ex.what();
}
}
}
bool Rtklib_Solver::save_matfile() bool Rtklib_Solver::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
@ -356,43 +394,6 @@ bool Rtklib_Solver::save_matfile()
} }
Rtklib_Solver::~Rtklib_Solver()
{
if (d_dump_file.is_open() == true)
{
auto pos = d_dump_file.tellp();
try
{
d_dump_file.close();
}
catch (const std::exception &ex)
{
LOG(WARNING) << "Exception in destructor closing the RTKLIB dump file " << ex.what();
}
if (pos == 0)
{
errorlib::error_code ec;
if (!fs::remove(fs::path(d_dump_filename), ec))
{
std::cerr << "Problem removing temporary file " << d_dump_filename << '\n';
}
d_flag_dump_mat_enabled = false;
}
}
if (d_flag_dump_mat_enabled)
{
try
{
save_matfile();
}
catch (const std::exception &ex)
{
LOG(WARNING) << "Exception in destructor saving the PVT .mat dump file " << ex.what();
}
}
}
double Rtklib_Solver::get_gdop() const double Rtklib_Solver::get_gdop() const
{ {
return dop_[0]; return dop_[0];