Class MatrixStruct<R extends Num,C extends Num>

java.lang.Object
edu.wpi.first.math.struct.MatrixStruct<R,C>
All Implemented Interfaces:
Struct<Matrix<R,C>>

public final class MatrixStruct<R extends Num,C extends Num> extends Object implements Struct<Matrix<R,C>>
  • Constructor Details

    • MatrixStruct

      public MatrixStruct(Nat<R> rows, Nat<C> cols)
      Constructs the Struct implementation.
      Parameters:
      rows - The number of rows of the matrices this serializer processes.
      cols - The number of cols of the matrices this serializer processes.
  • Method Details

    • getTypeClass

      public Class<Matrix<R,C>> getTypeClass()
      Description copied from interface: Struct
      Gets the Class object for the stored value.
      Specified by:
      getTypeClass in interface Struct<R extends Num>
      Returns:
      Class
    • getTypeName

      public String getTypeName()
      Description copied from interface: Struct
      Gets the type name (e.g. for schemas of other structs). This should be globally unique among structs.
      Specified by:
      getTypeName in interface Struct<R extends Num>
      Returns:
      type name
    • getSize

      public int getSize()
      Description copied from interface: Struct
      Gets the serialized size (in bytes). This should always be a constant.
      Specified by:
      getSize in interface Struct<R extends Num>
      Returns:
      serialized size
    • getSchema

      public String getSchema()
      Description copied from interface: Struct
      Gets the schema.
      Specified by:
      getSchema in interface Struct<R extends Num>
      Returns:
      schema
    • unpack

      public Matrix<R,C> unpack(ByteBuffer bb)
      Description copied from interface: Struct
      Deserializes an object from a raw struct serialized ByteBuffer starting at the current position. Will increment the ByteBuffer position by getStructSize() bytes. Will not otherwise modify the ByteBuffer (e.g. byte order will not be changed).
      Specified by:
      unpack in interface Struct<R extends Num>
      Parameters:
      bb - ByteBuffer
      Returns:
      New object
    • pack

      public void pack(ByteBuffer bb, Matrix<R,C> value)
      Description copied from interface: Struct
      Puts object contents to a ByteBuffer starting at the current position. Will increment the ByteBuffer position by getStructSize() bytes. Will not otherwise modify the ByteBuffer (e.g. byte order will not be changed).
      Specified by:
      pack in interface Struct<R extends Num>
      Parameters:
      bb - ByteBuffer
      value - object to serialize