18.1 Topics
Before you can create a Topic, you need a user data type (see Chapter 17 Data Types and DDS Data Samples) and a DomainParticipant (16.3 DomainParticipants). The user data type must be registered with the DomainParticipant (see 17.2.8 Type Codes for Built-in Types).
Once you have created a Topic, what do you do with it? Topics are primarily used as parameters in other Entities’ operations. For instance, a Topic is required when a Publisher or Subscriber creates a DataWriter or DataReader, respectively. Topics do have a few operations of their own, as listed in Table 18.1 Topic Operations. For details on using these operations, see the reference section or the API Reference HTML documentation.
Figure 18.1: Topic Module
Purpose |
Operation |
Description |
Reference |
Configuring the Topic |
enable |
Enables the Topic. |
|
get_qos |
Gets the Topic’s current QosPolicy settings. This is most often used in preparation for calling set_qos(). |
||
set_qos |
Sets the Topic’s QoS. You can use this operation to change the values for the Topic’s QosPolicies. Note, however, that not all QosPolicies can be changed after the Topic has been created. |
||
equals |
Compares two Topic’s QoS structures for equality. |
||
set_qos_with_ |
Sets the Topic’s QoS based on a specified QoS profile. |
|
|
get_listener |
Gets the currently installed Listener. |
||
set_listener |
Sets the Topic’s Listener. If you create the Topic without a Listener, you can use this operation to add one later. Setting the listener to NULL will remove the listener from the Topic. |
||
narrow |
A type-safe way to cast a pointer. This takes a DDSTopicDescription pointer and ‘narrows’ it to a DDSTopic pointer. |
||
Checking Status |
get_inconsistent_ |
Allows an application to retrieve a Topic’s INCONSISTENT_TOPIC_STATUS status. |
|
get_status_changes |
Gets a list of statuses that have changed since the last time the application read the status or the listeners were called. |
||
Navigating Relationships |
get_name |
Gets the topic_name string used to create the Topic. |
|
get_type_name |
Gets the type_name used to create the Topic. |
||
get_participant |
Gets the DomainParticipant to which this Topic belongs. |