T
under the name "My_Type" const char* type_name = "My_Type"; DDS_ReturnCode_t retcode; retcode = FooTypeSupport_register_type(participant, type_name); if (retcode != DDS_RETCODE_OK) { printf("***Error: failed to register type\n"); }
const char* topic_name = "my_topic"; const char* type_type = "My_Type"; /* user data type */ struct DDS_TopicQos topic_qos = DDS_TopicQos_INITIALIZER; DDS_Topic* topic; struct DDS_TopicListener topic_listener = DDS_TopicListener_INITIALIZER; /* MyTopicListener_InconsistentTopic function is user defined to match DDS_TopicListener_InconsistentTopicCallback */ topic_listener.on_inconsistent_topic = MyTopicListener_InconsistentTopic; retcode = DDS_DomainParticipant_get_default_topic_qos(participant, &topic_qos); if (retcode != DDS_RETCODE_OK) { printf("***Error: failed to get default topic qos\n"); } topic = DDS_DomainParticipant_create_topic(participant, topic_name, type_name, &topic_qos, &topic_listener /* or NULL */, DDS_STATUS_MASK_ALL); if (topic == NULL) { printf("***Error: failed to create topic\n"); }
DDS_ReturnCode_t retcode; retcode = DDS_DomainParticipant_delete_topic(participant, topic); if (retcode != DDS_RETCODE_OK) { printf("***Error: failed to delete topic\n"); }