From a2d45dbca406ee7bdc17d1da010c509006606dd2 Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 15 Jan 2024 23:34:18 -0800 Subject: [PATCH] [wpiutil] DataLog: Add AddSchema functions to C API (#6232) --- wpiutil/src/main/native/cpp/DataLog.cpp | 14 ++++++++++++++ wpiutil/src/main/native/include/wpi/DataLog.h | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/wpiutil/src/main/native/cpp/DataLog.cpp b/wpiutil/src/main/native/cpp/DataLog.cpp index 40dab2a1b5..af28dbc81c 100644 --- a/wpiutil/src/main/native/cpp/DataLog.cpp +++ b/wpiutil/src/main/native/cpp/DataLog.cpp @@ -1205,4 +1205,18 @@ void WPI_DataLog_AppendStringArray(struct WPI_DataLog* datalog, int entry, timestamp); } +void WPI_DataLog_AddSchemaString(struct WPI_DataLog* datalog, int entry, + const char* name, const char* type, + const char* schema, int64_t timestamp) { + reinterpret_cast(datalog)->AddSchema(name, type, schema, timestamp); +} + +void WPI_DataLog_AddSchema(struct WPI_DataLog* datalog, int entry, + const char* name, const char* type, + const uint8_t* schema, size_t schema_len, + int64_t timestamp) { + reinterpret_cast(datalog)->AddSchema( + name, type, std::span{schema, schema_len}, timestamp); +} + } // extern "C" diff --git a/wpiutil/src/main/native/include/wpi/DataLog.h b/wpiutil/src/main/native/include/wpi/DataLog.h index 2f79a3a17b..35aea0b71b 100644 --- a/wpiutil/src/main/native/include/wpi/DataLog.h +++ b/wpiutil/src/main/native/include/wpi/DataLog.h @@ -1373,6 +1373,15 @@ void WPI_DataLog_AppendStringArray(struct WPI_DataLog* datalog, int entry, const WPI_DataLog_String* arr, size_t len, int64_t timestamp); +void WPI_DataLog_AddSchemaString(struct WPI_DataLog* datalog, int entry, + const char* name, const char* type, + const char* schema, int64_t timestamp); + +void WPI_DataLog_AddSchema(struct WPI_DataLog* datalog, int entry, + const char* name, const char* type, + const uint8_t* schema, size_t schema_len, + int64_t timestamp); + #ifdef __cplusplus } // extern "C" #endif // __cplusplus