From 01490fc77b3543f80c47252d4bb1f44eb0573006 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Fri, 19 May 2023 00:56:21 -0400 Subject: [PATCH] [wpiutil] DataLog: Add documentation for append methods (NFC) (#5348) --- .../edu/wpi/first/util/datalog/DataLog.java | 76 +++++++++++- wpiutil/src/main/native/include/wpi/DataLog.h | 111 +++++++++++++++++- 2 files changed, 180 insertions(+), 7 deletions(-) diff --git a/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java b/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java index 784b8d659f..7fd8636cad 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java @@ -188,10 +188,10 @@ public final class DataLog implements AutoCloseable { } /** - * Appends a record to the log. + * Appends a raw record to the log. * - * @param entry Entry index, as returned by Start() - * @param data Data to record + * @param entry Entry index, as returned by start() + * @param data Byte array to record * @param timestamp Time stamp (0 to indicate now) */ public void appendRaw(int entry, byte[] data, long timestamp) { @@ -204,42 +204,112 @@ public final class DataLog implements AutoCloseable { m_impl = 0; } + /** + * Appends a boolean record to the log. + * + * @param entry Entry index, as returned by start() + * @param value Boolean value to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendBoolean(int entry, boolean value, long timestamp) { DataLogJNI.appendBoolean(m_impl, entry, value, timestamp); } + /** + * Appends an integer record to the log. + * + * @param entry Entry index, as returned by start() + * @param value Integer value to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendInteger(int entry, long value, long timestamp) { DataLogJNI.appendInteger(m_impl, entry, value, timestamp); } + /** + * Appends a float record to the log. + * + * @param entry Entry index, as returned by start() + * @param value Float value to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendFloat(int entry, float value, long timestamp) { DataLogJNI.appendFloat(m_impl, entry, value, timestamp); } + /** + * Appends a double record to the log. + * + * @param entry Entry index, as returned by start() + * @param value Double value to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendDouble(int entry, double value, long timestamp) { DataLogJNI.appendDouble(m_impl, entry, value, timestamp); } + /** + * Appends a string record to the log. + * + * @param entry Entry index, as returned by start() + * @param value String value to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendString(int entry, String value, long timestamp) { DataLogJNI.appendString(m_impl, entry, value, timestamp); } + /** + * Appends a boolean array record to the log. + * + * @param entry Entry index, as returned by start() + * @param arr Boolean array to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendBooleanArray(int entry, boolean[] arr, long timestamp) { DataLogJNI.appendBooleanArray(m_impl, entry, arr, timestamp); } + /** + * Appends an integer array record to the log. + * + * @param entry Entry index, as returned by start() + * @param arr Integer array to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendIntegerArray(int entry, long[] arr, long timestamp) { DataLogJNI.appendIntegerArray(m_impl, entry, arr, timestamp); } + /** + * Appends a float array record to the log. + * + * @param entry Entry index, as returned by start() + * @param arr Float array to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendFloatArray(int entry, float[] arr, long timestamp) { DataLogJNI.appendFloatArray(m_impl, entry, arr, timestamp); } + /** + * Appends a double array record to the log. + * + * @param entry Entry index, as returned by start() + * @param arr Double array to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendDoubleArray(int entry, double[] arr, long timestamp) { DataLogJNI.appendDoubleArray(m_impl, entry, arr, timestamp); } + /** + * Appends a string array record to the log. + * + * @param entry Entry index, as returned by start() + * @param arr String array to record + * @param timestamp Time stamp (0 to indicate now) + */ public void appendStringArray(int entry, String[] arr, long timestamp) { DataLogJNI.appendStringArray(m_impl, entry, arr, timestamp); } diff --git a/wpiutil/src/main/native/include/wpi/DataLog.h b/wpiutil/src/main/native/include/wpi/DataLog.h index cac273cdb6..5dfddfd025 100644 --- a/wpiutil/src/main/native/include/wpi/DataLog.h +++ b/wpiutil/src/main/native/include/wpi/DataLog.h @@ -190,43 +190,146 @@ class DataLog final { void SetMetadata(int entry, std::string_view metadata, int64_t timestamp = 0); /** - * Appends a record to the log. + * Appends a raw record to the log. * * @param entry Entry index, as returned by Start() - * @param data Data to record + * @param data Byte array to record * @param timestamp Time stamp (may be 0 to indicate now) */ void AppendRaw(int entry, std::span data, int64_t timestamp); /** - * Appends a record to the log. + * Appends a raw record to the log. * * @param entry Entry index, as returned by Start() - * @param data Data to record + * @param data Byte array to record * @param timestamp Time stamp (may be 0 to indicate now) */ void AppendRaw2(int entry, std::span> data, int64_t timestamp); + /** + * Appends a boolean record to the log. + * + * @param entry Entry index, as returned by Start() + * @param value Boolean value to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendBoolean(int entry, bool value, int64_t timestamp); + + /** + * Appends an integer record to the log. + * + * @param entry Entry index, as returned by Start() + * @param value Integer value to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendInteger(int entry, int64_t value, int64_t timestamp); + + /** + * Appends a float record to the log. + * + * @param entry Entry index, as returned by Start() + * @param value Float value to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendFloat(int entry, float value, int64_t timestamp); + + /** + * Appends a double record to the log. + * + * @param entry Entry index, as returned by Start() + * @param value Double value to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendDouble(int entry, double value, int64_t timestamp); + + /** + * Appends a string record to the log. + * + * @param entry Entry index, as returned by Start() + * @param value String value to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendString(int entry, std::string_view value, int64_t timestamp); + + /** + * Appends a boolean array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr Boolean array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendBooleanArray(int entry, std::span arr, int64_t timestamp); + + /** + * Appends a boolean array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr Boolean array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendBooleanArray(int entry, std::span arr, int64_t timestamp); + + /** + * Appends a boolean array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr Boolean array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendBooleanArray(int entry, std::span arr, int64_t timestamp); + + /** + * Appends an integer array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr Integer array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendIntegerArray(int entry, std::span arr, int64_t timestamp); + + /** + * Appends a float array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr Float array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendFloatArray(int entry, std::span arr, int64_t timestamp); + + /** + * Appends a double array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr Double array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendDoubleArray(int entry, std::span arr, int64_t timestamp); + + /** + * Appends a string array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr String array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendStringArray(int entry, std::span arr, int64_t timestamp); + + /** + * Appends a string array record to the log. + * + * @param entry Entry index, as returned by Start() + * @param arr String array to record + * @param timestamp Time stamp (may be 0 to indicate now) + */ void AppendStringArray(int entry, std::span arr, int64_t timestamp);