48 const std::string& topic_name,
51 : node_(node), cb_(cb)
53 type_.reset(
new MsgPubSubType());
54 type_.register_type(node_->participant());
56 topic_ = node_->participant()->find_topic(topic_name, eprosima::fastdds::dds::Duration_t(1));
57 if (topic_ ==
nullptr)
59 topic_ = node_->participant()->create_topic(
60 topic_name, type_.get_type_name(),
61 eprosima::fastdds::dds::TOPIC_QOS_DEFAULT);
64 sub_ = node_->participant()->create_subscriber(
65 eprosima::fastdds::dds::SUBSCRIBER_QOS_DEFAULT,
nullptr);
67 eprosima::fastdds::dds::DataReaderQos rqos;
68 rqos.history().kind = eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS;
69 rqos.history().depth = qos_depth;
70 reader_ = sub_->create_datareader(topic_, rqos,
this);