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
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDataEncoding.Builder<T extends DataEncoding.Builder<T>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ContextCalibrator>protected Calibratorprotected Algorithmprotected intsize in bits if known.protected Algorithm -
Method Summary
Modifier and TypeMethodDescriptionabstract DataEncodingcopy()Create a shallow copy of the data encodingintReturns the size in bits of data encoded according to this encoding.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)voidsetContextCalibratorList(List<ContextCalibrator> contextCalibratorList) voidsetDefaultCalibrator(Calibrator calibrator) voidsetFromBinaryTransformAlgorithm(Algorithm fromBinaryTransformAlgorithm) voidsetSizeInBits(int sizeInBits) voidsetToBinaryTransformAlgorithm(Algorithm toBinaryTransformAlgorithm) abstract DataEncoding.Builder<?>
-
Field Details
-
defaultCalibrator
-
contextCalibratorList
-
sizeInBits
protected int sizeInBitssize in bits if known. If the size in bits is variable, it should be set to -1. -
fromBinaryTransformAlgorithm
-
toBinaryTransformAlgorithm
-
-
Method Details
-
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
-
parseString
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
-
setFromBinaryTransformAlgorithm
-
getToBinaryTransformAlgorithm
-
setToBinaryTransformAlgorithm
-
getDependentParameters
-
getContextCalibratorList
-
getDefaultCalibrator
-
setDefaultCalibrator
-
setContextCalibratorList
-
copy
Create a shallow copy of the data encoding- Returns:
-
toBuilder
-