Package edu.wpi.first.util.struct
Class StructDescriptor
java.lang.Object
edu.wpi.first.util.struct.StructDescriptor
Raw struct dynamic struct descriptor.
-
Method Summary
Modifier and TypeMethodDescriptionfindFieldByName
(String name) Gets a field descriptor by name.Gets all field descriptors.getName()
Gets the struct name.Gets the struct schema.int
getSize()
Returns the struct size, in bytes.boolean
isValid()
Returns whether the struct is valid (e.g.
-
Method Details
-
getName
Gets the struct name.- Returns:
- name
-
getSchema
Gets the struct schema.- Returns:
- schema
-
isValid
Returns whether the struct is valid (e.g. the struct is fully defined and field offsets computed).- Returns:
- true if valid
-
getSize
Returns the struct size, in bytes. Not valid unless IsValid() is true.- Returns:
- size in bytes
- Throws:
IllegalStateException
- if descriptor is invalid
-
findFieldByName
Gets a field descriptor by name. Note the field cannot be accessed until the struct is valid.- Parameters:
name
- field name- Returns:
- field descriptor, or nullptr if not found
-
getFields
Gets all field descriptors. Note fields cannot be accessed until the struct is valid.- Returns:
- field descriptors
-