mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
Delete Telemetry dump files if empty
This commit is contained in:
parent
e9b874dafa
commit
6bdd4305eb
@ -63,6 +63,16 @@ target_link_libraries(telemetry_decoder_gr_blocks
|
|||||||
Matio::matio
|
Matio::matio
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(FILESYSTEM_FOUND)
|
||||||
|
target_compile_definitions(telemetry_decoder_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1)
|
||||||
|
if(find_experimental)
|
||||||
|
target_compile_definitions(telemetry_decoder_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(telemetry_decoder_gr_blocks PRIVATE std::filesystem)
|
||||||
|
else()
|
||||||
|
target_link_libraries(telemetry_decoder_gr_blocks PRIVATE Boost::filesystem Boost::system)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(GNURADIO_USES_STD_POINTERS)
|
if(GNURADIO_USES_STD_POINTERS)
|
||||||
target_compile_definitions(telemetry_decoder_gr_blocks
|
target_compile_definitions(telemetry_decoder_gr_blocks
|
||||||
PUBLIC -DGNURADIO_USES_STD_POINTERS=1
|
PUBLIC -DGNURADIO_USES_STD_POINTERS=1
|
||||||
|
@ -32,12 +32,32 @@
|
|||||||
#include <matio.h> // for Mat_VarCreate
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <cstdlib> // for abs
|
#include <cstdlib> // for abs
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 8
|
#define CRC_ERROR_LIMIT 8
|
||||||
|
|
||||||
|
|
||||||
@ -106,8 +126,10 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
|
|||||||
beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
|
beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "BeiDou B1I Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "BeiDou B1I Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -116,8 +138,16 @@ beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (d_dump)
|
if (d_dump && (pos != 0))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -31,12 +31,32 @@
|
|||||||
#include <matio.h> // for Mat_VarCreate
|
#include <matio.h> // for Mat_VarCreate
|
||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <cstdlib> // for abs
|
#include <cstdlib> // for abs
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 8
|
#define CRC_ERROR_LIMIT 8
|
||||||
|
|
||||||
beidou_b3i_telemetry_decoder_gs_sptr
|
beidou_b3i_telemetry_decoder_gs_sptr
|
||||||
@ -106,8 +126,10 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
|
|||||||
beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
|
beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "BeiDou B3I Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "BeiDou B3I Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -116,8 +138,16 @@ beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (d_dump)
|
if (d_dump && (pos != 0))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -38,11 +38,30 @@
|
|||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for fmod
|
#include <cmath> // for fmod
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <cstdlib> // for abs
|
#include <cstdlib> // for abs
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for make_shared
|
#include <memory> // for make_shared
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 6
|
#define CRC_ERROR_LIMIT 6
|
||||||
|
|
||||||
@ -214,8 +233,10 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
|
|||||||
galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs()
|
galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Galileo Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "Galileo Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -224,9 +245,16 @@ galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (d_dump && (pos != 0))
|
||||||
if (d_dump)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -29,12 +29,32 @@
|
|||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for floor, round
|
#include <cmath> // for floor, round
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <cstdlib> // for abs
|
#include <cstdlib> // for abs
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 6
|
#define CRC_ERROR_LIMIT 6
|
||||||
|
|
||||||
|
|
||||||
@ -99,8 +119,10 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs(
|
|||||||
glonass_l1_ca_telemetry_decoder_gs::~glonass_l1_ca_telemetry_decoder_gs()
|
glonass_l1_ca_telemetry_decoder_gs::~glonass_l1_ca_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Glonass L1 Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "Glonass L1 Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -109,8 +131,16 @@ glonass_l1_ca_telemetry_decoder_gs::~glonass_l1_ca_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (d_dump)
|
if (d_dump && (pos != 0))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -29,12 +29,32 @@
|
|||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for floor, round
|
#include <cmath> // for floor, round
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <cstdlib> // for abs
|
#include <cstdlib> // for abs
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CRC_ERROR_LIMIT 6
|
#define CRC_ERROR_LIMIT 6
|
||||||
|
|
||||||
|
|
||||||
@ -99,8 +119,10 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs(
|
|||||||
glonass_l2_ca_telemetry_decoder_gs::~glonass_l2_ca_telemetry_decoder_gs()
|
glonass_l2_ca_telemetry_decoder_gs::~glonass_l2_ca_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Glonass L2 Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "Glonass L2 Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -109,8 +131,16 @@ glonass_l2_ca_telemetry_decoder_gs::~glonass_l2_ca_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (d_dump)
|
if (d_dump && (pos != 0))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -28,12 +28,32 @@
|
|||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <cmath> // for round
|
#include <cmath> // for round
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <cstring> // for memcpy
|
#include <cstring> // for memcpy
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr
|
#include <memory> // for shared_ptr
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef COMPILER_HAS_ROTL
|
#ifdef COMPILER_HAS_ROTL
|
||||||
#include <bit>
|
#include <bit>
|
||||||
@ -121,8 +141,10 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
|
|||||||
gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs()
|
gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "GPS L1 C/A Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "GPS L1 C/A Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -131,8 +153,16 @@ gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (d_dump)
|
if (d_dump && (pos != 0))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -32,11 +32,30 @@
|
|||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <bitset> // for bitset
|
#include <bitset> // for bitset
|
||||||
#include <cmath> // for round
|
#include <cmath> // for round
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
gps_l2c_telemetry_decoder_gs_sptr
|
gps_l2c_telemetry_decoder_gs_sptr
|
||||||
gps_l2c_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump)
|
gps_l2c_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump)
|
||||||
@ -83,8 +102,10 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs(
|
|||||||
gps_l2c_telemetry_decoder_gs::~gps_l2c_telemetry_decoder_gs()
|
gps_l2c_telemetry_decoder_gs::~gps_l2c_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "GPS L2C Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "GPS L2C Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -93,8 +114,16 @@ gps_l2c_telemetry_decoder_gs::~gps_l2c_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (d_dump)
|
if (d_dump && (pos != 0))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -30,12 +30,31 @@
|
|||||||
#include <pmt/pmt.h> // for make_any
|
#include <pmt/pmt.h> // for make_any
|
||||||
#include <pmt/pmt_sugar.h> // for mp
|
#include <pmt/pmt_sugar.h> // for mp
|
||||||
#include <bitset> // for std::bitset
|
#include <bitset> // for std::bitset
|
||||||
|
#include <cstddef> // for size_t
|
||||||
#include <cstdlib> // for std::llabs
|
#include <cstdlib> // for std::llabs
|
||||||
#include <exception> // for std::exception
|
#include <exception> // for std::exception
|
||||||
#include <iostream> // for std::cout
|
#include <iostream> // for std::cout
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for shared_ptr, make_shared
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#include <system_error>
|
||||||
|
namespace errorlib = std;
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // for remove
|
||||||
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
|
#include <boost/system/error_code.hpp> // for error_code
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace errorlib = boost::system;
|
||||||
|
#endif
|
||||||
|
|
||||||
gps_l5_telemetry_decoder_gs_sptr
|
gps_l5_telemetry_decoder_gs_sptr
|
||||||
gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump)
|
gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump)
|
||||||
@ -78,8 +97,10 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
|
|||||||
gps_l5_telemetry_decoder_gs::~gps_l5_telemetry_decoder_gs()
|
gps_l5_telemetry_decoder_gs::~gps_l5_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "GPS L5 Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
DLOG(INFO) << "GPS L5 Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||||
|
size_t pos = 0;
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
|
pos = d_dump_file.tellp();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
@ -88,8 +109,16 @@ gps_l5_telemetry_decoder_gs::~gps_l5_telemetry_decoder_gs()
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
errorlib::error_code ec;
|
||||||
|
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Error deleting temporary file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (d_dump)
|
if (d_dump && (pos != 0))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user