Function rmw_fastrtps_shared_cpp::cast_or_create_topic

Function Documentation

bool rmw_fastrtps_shared_cpp::cast_or_create_topic(eprosima::fastdds::dds::DomainParticipant *participant, eprosima::fastdds::dds::TopicDescription *desc, const std::string &topic_name, const std::string &type_name, const eprosima::fastdds::dds::TopicQos &topic_qos, bool is_writer_topic, TopicHolder *topic_holder)

Auxiliary method to reuse or create a topic during the creation of an entity.

Parameters:
  • participant[in] DomainParticipant where the topic will be created.

  • desc[in] TopicDescription returned by find_and_check_topic_and_type.

  • topic_name[in] Name of the topic.

  • type_name[in] Name of the type.

  • topic_qos[in] QoS with which to create the topic.

  • is_writer_topic[in] Whether the resulting topic will be used on a DataWriter.

  • topic_holder[out] Will hold the pointer to the topic along with the necessary information for its deletion. When is_writer_topic is true, topic_holder->topic can be directly used on a create_datawriter call. When is_writer_topic is false, topic_holder->desc can be directly used on a create_datareader call.

Returns:

true when the topic was reused (topic_holder->should_be_deleted will be false)

Returns:

true when the topic was created (topic_holder->should_be_deleted will be true)

Returns:

false when the topic could not be created