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 class
DataEncoding.Builder<T extends DataEncoding.Builder<T>>
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionabstract DataEncoding
copy()
Create a shallow copy of the data encodingint
Returns the size in bits of data encoded according to this encoding.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)void
setFromBinaryTransformAlgorithm
(Algorithm fromBinaryTransformAlgorithm) void
setSizeInBits
(int sizeInBits) void
setToBinaryTransformAlgorithm
(Algorithm toBinaryTransformAlgorithm) abstract DataEncoding.Builder<?>
-
Field Details
-
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 likeStringDataEncoding
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
-
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
-
copy
Create a shallow copy of the data encoding- Returns:
-
toBuilder
-