public abstract class DataEncoding extends Object implements Serializable
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
DataEncoding.Builder<T extends DataEncoding.Builder<T>> |
| Modifier and Type | Field and Description |
|---|---|
protected Algorithm |
fromBinaryTransformAlgorithm |
protected int |
sizeInBits
size in bits if known.
|
| Modifier and Type | Method and Description |
|---|---|
abstract DataEncoding |
copy()
Create a shallow copy of the data encoding
|
ByteOrder |
getByteOrder() |
Set<Parameter> |
getDependentParameters() |
Algorithm |
getFromBinaryTransformAlgorithm() |
int |
getSizeInBits()
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) |
abstract DataEncoding.Builder<?> |
toBuilder() |
protected int sizeInBits
protected Algorithm fromBinaryTransformAlgorithm
public int getSizeInBits()
StringDataEncoding the size may be variable (depending on the data to be
encoded). In this cases it returns -1.public void setSizeInBits(int sizeInBits)
public ByteOrder getByteOrder()
public abstract Object parseString(String stringValue)
public Algorithm getFromBinaryTransformAlgorithm()
public void setFromBinaryTransformAlgorithm(Algorithm fromBinaryTransformAlgorithm)
public abstract DataEncoding copy()
public abstract DataEncoding.Builder<?> toBuilder()
Copyright © 2020 Space Applications Services. All rights reserved.