Package edu.wpi.first.hal
Class HALValue
java.lang.Object
edu.wpi.first.hal.HALValue
Represents a HAL entry value.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic HALValue
fromNative
(int type, long value1, double value2) Build a HAL value from its native components.boolean
Get the value as a boolean.double
Get the value as a double.long
getLong()
Get the value as a long.double
Get the native double value.long
Get the native long value.int
getType()
Get the type of the value.static HALValue
makeBoolean
(boolean value) Build a HAL boolean value.static HALValue
makeDouble
(double value) Build a HAL double value.static HALValue
makeEnum
(int value) Build a HAL enum value.static HALValue
makeInt
(int value) Build a HAL integer value.static HALValue
makeLong
(long value) Build a HAL long value.static HALValue
Build a HAL unassigned value.
-
Field Details
-
kUnassigned
Unassigned type.- See Also:
-
kBoolean
Boolean.- See Also:
-
kDouble
Double.- See Also:
-
kEnum
Enum.- See Also:
-
kInt
Int.- See Also:
-
kLong
Long.- See Also:
-
-
Method Details
-
getType
Get the type of the value.- Returns:
- Type (e.g. kBoolean).
-
getBoolean
Get the value as a boolean. Does not perform type checking.- Returns:
- value contents
-
getLong
Get the value as a long. Does not perform type checking.- Returns:
- value contents
-
getDouble
Get the value as a double. Does not perform type checking.- Returns:
- value contents
-
getNativeLong
Get the native long value. Does not perform type checking.- Returns:
- value contents
-
getNativeDouble
Get the native double value. Does not perform type checking.- Returns:
- value contents
-
makeBoolean
Build a HAL boolean value.- Parameters:
value
- value- Returns:
- HAL value
-
makeEnum
Build a HAL enum value.- Parameters:
value
- value- Returns:
- HAL value
-
makeInt
Build a HAL integer value.- Parameters:
value
- value- Returns:
- HAL value
-
makeLong
Build a HAL long value.- Parameters:
value
- value- Returns:
- HAL value
-
makeDouble
Build a HAL double value.- Parameters:
value
- value- Returns:
- HAL value
-
makeUnassigned
Build a HAL unassigned value.- Returns:
- HAL value
-
fromNative
Build a HAL value from its native components.- Parameters:
type
- typevalue1
- long value (all except double)value2
- double value (for double only)- Returns:
- HAL value
-