participant_ = factory->create_participant(0, pqos); 2. 由participant创建publisher, 创建topic publisher_ = participant_->create_publisher( pubqos, nullptr); topic_ = participant_->create_topic( "HelloWorldTopic", "HelloWorld", tqos); 3. publihser创建writer writer_ = publisher_->create...
participant_ = factory->create_participant(0, pqos); 2. 由participant创建publisher, 创建topic publisher_ = participant_->create_publisher( pubqos, nullptr); topic_ = participant_->create_topic( "HelloWorldTopic", "HelloWorld", tqos); 3. publihser创建writer writer_ = publisher_->create...
//CREATE THE SUBSCRIBER //创建subcribersubscriber_ = participant_->create_subscriber(SUBSCRIBER_QOS_DEFAULT, nullptr); if (subscriber_ == nullptr) { return false; } //CREATE THE TOPIC //创建topic topic_ = participant_->create_topic( "HelloSevenTopic", type_.get_type_name(), TOPIC_QOS...
// Create the publications Topic topic_ = participant_->create_topic("HelloWorldTopic", "HelloWorld", TOPIC_QOS_DEFAULT); if (topic_ == nullptr) { return false; } // Create the Publisher publisher_ = participant_->create_publisher(PUBLISHER_QOS_DEFAULT, nullptr); if (publisher_ == nul...
eprosima::fastdds::dds::Topic* topic = participant->create_topic topic_name, topic_type_name, topic_qos); //... //删除所有创建的对象 participant->delete_contained_entities(; eprosima::fastdds::dds::DomainParticipantFactory::get_instance(->delete_participant(participant); ...
().create_participant(0,DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT);Publisherpublisher=participant.create_publisher(Publisher.PUBLISHER_QOS_DEFAULT);// 创建主题StringtopicName="GreetingTopic";// 创建数据写者DataWriterwriter=publisher.create_datawriter(participant.create_topic(topicName,Greeting....
}// Register the Typetype_.register_type(participant_);// Create the publications Topictopic_ = participant_->create_topic("HelloWorldTopic","HelloWorld", TOPIC_QOS_DEFAULT);if(topic_ == nullptr) {returnfalse; }// Create the Publisherpublisher_ = participant_->create_publisher(PUBLISHER_...
participant_=DomainParticipantFactory::get_instance()->create_participant(0,participantQos);if(participant_==nullptr){returnfalse;}// Register the Typetype_.register_type(participant_);// Create the publications Topictopic_=participant_->create_topic("HelloWorldTopic","HelloWorld",TOPIC_QOS...
// Create a DataReader with the new default DataReaderQos. DataReader* data_reader_with_qos_type1 = subscriber->create_datareader(topic, DATAREADER_QOS_DEFAULT); if (nullptr == data_reader_with_qos_type1) { // Error return; }
3.3.2.3 register数据类型并创建topic IDL接口文件中定义的数据类型需要在participant中注册,把数据类型注册到participant上,这样participant在创建topic时,才能使用该数据类型。 type_=newHelloWorldPubSubType()type_.register_type(participant_);topic_=participant_->create_topic("HelloWorldTopicName","HelloWorld...