... | ... | @@ -29,21 +29,31 @@ TODO make c++ code for data types available. |
|
|
|
|
|
A `DataType` structure itself is serializable to (and from) JSON. Here are some examples for every `DataType`.
|
|
|
|
|
|
### Basic Types
|
|
|
|
|
|
```json
|
|
|
# Basic Types
|
|
|
{
|
|
|
"type": "basic",
|
|
|
"base_type": "Q"
|
|
|
}
|
|
|
# Or
|
|
|
```
|
|
|
|
|
|
Or
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"type": "basic",
|
|
|
"base_type": "VEC2"
|
|
|
}
|
|
|
# ...
|
|
|
```
|
|
|
|
|
|
...
|
|
|
|
|
|
# Vector type
|
|
|
# Here 'base_type' can be any type
|
|
|
### Vector type
|
|
|
|
|
|
Here 'base_type' can be any type.
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"type": "vector",
|
|
|
"size": 10,
|
... | ... | @@ -52,9 +62,13 @@ A `DataType` structure itself is serializable to (and from) JSON. Here are some |
|
|
"base_type": "Q"
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
### Matrix type
|
|
|
|
|
|
Here 'base_type' can be any type
|
|
|
|
|
|
# Matrix type
|
|
|
# Here 'base_type' can be any type
|
|
|
```json
|
|
|
{
|
|
|
"type": "matrix",
|
|
|
"rows": 3,
|
... | ... | @@ -64,15 +78,22 @@ A `DataType` structure itself is serializable to (and from) JSON. Here are some |
|
|
"base_type": "Q"
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
### Enum type
|
|
|
|
|
|
# Enum type
|
|
|
```json
|
|
|
{
|
|
|
"type": "enum",
|
|
|
"variants": ["SOMETHING", "OTHER_VARIANT", "THIRD_VARIANT"]
|
|
|
}
|
|
|
```
|
|
|
|
|
|
### Struct Type
|
|
|
|
|
|
# Struct Type
|
|
|
# The fields objects contains the name of a field as key and its corresponding DataType as value
|
|
|
The fields objects contains the name of a field as key and its corresponding DataType as value
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"type": "struct",
|
|
|
"name": "MyStruct",
|
... | ... | @@ -87,9 +108,13 @@ A `DataType` structure itself is serializable to (and from) JSON. Here are some |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
# SimplePacketType
|
|
|
# Here 'payloadType' can be any type
|
|
|
### SimplePacketType
|
|
|
|
|
|
Here 'payloadType' can be any type
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"type": "simple_packet",
|
|
|
"payloadType": {
|
... | ... | @@ -115,7 +140,7 @@ Note that all binary numbers are written in *Network Byte Order* (Big-endian/MSB |
|
|
| `BasicType`: `EMPTY` | `null` | nothing? | nothing | |
|
|
|
| `BasicType`: `VEC2` | [`Vec2` class](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/commons/-/blob/master/src/main/java/de/rwth/montisim/commons/utils/Vec2.java) | Array with 2 numbers | 2 doubles | |
|
|
|
| `BasicType`: `VEC3` | [`Vec3` class](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/commons/-/blob/master/src/main/java/de/rwth/montisim/commons/utils/Vec3.java) | Array with 3 numbers | 3 doubles | |
|
|
|
| `VectorType` | An Object array (`Object[]`) | JSON Array | A short (2 bytes) with the number elements followed by these elements. | |
|
|
|
| `VectorType` | An Object array (`Object[]`) | JSON Array **where the first element is the size of the vector** followed by the elements. | A short (2 bytes) with the number elements followed by these elements. | |
|
|
|
| `MatrixType` | A two way Object array (`Object[rows][columns]`) | JSON Array of JSON arrays (row-major) | Row-major storage | (Row-major: rows are contiguous in memory)|
|
|
|
| `EnumType` | `String` with variant name | Variant name | `byte`: index of the variant (TODO implement?) | |
|
|
|
| `StructType` | Object array (`Object[]`) with fields in declaration order | JSON array with fields in declaration order. | Fields in declaration order. | |
|
... | ... | |