52 std::string_view filename =
"",
54 std::string_view extraHeader =
"");
69 std::string_view dir =
"",
70 std::string_view filename =
"",
72 std::string_view extraHeader =
"");
86 std::function<
void(std::span<const uint8_t> data)> write,
87 double period = 0.25, std::string_view extraHeader =
"");
103 std::function<
void(std::span<const uint8_t> data)> write,
104 double period = 0.25, std::string_view extraHeader =
"");
145 struct WriterThreadState;
147 void BufferHalfFull() final;
148 bool BufferFull() final;
150 void StartLogFile(WriterThreadState& state);
152 void WriterThreadMain(
153 std::function<
void(
std::span<const uint8_t> data)> write);
155 mutable
wpi::
util::mutex m_mutex;
156 wpi::
util::condition_variable m_cond;
157 bool m_doFlush{
false};
158 bool m_shutdown{
false};
166 std::string m_newFilename;
167 std::thread m_thread;
basic_string_view< char > string_view
Definition base.h:620
DataLogBackgroundWriter(std::string_view dir="", std::string_view filename="", double period=0.25, std::string_view extraHeader="")
Construct a new Data Log.
void Flush() final
Explicitly flushes the log data to disk.
void Resume() final
Resumes appending of data records to the log.
DataLogBackgroundWriter(wpi::util::Logger &msglog, std::function< void(std::span< const uint8_t > data)> write, double period=0.25, std::string_view extraHeader="")
Construct a new Data Log that passes its output to the provided function rather than a file.
DataLogBackgroundWriter(std::function< void(std::span< const uint8_t > data)> write, double period=0.25, std::string_view extraHeader="")
Construct a new Data Log that passes its output to the provided function rather than a file.
void Pause() final
Pauses appending of data records to the log.
void Stop() final
Stops appending all records to the log, and closes the log file.
~DataLogBackgroundWriter() final
DataLogBackgroundWriter(wpi::util::Logger &msglog, std::string_view dir="", std::string_view filename="", double period=0.25, std::string_view extraHeader="")
Construct a new Data Log.
void SetFilename(std::string_view filename)
Change log filename.
DataLog(const DataLog &)=delete
Definition StringMap.hpp:773
Definition DataLogReader.hpp:17
Definition raw_os_ostream.hpp:19
Definition CvSource.hpp:15