commonMain.com.divpundir.mavlink.api.MavEnumValue.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-jvm Show documentation
Show all versions of api-jvm Show documentation
A modern MAVLink library for the JVM written in Kotlin.
package com.divpundir.mavlink.api
/**
* Wrapper class for a [MavEnum].
*/
public class MavEnumValue private constructor(public val entry: E?, public val value: UInt) {
public companion object {
public fun of(entry: E): MavEnumValue = MavEnumValue(entry, entry.value)
public fun fromValue(value: UInt): MavEnumValue = MavEnumValue(null, value)
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as MavEnumValue<*>
return value == other.value
}
override fun hashCode(): Int = value.hashCode()
override fun toString(): String = "MavEnumValue(entry=$entry, value=$value)"
}