To create a topic for a built-in type, just use the standard DomainParticipant operations, create_topic() or create_topic_with_profile() (see Creating Topics); for the type_name parameter, use the value returned by the get_type_name() operation, listed below for each API.
Note: In the following examples, you will see the sentinel "<BuiltinType>."
For C and Traditional C++: <BuiltinType> = String, KeyedString, Octets or KeyedOctets
For Java and .NET1RTI Connext DDS .NET language binding is currently supported for C# and C++/CLI.: <BuiltinType> = String, KeyedString, Bytes or KeyedBytes
const char* DDS_<BuiltinType>TypeSupport_get_type_name();
const char* DDS::<BuiltinType>TypeSupport::get_type_name();
const char* DDS<BuiltinType>TypeSupport::get_type_name();
System::String^ DDS:<BuiltinType>TypeSupport::get_type_name();
System.String DDS.<BuiltinType>TypeSupport.get_type_name();
String
com.rti.dds.type.builtin.<BuiltinType>TypeSupport.get_type_name();
(This step is not required in the Modern C++ API)
For simplicity, error handling is not shown in the following examples.
DDS_Topic * topic = NULL; /* Create a builtin type Topic */ topic = DDS_DomainParticipant_create_topic(
participant, "StringTopic",
DDS_StringTypeSupport_get_type_name(),
&DDS_TOPIC_QOS_DEFAULT, NULL, DDS_STATUS_MASK_NONE);
using namespace DDS; ... /* Create a String builtin type Topic */ Topic * topic = participant->create_topic(
"StringTopic", StringTypeSupport::get_type_name(),
DDS_TOPIC_QOS_DEFAULT, NULL, DDS_STATUS_MASK_NONE);
dds::topic::Topic<dds::core::StringTopicType> topic(participant, "StringTopic");
using namespace DDS; ... /* Create a builtin type Topic */ Topic^ topic = participant->create_topic(
"StringTopic", StringTypeSupport::get_type_name(),
DomainParticipant::TOPIC_QOS_DEFAULT,
nullptr, StatusMask::STATUS_MASK_NONE);
using namespace DDS; ... /* Create a builtin type Topic */ Topic topic = participant.create_topic(
"StringTopic", StringTypeSupport.get_type_name(),
DomainParticipant.TOPIC_QOS_DEFAULT,
null, StatusMask.STATUS_MASK_NONE);
import com.rti.dds.type.builtin.*; ... /* Create a builtin type Topic */ Topic topic = participant.create_topic(
"StringTopic", StringTypeSupport.get_type_name(),
DomainParticipant.TOPIC_QOS_DEFAULT,
null, StatusKind.STATUS_MASK_NONE);
© 2015 RTI