<<ext>> The Dynamic Data API provides a way to interact with arbitrarily complex data types at runtime without the need for code generation.
This API allows you to define new data types, modify existing data types, and interact reflectively with samples. To use it, you will take the following steps:
1. Obtain a DDS_TypeCode (see DDSTypeCodeModule) that defines the type definition you want to use.
A DDS_TypeCode includes a type's kind (DDS.TCKind), name, and members (that is, fields). You can create your own DDS_TypeCode using the DDS_TypeCodeFactory class -- see, for example, the DDS_TypeCodeFactory.create_struct_tc method. Alternatively, you can use a remote DDS_TypeCode that you discovered on the network (see DDSBuiltInTopicModule) or one generated by DDSNddsgenModule.
2. Wrap the DDS_TypeCode in a DDS.DynamicDataTypeSupport object.
See the constructor DDSDynamicDataTypeSupport::DDSDynamicDataTypeSupport. This object lets you connect the type definition to a DDS.DomainParticipant and manage data samples (of type DDS_DynamicData).
3. Register the DDS.DynamicDataTypeSupport with one or more domain participants.
See DDS.DynamicDataTypeSupport.register_type. This action associates the data type with a logical name that you can use to create topics. (Starting with this step, working with a dynamically defined data type is almost exactly the same as working with a generated one.)
4. Create a DDS.Topic from the DDS.DomainParticipant.
Use the name under which you registered your data type -- see DDS.DomainParticipant.create_topic. This DDS.Topic is what you will use to produce and consume data.
5. Create a DDS.DynamicDataWriter and/or DDS.DynamicDataReader.
These objects will produce and/or consume data (of type DDS_DynamicData) on the DDS.Topic. You can create these objects directly from the DDS.DomainParticipant -- see DDS.DomainParticipant.create_datawriter and DDS.DomainParticipant.create_datareader -- or by first creating intermediate DDS.Publisher and DDS.Subscriber objects -- see DDS.DomainParticipant.create_publisher and DDS.DomainParticipant.create_subscriber.
6. Write and/or read the data of interest.
7. Tear down the objects described above.
You should delete them in the reverse order in which you created them. Note that unregistering your data type with the DDS.DomainParticipant is optional; all types are automatically unregistered when the DDS.DomainParticipant itself is deleted.