46 if (
_impl->_type ==
nullptr) {
47 std::cerr <<
"Invalid TypeSupport" << std::endl;
51 efd::DomainParticipantQos pqos = efd::PARTICIPANT_QOS_DEFAULT;
53 auto factory = efd::DomainParticipantFactory::get_instance();
54 _impl->_participant = factory->create_participant(0, pqos);
55 if (
_impl->_participant ==
nullptr) {
56 std::cerr <<
"Failed to create DomainParticipant" << std::endl;
59 _impl->_type.register_type(
_impl->_participant);
61 efd::SubscriberQos subqos = efd::SUBSCRIBER_QOS_DEFAULT;
62 _impl->_subscriber =
_impl->_participant->create_subscriber(subqos,
nullptr);
63 if (
_impl->_subscriber ==
nullptr) {
64 std::cerr <<
"Failed to create Subscriber" << std::endl;
68 efd::TopicQos tqos = efd::TOPIC_QOS_DEFAULT;
69 const std::string base {
"rt/carla/" };
70 const std::string subscriber_type {
"/basic_subscriber_example"};
71 std::string topic_name = base;
75 topic_name += subscriber_type;
76 _impl->_topic =
_impl->_participant->create_topic(topic_name,
_impl->_type->getName(), tqos);
77 if (
_impl->_topic ==
nullptr) {
78 std::cerr <<
"Failed to create Topic" << std::endl;
82 efd::DataReaderQos rqos = efd::DATAREADER_QOS_DEFAULT;
83 efd::DataReaderListener* listener = (efd::DataReaderListener*)
_impl->_listener._impl.get();
84 _impl->_datareader =
_impl->_subscriber->create_datareader(
_impl->_topic, rqos, listener);
85 if (
_impl->_datareader ==
nullptr) {
86 std::cerr <<
"Failed to create DataReader" << std::endl;