Deserializing DDS data without DDS methods

3 posts / 0 new
Last post
Last seen: 1 year 1 month ago
Joined: 09/14/2022
Posts: 4
Deserializing DDS data without DDS methods


I have implemented a software that deserializes data buffers, given the buffer and a dictionary (XML file with a propietary schema) to interpret the buffer.

Example of imaginary schema:

<message name="UserRequestsMessage">
    <member name="user_id" bits="32" word="0" startbit="31" type="int32"/>
    <array name="user_requests" length="16">
        <struct name="user_request" type="UserRequest">
            <member name="product" bits="32"  word="1" startbit="31" range="1 @ 16" type="int32"/>
            <member name="type" bits="32" word="2" startbit="31" range="0 @ 1" type="ProductTypeEnum"/>
            <member name="reserved" bits="16" word="3"  startbit="31"/>
            <member name="price" bits="16" word="3"  startbit="15" range="0 @ 10000" type="float"/>

As you can see in the example, my format accepts primitive types, enums, structs, arrays, ... It is similar to DDS datatypes, except the format does not have keywords like optional or mutable, or maps.

With my software, I am capable of interpreting data buffers serialized in my own format. Now, I want to deserialize buffers serialized with DDS.

I have already used the method to_cdr_buffer to obtain the serialized buffer of a DDS type, and my aim is to deserialize it using my program and a dictionary. The dictionary would be generated transforming the XML (the one that uses the DDS schema) that defines the type to my own XML format (with XLST or python). I believe that this is possible if I take into account the serialization procedure of DDS (Link to specification) while translating the DDS XML.

Some drawbacks and constraints:

- My format is a subset of DDS, so I won't be able to traslate every data type to mine (unless I adapt my format to include those features)

- I must not couple my software to DDS.

Am I missing something? Is the thing I want to implement possible?




EDIT 1: Included how am I going to translate one XML format to another


Howard's picture
Last seen: 11 hours 55 min ago
Joined: 11/29/2012
Posts: 584

It's a bit of coding/work, but sure it's possible.  The DDS specifications are open and available.  As long as you implement your deserialization according to the XCDR1 or XCDR2 (for newer versions of DDS), it should work.

Last seen: 1 year 1 month ago
Joined: 09/14/2022
Posts: 4

Noted, thanks Howard!