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);
157 bool m_doFlush{
false};
158 bool m_shutdown{
false};
166 std::string m_newFilename;
167 std::thread m_thread;
A data log background writer that periodically flushes the data log on a background thread.
Definition DataLogBackgroundWriter.h:38
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(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(wpi::Logger &msglog, std::string_view dir="", std::string_view filename="", double period=0.25, std::string_view extraHeader="")
Construct a new Data Log.
DataLogBackgroundWriter(wpi::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() final
void SetFilename(std::string_view filename)
Change log filename.
A data log for high-speed writing of data values.
Definition DataLog.h:70
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
Definition ntcore_cpp.h:31
Foonathan namespace.
Definition ntcore_cpp.h:26
::std::condition_variable condition_variable
Definition condition_variable.h:16
::std::mutex mutex
Definition mutex.h:17