You are here: Part 2: Core Concepts > Topics > Topics

Topics

Before you can create a Topic, you need a user data type (see Data Types and DDS Data Samples) and a DomainParticipant (DomainParticipants). The user data type must be registered with the DomainParticipant (see 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 1 . For details on using these operations, see the reference section or the API Reference HTML documentation.

Figure 1 Topic Module

Table 1 Topic Operations

Purpose

Operation

Description

Reference

Configuring the Topic

enable

Enables the Topic.

Enabling DDS Entities

get_qos

Gets the Topic’s current QosPolicy settings. This is most often used in preparation for calling set_qos().

Setting Topic QosPolicies

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.

Comparing QoS Values

set_qos_with_
profile

Sets the Topic’s QoS based on a specified QoS profile.

 

get_listener

Gets the currently installed Listener.

Setting Up TopicListeners

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.

Using a Type-Specific DataWriter (FooDataWriter)

Checking Status

get_inconsistent_
topic_status

Allows an application to retrieve a Topic’s INCONSISTENT_TOPIC_STATUS status.

INCONSISTENT_TOPIC 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.

Getting Status and Status Changes

Navigating Relationships

get_name

Gets the topic_name string used to create the Topic.

Creating Topics

get_type_name

Gets the type_name used to create the Topic.

get_participant

Gets the DomainParticipant to which this Topic belongs.

Finding a Topic’s DomainParticipant

© 2015 RTI