[ntcoreffi] Switch ntcoreffi DLM to WPI_String (#7359)

We forgot to do this originally.
This commit is contained in:
Thad House
2024-11-07 14:19:37 -08:00
committed by GitHub
parent a66fa339dc
commit fd2e0c0427
3 changed files with 15 additions and 10 deletions

View File

@@ -119,6 +119,7 @@ task cppHeadersZip(type: Zip) {
}
}
build.dependsOn cppHeadersZip
addTaskToCopyAllOutputs(cppHeadersZip)
model {

View File

@@ -551,24 +551,28 @@ void DataLogManager::SignalNewDSDataOccur() {
extern "C" {
void DLM_Start(const char* dir, const char* filename, double period) {
DataLogManager::Start(dir, filename, period);
void DLM_Start(const struct WPI_String* dir, const struct WPI_String* filename,
double period) {
DataLogManager::Start(wpi::to_string_view(dir), wpi::to_string_view(filename),
period);
}
void DLM_Stop(void) {
DataLogManager::Stop();
}
void DLM_Log(const char* message) {
DataLogManager::Log(message);
void DLM_Log(const struct WPI_String* message) {
DataLogManager::Log(wpi::to_string_view(message));
}
WPI_DataLog* DLM_GetLog(void) {
return reinterpret_cast<WPI_DataLog*>(&DataLogManager::GetLog());
}
const char* DLM_GetLogDir(void) {
return DataLogManager::GetLogDir().data();
void DLM_GetLogDir(struct WPI_String* value) {
auto logDir = DataLogManager::GetLogDir();
char* write = WPI_AllocateString(value, logDir.size());
std::memcpy(write, logDir.data(), logDir.size());
}
void DLM_LogNetworkTables(int enabled) {

View File

@@ -118,7 +118,7 @@ struct WPI_DataLog;
* @param period time between automatic flushes to disk, in seconds;
* this is a time/storage tradeoff
*/
void DLM_Start(const char* dir, const char* filename, double period);
void DLM_Start(const struct WPI_String* dir, const struct WPI_String* filename, double period);
/**
* Stop data log manager.
@@ -131,7 +131,7 @@ void DLM_Stop(void);
*
* @param message message
*/
void DLM_Log(const char* message);
void DLM_Log(const struct WPI_String* message);
/**
* Get the managed data log (for custom logging). Starts the data log manager
@@ -144,9 +144,9 @@ WPI_DataLog* DLM_GetLog(void);
/**
* Get the log directory.
*
* @return log directory
* @param value returned value (output)
*/
const char* DLM_GetLogDir(void);
void DLM_GetLogDir(struct WPI_String* value);
/**
* Enable or disable logging of NetworkTables data. Note that unlike the