FateLoggable

fun interface FateLoggable

An object that knows how to publish itself into a FateTable.

Implement this for a type that is several values. Call sites log one object, and the type decides what appears under it:

class DriveState(val left: Double, val right: Double, val pose: Pose) : FateLoggable {
override fun logTo(table: FateTable) {
table.log("left", left)
table.log("right", right)
table.log("pose", pose)
}
}

Fate.log("drive", driveState) // Drive state lands under drive/left, drive/right, drive/pose

Logging a loggable is a series of separate writes, not one atomic snapshot. A reader can see some fields from this loop and some from the last. If the fields must agree, copy them into an immutable object first.

Functions

Link copied to clipboard
abstract fun logTo(table: FateTable)

Writes this object's values into table, which is the child table named by the caller.