[datalog] Move all DataLog functionality to new datalog library (#7641)

Currently the major DataLog backend API (reading and writing) is split between wpiutil and glass. In the interest of allowing code that wants to use these APIs to not need to link to glass and declutter wpiutil, all of those APIs are moved to a new library named "datalog".

Signed-off-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
This commit is contained in:
DeltaDizzy
2025-02-19 23:08:17 -06:00
committed by GitHub
parent ac1705ae2b
commit da47f06d70
99 changed files with 778 additions and 330 deletions

View File

@@ -7,8 +7,6 @@
#include <jni.h>
#include "edu_wpi_first_util_WPIUtilJNI.h"
#include "wpi/DataLog.h"
#include "wpi/FileLogger.h"
#include "wpi/RawFrame.h"
#include "wpi/RuntimeCheck.h"
#include "wpi/Synchronization.h"
@@ -464,42 +462,4 @@ Java_edu_wpi_first_util_WPIUtilJNI_setRawFrameInfo
f->stride = stride;
f->pixelFormat = pixelFormat;
}
/*
* Class: edu_wpi_first_util_WPIUtilJNI
* Method: createFileLogger
* Signature: (Ljava/lang/String;JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
Java_edu_wpi_first_util_WPIUtilJNI_createFileLogger
(JNIEnv* env, jclass, jstring file, jlong log, jstring key)
{
if (!file) {
wpi::ThrowNullPointerException(env, "file is null");
return 0;
}
auto* f = reinterpret_cast<wpi::log::DataLog*>(log);
if (!f) {
wpi::ThrowNullPointerException(env, "log is null");
return 0;
}
if (!key) {
wpi::ThrowNullPointerException(env, "key is null");
return 0;
}
return reinterpret_cast<jlong>(
new wpi::FileLogger{JStringRef{env, file}, *f, JStringRef{env, key}});
}
/*
* Class: edu_wpi_first_util_WPIUtilJNI
* Method: freeFileLogger
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_util_WPIUtilJNI_freeFileLogger
(JNIEnv* env, jclass, jlong fileTail)
{
delete reinterpret_cast<wpi::FileLogger*>(fileTail);
}
} // extern "C"