Package org.yamcs.xtce
Class DataEncoding
- java.lang.Object
-
- org.yamcs.xtce.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataEncoding.Builder<T extends DataEncoding.Builder<T>>
-
Field Summary
Fields Modifier and Type Field Description protected AlgorithmfromBinaryTransformAlgorithmprotected intsizeInBitssize in bits if known.protected AlgorithmtoBinaryTransformAlgorithm
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract DataEncodingcopy()Create a shallow copy of the data encodingByteOrdergetByteOrder()Set<Parameter>getDependentParameters()AlgorithmgetFromBinaryTransformAlgorithm()intgetSizeInBits()Returns the size in bits of data encoded according to this encoding.AlgorithmgetToBinaryTransformAlgorithm()abstract ObjectparseString(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)voidsetFromBinaryTransformAlgorithm(Algorithm fromBinaryTransformAlgorithm)voidsetSizeInBits(int sizeInBits)voidsetToBinaryTransformAlgorithm(Algorithm toBinaryTransformAlgorithm)abstract DataEncoding.Builder<?>toBuilder()
-
-
-
Method Detail
-
getSizeInBits
public int getSizeInBits()
Returns the size in bits of data encoded according to this encoding. For some encodings likeStringDataEncodingthe 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)
-
copy
public abstract DataEncoding copy()
Create a shallow copy of the data encoding- Returns:
-
toBuilder
public abstract DataEncoding.Builder<?> toBuilder()
-
-