Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <stdio.h>
00034 #include <stdarg.h>
00035
00036 #include <mrpt_rawlog_record/rawlog_record.h>
00037 #include <mrpt_rawlog_record/rawlog_record_defaults.h>
00038 #include <mrpt/system/string_utils.h>
00039 #include <mrpt/system/filesystem.h>
00040
00041 RawlogRecord::~RawlogRecord()
00042 {
00043 MRPT_TODO("RawlogRecord writes the rawlog only on exit (Ctrl-C)");
00044
00045 log_info("writing dataset to disk...");
00046 log_info("pRawLog entries %i", pRawLog.size());
00047 log_info("pRawLogASF entries %i", pRawLogASF.size());
00048 if (pRawLog.size() > 0)
00049 {
00050 const std::string filename =
00051 base_param_.raw_log_folder + "/" + base_param_.raw_log_name;
00052 log_info("write %s", filename.c_str());
00053 if (!pRawLog.saveToRawLogFile(filename))
00054 {
00055 log_error("Error writing to %s", filename.c_str());
00056 }
00057 }
00058 if (pRawLogASF.size() > 0)
00059 {
00060 const std::string filename =
00061 base_param_.raw_log_folder + "/" + base_param_.raw_log_name_asf;
00062 log_info("write %s", filename.c_str());
00063 if (!pRawLogASF.saveToRawLogFile(filename))
00064 {
00065 log_error("Error writing to %s", filename.c_str());
00066 }
00067 }
00068 }
00069
00070 void RawlogRecord::updateRawLogName(const mrpt::system::TTimeStamp& t)
00071 {
00072 const auto prefix = mrpt::system::dateTimeLocalToString(t);
00073
00074 base_param_.raw_log_name = mrpt::system::fileNameStripInvalidChars(
00075 prefix + base_param_.raw_log_name);
00076 base_param_.raw_log_name_asf = mrpt::system::fileNameStripInvalidChars(
00077 prefix + base_param_.raw_log_name_asf);
00078 }