Moden C++ DynamicType (i.e TypeCode) serialization and deserialization on 6.0.1

3 posts / 0 new
Last post
Offline
Last seen: 1 month 2 weeks ago
Joined: 03/29/2021
Posts: 12
Moden C++ DynamicType (i.e TypeCode) serialization and deserialization on 6.0.1

Hi,

I want to serialize a DynamicType instance, write the serialized data to file and then later read it from file and deserialize it.

I have read this thread to know how to convert between a C++ DynamicType instance and a C DDS_TypeCode instance: https://community.rti.com/forum-topic/52-moden-c-dynamictype-ie-typecode-serialization

And I also use this example code as a base for my code: http://community.rti.com/filedepot?cid=5&fid=28

I understand the serialization function serialize_TypeCode() in the example code, but I don't understand the deserialize function deserialize_TypeCode().

In serialize_TypeCode()  function, I see a call to RTICdrTypeCode_serialize() to perform serialization. But in deserialize_TypeCode() function, I don't see any call to RTICdrTypeCode_deserialize(). Looks like the function only does a copy from input buffer to output buffer.

Do I need to call  RTICdrTypeCode_deserialize() in deserialize function? And how to call it correctly?

I'm using Connext Pro 6.0.1.

Organization:
Offline
Last seen: 1 month 2 weeks ago
Joined: 02/04/2021
Posts: 8

Hello manhnt22,

 How`s it going now? I have the save problem now....

Offline
Last seen: 1 month 2 weeks ago
Joined: 03/29/2021
Posts: 12

Hi xiezhaoxuan

It was actually mistake in my code when I said the example code didn't work. The example code from RTI does actually work as provided. You don't need to call RTICdrTypeCode_deserialize() function.

Hope this helps.