< Previous | Next >

Lesson 5: Add a domain participant for your topicStruct

A domain participant is a component element that indicates that the component contains elements that are related to Data Distribution Service for Real-Time Systems (DDS). In this lesson, you generate an IDL file based on the definition of your MyTopicStruct topicStruct element. Then, you generate code for it, and create a library that stores the functions that are extracted from the IDL file. That library can be used by future applications that might want to share data that is based on the MyTopicStruct topicStruct element.
  1. Right-click the TopicsPkg package and select Add New > DDS > domainParticipant.
  2. Open the Features window for the domain participant element and enter the following information:
    1. On the General tab, enter the following information:
      1. Name the domain participant element MyTopicStructLib
      2. In the Directory field, enter MyTopicStructLib
      3. In the Type area, select Library
    2. On the Scope tab, select TopicsPkg, and then click OK
  3. Set the target environment:
    1. In the Configurations category under the MyTopicStructLib domain participant, open the Features window for the DefaultConfig configuration
    2. On the Settings tab, select the MSVC9 or Linux environment, and then click OK
  4. Generate code: Select Code > Generate > DefaultConfig. If you are asked if you want to create a directory, click Yes. One of the generated files is DDSMyTopicStructLib.idl. To see the file, in the browser, right-click the MyTopicStruct topicStruct and select Edit topic Struct.
  5. If you selected Edit topic Struct in the previous step, click in the browser before continuing with the next step.
  6. If you are using the RTI DDS implementation, then before building the application, verify that the RTI installation process created an environment variable called NDDSHOME that points to the directory named ndds.4.5d. (The makefiles generated by Rational® Rhapsody®use this variable to locate the required header files.)
  7. Build the library: Select Code > Build > Build MyTopicStrucLib.lib. Part of the build process is the IDL generation of source files from the DDSMyTopicStructLib.idl file. These files support the registration of your MyTopicStruct topicStruct element and the definition of dataWriters and dataReaders in the future.
    Note: If you are using the RTI DDS implementation, and during the build process you get the message "rtiddsgen is not recognized as an internal or external command", it means that the RTI installation process did not add the directory containing rtiddsgen.bat to your Path environment variable. Add the directory containing rtiddsgen.bat to the Path variable and run the build command again.
  8. For the purpose of this tutorial, in the Components category, delete the DefaultComponent element from your project: Right-click DefaultComponent and select Delete from Model, as shown in the following figure. Confirm the deletion.

Lesson checkpoint

In this lesson, you learned how to create a domain participant for your MyTopicStruct topicStruct element.
In the next lesson, you will create publisher and dataWriter entities.
< Previous | Next >

Feedback