Introduction
The DDL (Data Definition Language) was introduced with the software ADTF (Automotive Data- and Time-Triggered Framework).
The intension was to have a common dynamic description for byte positions and value types for any structured data and memory blocks. Since the software was designed for C++ applications the DDL is similar to it and uses there data types by default.
Example
DDL description for data of following struct:
struct MyData
{
uint8_t value_1;
uint16_t value_2;
uint8_t value_3;
uint32_t value_3;
};
Description in DDL 4.1 as is (in XML):
- use of default alignments and byteorders
- use of default byteorder "little endianess"
<struct name="MyData12Byte" alignment="4">
<element name="value_1" type="uint8_t">
<serialized bytepos="0" byteorder="LE"/>
<deserialzed alignment="1"/>
</element>
<element name="value_2" type="uint16_t">
<serialized bytepos="1" byteorder="LE"/>
<deserialzed alignment="2"/>
</element>
<element name="value_3" type="uint8_t">
<serialized bytepos="3" byteorder="LE"/>
<deserialzed alignment="1"/>
</element>
<element name="value_4" type="uint32_t">
<serialized bytepos="4" byteorder="LE"/>
<deserialzed alignment="4"/>
</element>
</struct>
<table>
<tr>
<td colspan="12"><b>deserialized representation</b>(12 bytes in memory)</td>
</tr>
<tr>
<td>byte 0</td>
<td>byte 1</td>
<td>byte 2</td>
<td>byte 3</td>
<td>byte 4</td>
<td>byte 5</td>
<td>byte 6</td>
<td>byte 7</td>
<td>byte 8</td>
<td>byte 9</td>
<td>byte 10</td>
<td>byte 11</td>
</tr>
<tr>
<td colspan="1">uint8_t value_1</td>
<td colspan="1">(padding)</td>
<td colspan="2">uint16_t value_2</td>
<td colspan="1">uint8_t value_3</td>
<td colspan="3">(padding)</td>
<td colspan="4">uint32_t value_4</td>
</tr>
</table>
<table>
<tr>
<td colspan="8"><b>serialized representation</b> (8 bytes in network or file)</td>
</tr>
<tr>
<td>byte 0</td>
<td>byte 1</td>
<td>byte 2</td>
<td>byte 3</td>
<td>byte 4</td>
<td>byte 5</td>
<td>byte 6</td>
<td>byte 7</td>
</tr>
<tr>
<td colspan="1">uint8_t value_1</td>
<td colspan="2">uint16_t value_2</td>
<td colspan="1">uint8_t value_3</td>
<td colspan="4">uint32_t value_4</td>
</tr>
</table>
The DDL Library
To facilitate the handling of DDL hierarchies there is a datamodel provided (ddl::dd::datamodel::DataDefinition). This datamodel is validated by a ddl::dd::DataDefinition which keeps the datamodel clean and well-formed.
The datamodel itself and its specification is described within DDL - XML Datamodel specification.
Use the datamodel to handle the model by yourself. We recommend to use following DataDefinition creation API.
DataDefinition creation API
There are 3 ways to create a valid DataDefinition.
Create a file or read it
Create a string or read it
Create a DataDefinition via DDStructure or "type reflection"
Binary model classes