12#include <initializer_list>
133 explicit DataLog(std::function<
void(std::span<const uint8_t> data)>
write,
149 std::function<
void(std::span<const uint8_t> data)>
write,
216 std::span<const uint8_t> schema, int64_t timestamp = 0);
237 std::span<const uint8_t>{
238 reinterpret_cast<const uint8_t*
>(schema.data()), schema.size()},
250 template <ProtobufSerializable T>
252 if (timestamp == 0) {
256 [
this](
auto typeString) {
return HasSchema(typeString); },
257 [
this, timestamp](
auto typeString,
auto schema) {
258 AddSchema(typeString,
"proto:FileDescriptorProto", schema, timestamp);
270 template <
typename T,
typename... I>
273 if (timestamp == 0) {
276 ForEachStructSchema<T>(
277 [
this, timestamp](
auto typeString,
auto schema) {
278 this->
AddSchema(typeString,
"structschema", schema, timestamp);
306 void Finish(
int entry, int64_t timestamp = 0);
324 void AppendRaw(
int entry, std::span<const uint8_t> data, int64_t timestamp);
333 void AppendRaw2(
int entry, std::span<
const std::span<const uint8_t>> data,
472 struct WriterThreadState;
474 void StartLogFile(WriterThreadState&
state);
476 void WriterThreadMain(
477 std::function<
void(std::span<const uint8_t> data)>
write);
482 uint8_t* StartRecord(uint32_t entry, uint64_t timestamp, uint32_t payloadSize,
484 uint8_t* Reserve(
size_t size);
485 void AppendImpl(std::span<const uint8_t> data);
493 bool m_doFlush{
false};
494 bool m_shutdown{
false};
502 std::string m_extraHeader;
503 std::string m_newFilename;
505 std::vector<Buffer> m_free;
506 std::vector<Buffer> m_outgoing;
509 std::vector<uint8_t> schemaData;
514 std::string metadata;
519 std::thread m_thread;
549 explicit operator bool()
const {
return m_log !=
nullptr; }
584 int64_t timestamp = 0)
596 void Append(std::span<const uint8_t> data, int64_t timestamp = 0) {
597 m_log->AppendRaw(m_entry, data, timestamp);
621 void Append(
bool value, int64_t timestamp = 0) {
622 m_log->AppendBoolean(m_entry, value, timestamp);
646 void Append(int64_t value, int64_t timestamp = 0) {
647 m_log->AppendInteger(m_entry, value, timestamp);
662 int64_t timestamp = 0)
671 void Append(
float value, int64_t timestamp = 0) {
672 m_log->AppendFloat(m_entry, value, timestamp);
687 int64_t timestamp = 0)
696 void Append(
double value, int64_t timestamp = 0) {
697 m_log->AppendDouble(m_entry, value, timestamp);
706 static constexpr const char* kDataType =
"string";
712 int64_t timestamp = 0)
725 m_log->AppendString(m_entry, value, timestamp);
734 static constexpr const char* kDataType =
"boolean[]";
738 int64_t timestamp = 0)
751 void Append(std::span<const bool> arr, int64_t timestamp = 0) {
752 m_log->AppendBooleanArray(m_entry, arr, timestamp);
761 void Append(std::initializer_list<bool> arr, int64_t timestamp = 0) {
762 Append(std::span{arr.begin(), arr.end()}, timestamp);
771 void Append(std::span<const int> arr, int64_t timestamp = 0) {
772 m_log->AppendBooleanArray(m_entry, arr, timestamp);
781 void Append(std::initializer_list<int> arr, int64_t timestamp = 0) {
782 Append(std::span{arr.begin(), arr.end()}, timestamp);
791 void Append(std::span<const uint8_t> arr, int64_t timestamp = 0) {
792 m_log->AppendBooleanArray(m_entry, arr, timestamp);
801 static constexpr const char* kDataType =
"int64[]";
805 int64_t timestamp = 0)
817 void Append(std::span<const int64_t> arr, int64_t timestamp = 0) {
818 m_log->AppendIntegerArray(m_entry, arr, timestamp);
827 void Append(std::initializer_list<int64_t> arr, int64_t timestamp = 0) {
828 Append({arr.begin(), arr.end()}, timestamp);
837 static constexpr const char* kDataType =
"float[]";
852 void Append(std::span<const float> arr, int64_t timestamp = 0) {
853 m_log->AppendFloatArray(m_entry, arr, timestamp);
862 void Append(std::initializer_list<float> arr, int64_t timestamp = 0) {
863 Append({arr.begin(), arr.end()}, timestamp);
872 static constexpr const char* kDataType =
"double[]";
876 int64_t timestamp = 0)
888 void Append(std::span<const double> arr, int64_t timestamp = 0) {
889 m_log->AppendDoubleArray(m_entry, arr, timestamp);
898 void Append(std::initializer_list<double> arr, int64_t timestamp = 0) {
899 Append({arr.begin(), arr.end()}, timestamp);
908 static constexpr const char* kDataType =
"string[]";
912 int64_t timestamp = 0)
924 void Append(std::span<const std::string> arr, int64_t timestamp = 0) {
925 m_log->AppendStringArray(m_entry, arr, timestamp);
934 void Append(std::span<const std::string_view> arr, int64_t timestamp = 0) {
935 m_log->AppendStringArray(m_entry, arr, timestamp);
944 void Append(std::initializer_list<std::string_view> arr,
945 int64_t timestamp = 0) {
946 Append(std::span<const std::string_view>{arr.begin(), arr.end()},
954template <
typename T,
typename... I>
962 int64_t timestamp = 0)
965 I... info, int64_t timestamp = 0)
966 : m_info{
std::move(info)...} {
968 log.AddStructSchema<T, I...>(info..., timestamp);
978 void Append(
const T& data, int64_t timestamp = 0) {
979 if constexpr (
sizeof...(I) == 0) {
981 uint8_t buf[S::GetSize()];
983 m_log->AppendRaw(m_entry, buf, timestamp);
989 std::apply([&](
const I&... info) { S::Pack(buf, data, info...); }, m_info);
990 m_log->AppendRaw(m_entry, buf, timestamp);
994 [[no_unique_address]] std::tuple<I...> m_info;
1000template <
typename T,
typename... I>
1008 int64_t timestamp = 0)
1012 int64_t timestamp = 0)
1013 : m_info{
std::move(info)...} {
1015 log.AddStructSchema<T, I...>(info..., timestamp);
1016 m_entry =
log.Start(
1017 name, MakeStructArrayTypeString<T, std::dynamic_extent>(info...),
1018 metadata, timestamp);
1027 template <
typename U>
1028#if __cpp_lib_ranges >= 201911L
1029 requires std::ranges::range<U> &&
1030 std::convertible_to<std::ranges::range_value_t<U>, T>
1032 void Append(U&& data, int64_t timestamp = 0) {
1034 [&](
const I&... info) {
1036 std::forward<U>(data),
1037 [&](
auto bytes) { m_log->AppendRaw(m_entry,
bytes, timestamp); },
1049 void Append(std::span<const T> data, int64_t timestamp = 0) {
1051 [&](
const I&... info) {
1054 [&](
auto bytes) { m_log->AppendRaw(m_entry,
bytes, timestamp); },
1062 [[no_unique_address]] std::tuple<I...> m_info;
1068template <ProtobufSerializable T>
1079 log.AddProtobufSchema<T>(m_msg, timestamp);
1080 m_entry =
log.Start(
name, m_msg.GetTypeString(), metadata, timestamp);
1089 void Append(
const T& data, int64_t timestamp = 0) {
1092 std::scoped_lock lock{m_mutex};
1093 m_msg.Pack(buf, data);
1095 m_log->AppendRaw(m_entry, buf, timestamp);
1123 double period,
const char* extraHeader);
1138 void (*
write)(
void*
ptr,
const uint8_t* data,
size_t len),
void*
ptr,
1139 double period,
const char* extraHeader);
1206 const char*
type,
const char* metadata,
1228 const char* metadata, int64_t timestamp);
1240 const uint8_t* data,
size_t len, int64_t timestamp);
1251 int value, int64_t timestamp);
1262 int64_t value, int64_t timestamp);
1273 float value, int64_t timestamp);
1284 double value, int64_t timestamp);
1296 const char* value,
size_t len, int64_t timestamp);
1308 const int* arr,
size_t len,
1321 const uint8_t* arr,
size_t len,
1334 const int64_t* arr,
size_t len,
1347 const float* arr,
size_t len,
1360 const double* arr,
size_t len,
1377 const char*
type,
const char* schema,
1381 const char*
type,
const uint8_t* schema,
1382 size_t schema_len, int64_t timestamp);
void WPI_DataLog_AppendInteger(struct WPI_DataLog *datalog, int entry, int64_t value, int64_t timestamp)
Appends an integer record to the log.
void WPI_DataLog_SetMetadata(struct WPI_DataLog *datalog, int entry, const char *metadata, int64_t timestamp)
Updates the metadata for an entry.
void WPI_DataLog_AppendBoolean(struct WPI_DataLog *datalog, int entry, int value, int64_t timestamp)
Appends a boolean record to the log.
void WPI_DataLog_AppendDoubleArray(struct WPI_DataLog *datalog, int entry, const double *arr, size_t len, int64_t timestamp)
Appends a double array record to the log.
void WPI_DataLog_Stop(struct WPI_DataLog *datalog)
Stops appending all records to the log, and closes the log file.
struct WPI_DataLog * WPI_DataLog_Create(const char *dir, const char *filename, double period, const char *extraHeader)
Construct a new Data Log.
void WPI_DataLog_AppendRaw(struct WPI_DataLog *datalog, int entry, const uint8_t *data, size_t len, int64_t timestamp)
Appends a raw record to the log.
void WPI_DataLog_Resume(struct WPI_DataLog *datalog)
Resumes appending of data records to the log.
struct WPI_DataLog * WPI_DataLog_Create_Func(void(*write)(void *ptr, const uint8_t *data, size_t len), void *ptr, double period, const char *extraHeader)
Construct a new Data Log that passes its output to the provided function rather than a file.
void WPI_DataLog_AppendBooleanArrayByte(struct WPI_DataLog *datalog, int entry, const uint8_t *arr, size_t len, int64_t timestamp)
Appends a boolean array record to the log.
void WPI_DataLog_SetFilename(struct WPI_DataLog *datalog, const char *filename)
Change log filename.
void WPI_DataLog_Pause(struct WPI_DataLog *datalog)
Pauses appending of data records to the log.
void WPI_DataLog_AppendString(struct WPI_DataLog *datalog, int entry, const char *value, size_t len, int64_t timestamp)
Appends a string record to the log.
void WPI_DataLog_Finish(struct WPI_DataLog *datalog, int entry, int64_t timestamp)
Finish an entry.
void WPI_DataLog_AppendDouble(struct WPI_DataLog *datalog, int entry, double value, int64_t timestamp)
Appends a double record to the log.
void WPI_DataLog_Release(struct WPI_DataLog *datalog)
Releases a data log object.
void WPI_DataLog_AppendBooleanArray(struct WPI_DataLog *datalog, int entry, const int *arr, size_t len, int64_t timestamp)
Appends a boolean array record to the log.
void WPI_DataLog_AddSchemaString(struct WPI_DataLog *datalog, const char *name, const char *type, const char *schema, int64_t timestamp)
void WPI_DataLog_Flush(struct WPI_DataLog *datalog)
Explicitly flushes the log data to disk.
void WPI_DataLog_AddSchema(struct WPI_DataLog *datalog, const char *name, const char *type, const uint8_t *schema, size_t schema_len, int64_t timestamp)
void WPI_DataLog_AppendStringArray(struct WPI_DataLog *datalog, int entry, const WPI_DataLog_String *arr, size_t len, int64_t timestamp)
Appends a string array record to the log.
void WPI_DataLog_AppendFloatArray(struct WPI_DataLog *datalog, int entry, const float *arr, size_t len, int64_t timestamp)
Appends a float array record to the log.
void WPI_DataLog_AppendIntegerArray(struct WPI_DataLog *datalog, int entry, const int64_t *arr, size_t len, int64_t timestamp)
Appends an integer array record to the log.
void WPI_DataLog_AppendFloat(struct WPI_DataLog *datalog, int entry, float value, int64_t timestamp)
Appends a float record to the log.
int WPI_DataLog_Start(struct WPI_DataLog *datalog, const char *name, const char *type, const char *metadata, int64_t timestamp)
Start an entry.
This file defines the DenseMap class.
This file defines the SmallVector class.
This file defines the StringMap class.
Definition: format.h:4134
Owning wrapper (ala std::unique_ptr) for google::protobuf::Message* that does not require the protobu...
Definition: Protobuf.h:158
void ForEachProtobufDescriptor(function_ref< bool(std::string_view filename)> exists, function_ref< void(std::string_view filename, std::span< const uint8_t > descriptor)> fn)
Loops over all protobuf descriptors including nested/referenced descriptors.
Definition: Protobuf.h:248
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1202
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
Definition: SmallVector.h:647
Log array of boolean values.
Definition: DataLog.h:732
void Append(std::span< const uint8_t > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:791
void Append(std::initializer_list< bool > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:761
BooleanArrayLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:737
void Append(std::initializer_list< int > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:781
void Append(std::span< const int > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:771
void Append(std::span< const bool > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:751
BooleanArrayLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:740
BooleanArrayLogEntry()=default
Log boolean values.
Definition: DataLog.h:604
BooleanLogEntry()=default
BooleanLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:611
void Append(bool value, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:621
BooleanLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:609
Log entry base class.
Definition: DataLog.h:525
DataLogEntry(DataLogEntry &&rhs)
Definition: DataLog.h:536
DataLogEntry(const DataLogEntry &)=delete
void Finish(int64_t timestamp=0)
Finishes the entry.
Definition: DataLog.h:566
DataLog * m_log
Definition: DataLog.h:569
DataLogEntry(DataLog &log, std::string_view name, std::string_view type, std::string_view metadata={}, int64_t timestamp=0)
Definition: DataLog.h:528
DataLogEntry & operator=(const DataLogEntry &)=delete
int m_entry
Definition: DataLog.h:570
DataLogEntry & operator=(DataLogEntry &&rhs)
Definition: DataLog.h:539
void SetMetadata(std::string_view metadata, int64_t timestamp=0)
Updates the metadata for the entry.
Definition: DataLog.h:557
A data log.
Definition: DataLog.h:90
void AppendBooleanArray(int entry, std::span< const bool > arr, int64_t timestamp)
Appends a boolean array record to the log.
void Stop()
Stops appending all records to the log, and closes the log file.
void AppendBooleanArray(int entry, std::span< const int > arr, int64_t timestamp)
Appends a boolean array record to the log.
void SetMetadata(int entry, std::string_view metadata, int64_t timestamp=0)
Updates the metadata for an entry.
void AppendStringArray(int entry, std::span< const std::string > arr, int64_t timestamp)
Appends a string array record to the log.
int Start(std::string_view name, std::string_view type, std::string_view metadata={}, int64_t timestamp=0)
Start an entry.
DataLog & operator=(const DataLog &)=delete
DataLog(std::string_view dir="", std::string_view filename="", double period=0.25, std::string_view extraHeader="")
Construct a new Data Log.
void Flush()
Explicitly flushes the log data to disk.
void AppendRaw(int entry, std::span< const uint8_t > data, int64_t timestamp)
Appends a raw record to the log.
void AppendIntegerArray(int entry, std::span< const int64_t > arr, int64_t timestamp)
Appends an integer array record to the log.
void AddStructSchema(const I &... info, int64_t timestamp=0)
Registers a struct schema.
Definition: DataLog.h:272
DataLog(const DataLog &)=delete
void AddSchema(std::string_view name, std::string_view type, std::string_view schema, int64_t timestamp=0)
Registers a data schema.
Definition: DataLog.h:233
void AppendBooleanArray(int entry, std::span< const uint8_t > arr, int64_t timestamp)
Appends a boolean array record to the log.
void AppendDouble(int entry, double value, int64_t timestamp)
Appends a double record to the log.
void AppendFloat(int entry, float value, int64_t timestamp)
Appends a float record to the log.
DataLog & operator=(const DataLog &&)=delete
void AppendFloatArray(int entry, std::span< const float > arr, int64_t timestamp)
Appends a float array record to the log.
DataLog(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 AppendStringArray(int entry, std::span< const WPI_DataLog_String > arr, int64_t timestamp)
Appends a string array record to the log.
void AppendString(int entry, std::string_view value, int64_t timestamp)
Appends a string record to the log.
void AddSchema(std::string_view name, std::string_view type, std::span< const uint8_t > schema, int64_t timestamp=0)
Registers a data schema.
DataLog(wpi::Logger &msglog, std::string_view dir="", std::string_view filename="", double period=0.25, std::string_view extraHeader="")
Construct a new Data Log.
DataLog(DataLog &&)=delete
void Pause()
Pauses appending of data records to the log.
void AppendStringArray(int entry, std::span< const std::string_view > arr, int64_t timestamp)
Appends a string array record to the log.
bool HasSchema(std::string_view name) const
Returns whether there is a data schema already registered with the given name.
void SetFilename(std::string_view filename)
Change log filename.
DataLog(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.
void AppendRaw2(int entry, std::span< const std::span< const uint8_t > > data, int64_t timestamp)
Appends a raw record to the log.
void Finish(int entry, int64_t timestamp=0)
Finish an entry.
void AppendDoubleArray(int entry, std::span< const double > arr, int64_t timestamp)
Appends a double array record to the log.
void Resume()
Resumes appending of data records to the log.
void AppendInteger(int entry, int64_t value, int64_t timestamp)
Appends an integer record to the log.
void AddProtobufSchema(ProtobufMessage< T > &msg, int64_t timestamp=0)
Registers a protobuf schema.
Definition: DataLog.h:251
void AppendBoolean(int entry, bool value, int64_t timestamp)
Appends a boolean record to the log.
Log array of double values.
Definition: DataLog.h:870
DoubleArrayLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:875
void Append(std::span< const double > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:888
void Append(std::initializer_list< double > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:898
DoubleArrayLogEntry()=default
DoubleArrayLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:878
Log double values.
Definition: DataLog.h:679
DoubleLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:686
void Append(double value, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:696
DoubleLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:684
Log array of float values.
Definition: DataLog.h:835
FloatArrayLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:842
void Append(std::span< const float > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:852
void Append(std::initializer_list< float > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:862
FloatArrayLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:840
FloatArrayLogEntry()=default
Log float values.
Definition: DataLog.h:654
FloatLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:659
FloatLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:661
void Append(float value, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:671
Log array of integer values.
Definition: DataLog.h:799
IntegerArrayLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:807
void Append(std::span< const int64_t > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:817
IntegerArrayLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:804
void Append(std::initializer_list< int64_t > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:827
IntegerArrayLogEntry()=default
Log integer values.
Definition: DataLog.h:629
IntegerLogEntry()=default
IntegerLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:636
IntegerLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:634
void Append(int64_t value, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:646
Log protobuf serializable objects.
Definition: DataLog.h:1069
ProtobufLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:1074
void Append(const T &data, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:1089
ProtobufLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:1076
ProtobufLogEntry()=default
Log arbitrary byte data.
Definition: DataLog.h:576
RawLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:583
RawLogEntry(DataLog &log, std::string_view name, std::string_view metadata, std::string_view type, int64_t timestamp=0)
Definition: DataLog.h:586
static constexpr std::string_view kDataType
Definition: DataLog.h:578
void Append(std::span< const uint8_t > data, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:596
RawLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:581
Log array of string values.
Definition: DataLog.h:906
void Append(std::initializer_list< std::string_view > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:944
StringArrayLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:914
void Append(std::span< const std::string > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:924
void Append(std::span< const std::string_view > arr, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:934
StringArrayLogEntry()=default
StringArrayLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:911
Log string values.
Definition: DataLog.h:704
StringLogEntry(DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
Definition: DataLog.h:711
void Append(std::string_view value, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:724
StringLogEntry(DataLog &log, std::string_view name, std::string_view metadata, std::string_view type, int64_t timestamp=0)
Definition: DataLog.h:714
StringLogEntry(DataLog &log, std::string_view name, int64_t timestamp=0)
Definition: DataLog.h:709
Log raw struct serializable array of objects.
Definition: DataLog.h:1002
StructArrayLogEntry(DataLog &log, std::string_view name, I... info, int64_t timestamp=0)
Definition: DataLog.h:1007
void Append(U &&data, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:1032
StructArrayLogEntry()=default
void Append(std::span< const T > data, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:1049
StructArrayLogEntry(DataLog &log, std::string_view name, std::string_view metadata, I... info, int64_t timestamp=0)
Definition: DataLog.h:1010
Log raw struct serializable objects.
Definition: DataLog.h:956
StructLogEntry(DataLog &log, std::string_view name, I... info, int64_t timestamp=0)
Definition: DataLog.h:961
void Append(const T &data, int64_t timestamp=0)
Appends a record to the log.
Definition: DataLog.h:978
StructLogEntry(DataLog &log, std::string_view name, std::string_view metadata, I... info, int64_t timestamp=0)
Definition: DataLog.h:964
Specifies that a type is capable of raw struct serialization and deserialization.
Definition: Struct.h:68
basic_string_view< char > string_view
Definition: core.h:501
dimensionless::scalar_t log(const ScalarUnit x) noexcept
Compute natural logarithm.
Definition: math.h:349
auto write(OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
Definition: chrono.h:419
constexpr auto count() -> size_t
Definition: core.h:1203
state
Definition: core.h:2271
type
Definition: core.h:556
State
Possible state of a SysId routine.
Definition: SysIdRoutineLog.h:25
constexpr const char * name(const T &)
std::string GetTypeString(const google::protobuf::Message &msg)
ControlRecordType
Definition: DataLog.h:55
@ kControlFinish
Definition: DataLog.h:57
@ kControlStart
Definition: DataLog.h:56
@ kControlSetMetadata
Definition: DataLog.h:58
Definition: ntcore_cpp.h:31
Definition: ntcore_cpp.h:26
constexpr bool is_constexpr(Lambda)
Definition: type_traits.h:81
uint64_t Now()
Return a value representing the current time in microseconds.
A datalog string (for use with string array).
Definition: DataLog.h:37
size_t len
Length.
Definition: DataLog.h:42
const char * str
Contents.
Definition: DataLog.h:39
Protobuf serialization template.
Definition: Protobuf.h:37
Struct serialization template.
Definition: Struct.h:38
::std::condition_variable condition_variable
Definition: condition_variable.h:16
::std::mutex mutex
Definition: mutex.h:17