Class StructFieldDescriptor
java.lang.Object
org.wpilib.util.struct.StructFieldDescriptor
Raw struct dynamic field descriptor.
-
Method Summary
Modifier and TypeMethodDescriptionintGets the array size.longGets the bit mask for the field.intGets the bit shift for the field (LSB=0).intGets the bit width of the field, in bits.Gets the enumerated values.longGets the maximum signed integer value that can be stored in this field.longGets the minimum signed integer value that can be stored in this field.getName()Gets the field name.intGets the storage offset of the field, in bytes.Gets the dynamic struct this field is contained in.intgetSize()Gets the underlying storage size of the field, in bytes.Gets the struct descriptor for a struct data type.getType()Gets the field type.longGets the maximum unsigned integer value that can be stored in this field.longGets the minimum unsigned integer value that can be stored in this field.booleanhasEnum()Returns whether the field has enumerated values.booleanisArray()Returns whether the field is an array.booleanReturns whether the field is a bitfield.booleanisInt()Returns whether the field type is a signed integer.booleanisUint()Returns whether the field type is an unsigned integer.
-
Method Details
-
getParent
Gets the dynamic struct this field is contained in.- Returns:
- struct descriptor
-
getName
-
getType
-
isInt
public boolean isInt()Returns whether the field type is a signed integer.- Returns:
- true if signed integer, false otherwise
-
isUint
public boolean isUint()Returns whether the field type is an unsigned integer.- Returns:
- true if unsigned integer, false otherwise
-
getSize
public int getSize()Gets the underlying storage size of the field, in bytes.- Returns:
- number of bytes
-
getOffset
public int getOffset()Gets the storage offset of the field, in bytes.- Returns:
- number of bytes from the start of the struct
-
getBitWidth
public int getBitWidth()Gets the bit width of the field, in bits.- Returns:
- number of bits
-
getBitMask
public long getBitMask()Gets the bit mask for the field. The mask is always the least significant bits (it is not shifted).- Returns:
- bit mask
-
getBitShift
public int getBitShift()Gets the bit shift for the field (LSB=0).- Returns:
- number of bits
-
isArray
public boolean isArray()Returns whether the field is an array.- Returns:
- true if array
-
getArraySize
public int getArraySize()Gets the array size. Returns 1 if non-array.- Returns:
- number of elements
-
hasEnum
public boolean hasEnum()Returns whether the field has enumerated values.- Returns:
- true if there are enumerated values
-
getEnumValues
-
getStruct
Gets the struct descriptor for a struct data type.- Returns:
- struct descriptor; returns null for non-struct
-
getUintMin
public long getUintMin()Gets the minimum unsigned integer value that can be stored in this field.- Returns:
- minimum value
-
getUintMax
public long getUintMax()Gets the maximum unsigned integer value that can be stored in this field. Note this is not the actual maximum for uint64 (due to Java lacking support for 64-bit unsigned integers).- Returns:
- maximum value
-
getIntMin
public long getIntMin()Gets the minimum signed integer value that can be stored in this field.- Returns:
- minimum value
-
getIntMax
public long getIntMax()Gets the maximum signed integer value that can be stored in this field.- Returns:
- maximum value
-
isBitField
public boolean isBitField()Returns whether the field is a bitfield.- Returns:
- true if bitfield
-