Skip to content

Commit

Permalink
[wpiutil] DataLog: Add AddSchema functions to C API (wpilibsuite#6232)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse authored Jan 16, 2024
1 parent 30965b2 commit a2d45db
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions wpiutil/src/main/native/cpp/DataLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*>(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*>(datalog)->AddSchema(
name, type, std::span<const uint8_t>{schema, schema_len}, timestamp);
}

} // extern "C"
9 changes: 9 additions & 0 deletions wpiutil/src/main/native/include/wpi/DataLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a2d45db

Please sign in to comment.