Class DataEncoding

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    BinaryDataEncoding, BooleanDataEncoding, FloatDataEncoding, IntegerDataEncoding, StringDataEncoding

    public abstract class DataEncoding
    extends Object
    implements Serializable
    Describes how a particular piece of data is sent or received from some non-native, off-platform device. (e.g. a spacecraft)

    DIFFERS_FROM_XTCE: XTCE defines known encodings for the usual types (e.g. twosComplement for signed integers) and allows a catch all using a BinaryDataEncoding with a custom algorithm. We consider this approach as flawed and inconsistent: whereas FloatDataEncoding converts from binary to float, IntegerDataEncoding converts from binary to integer, etc, the BinaryDataEncoding would convert from binary to anything and it cannot be known into what by just looking at it. Therefore in Yamcs we allow the catch all custom algorithm for all encodings and the BinaryDataEncoding can only convert from binary to binary.

    See Also:
    Serialized Form
    • Field Detail

      • sizeInBits

        protected int sizeInBits
        size in bits if known. If the size in bits is variable, it should be set to -1.
      • fromBinaryTransformAlgorithm

        protected Algorithm fromBinaryTransformAlgorithm
      • toBinaryTransformAlgorithm

        protected Algorithm toBinaryTransformAlgorithm
    • Method Detail

      • getSizeInBits

        public int getSizeInBits()
        Returns the size in bits of data encoded according to this encoding. For some encodings like StringDataEncoding the size may be variable (depending on the data to be encoded). In this cases it returns -1.
        Returns:
        size in bits or -1 if the size is unknown
      • setSizeInBits

        public void setSizeInBits​(int sizeInBits)
      • getByteOrder

        public ByteOrder getByteOrder()
      • parseString

        public abstract Object parseString​(String stringValue)
        parses the string into a java object of the correct type Has to match the DataEncodingDecoder (so probably it should be moved there somehow: TODO)
      • getFromBinaryTransformAlgorithm

        public Algorithm getFromBinaryTransformAlgorithm()
      • setFromBinaryTransformAlgorithm

        public void setFromBinaryTransformAlgorithm​(Algorithm fromBinaryTransformAlgorithm)
      • getToBinaryTransformAlgorithm

        public Algorithm getToBinaryTransformAlgorithm()
      • setToBinaryTransformAlgorithm

        public void setToBinaryTransformAlgorithm​(Algorithm toBinaryTransformAlgorithm)
      • getDependentParameters

        public Set<Parameter> getDependentParameters()
      • copy

        public abstract DataEncoding copy()
        Create a shallow copy of the data encoding
        Returns: