RTI Connext Java API
Version 5.3.1
|
<<extension>> The Dynamic Data API provides a way to interact with arbitrarily complex data types at runtime without the need for code generation. More...
Classes | |
class | DynamicData |
A sample of any complex data type, which can be inspected and manipulated reflectively. More... | |
class | DynamicDataInfo |
A descriptor for a com.rti.dds.dynamicdata.DynamicData object. More... | |
class | DynamicDataMemberInfo |
A descriptor for a single member (i.e. field) of dynamically defined data type. More... | |
class | DynamicDataProperty_t |
A collection of attributes used to configure com.rti.dds.dynamicdata.DynamicData objects. More... | |
class | DynamicDataReader |
Reads (subscribes to) objects of type com.rti.dds.dynamicdata.DynamicData. More... | |
class | DynamicDataSeq |
An ordered collection of com.rti.dds.dynamicdata.DynamicData elements. More... | |
class | DynamicDataTypeProperty_t |
A collection of attributes used to configure com.rti.dds.dynamicdata.DynamicData objects. More... | |
class | DynamicDataTypeSerializationProperty_t |
Properties that govern how data of a certain type will be serialized on the network. More... | |
class | DynamicDataTypeSupport |
A factory for registering a dynamically defined type and creating com.rti.dds.dynamicdata.DynamicData objects. More... | |
class | DynamicDataWriter |
Writes (publishes) objects of type com.rti.dds.dynamicdata.DynamicData. More... | |
<<extension>> 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 com.rti.dds.typecode.TypeCode (see Type Code Support) that defines the type definition you want to use.
A com.rti.dds.typecode.TypeCode includes a type's kind (com.rti.dds.typecode.TCKind), name, and members (that is, fields). You can create your own com.rti.dds.typecode.TypeCode using the com.rti.dds.typecode.TypeCodeFactory class – see, for example, the com.rti.dds.typecode.TypeCodeFactory.create_struct_tc method. Alternatively, you can use a remote com.rti.dds.typecode.TypeCode that you discovered on the network (see Built-in Topics) or one generated by rtiddsgen.
2. Wrap the com.rti.dds.typecode.TypeCode in a com.rti.dds.dynamicdata.DynamicDataTypeSupport object.
See the constructor com.rti.dds.dynamicdata.DynamicDataTypeSupport.DynamicDataTypeSupport.DynamicDataTypeSupport. This object lets you connect the type definition to a com.rti.dds.domain.DomainParticipant and manage data samples (of type com.rti.dds.dynamicdata.DynamicData).
3. Register the com.rti.dds.dynamicdata.DynamicDataTypeSupport with one or more domain participants.
See com.rti.dds.dynamicdata.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 com.rti.dds.topic.Topic from the com.rti.dds.domain.DomainParticipant.
Use the name under which you registered your data type – see com.rti.dds.domain.DomainParticipant.create_topic. This com.rti.dds.topic.Topic is what you will use to produce and consume data.
5. Create a com.rti.dds.dynamicdata.DynamicDataWriter and/or com.rti.dds.dynamicdata.DynamicDataReader.
These objects will produce and/or consume data (of type com.rti.dds.dynamicdata.DynamicData) on the com.rti.dds.topic.Topic. You can create these objects directly from the com.rti.dds.domain.DomainParticipant – see com.rti.dds.domain.DomainParticipant.create_datawriter and com.rti.dds.domain.DomainParticipant.create_datareader – or by first creating intermediate com.rti.dds.publication.Publisher and com.rti.dds.subscription.Subscriber objects – see com.rti.dds.domain.DomainParticipant.create_publisher and com.rti.dds.domain.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 com.rti.dds.domain.DomainParticipant is optional; all types are automatically unregistered when the com.rti.dds.domain.DomainParticipant itself is deleted.