Modern C++ Equivalent of DDSDomainParticipantFactory

5 posts / 0 new
Last post
Offline
Last seen: 4 years 2 months ago
Joined: 07/22/2019
Posts: 11
Modern C++ Equivalent of DDSDomainParticipantFactory

Hello,

I'm trying to create a new DDSDomainParticipant using an input XML QoS profile.

In C++ we have the function 

virtual DDSDomainParticipant* DDSDomainParticipantFactory::create_participant_with_profile(DDS_DomainId_t domainId,
  const char * library_name,
  const char * profile_name,
  DDSDomainParticipantListener * listener,
  DDS_StatusMask mask 
 )

To specify the library_name and profile_name. Same with the fucntions create_datareader_with_profile and create_datawriter_with_profile. But I can't find how to do this in C++11. 

Can someone please explain how to achieve the same using C++11?

Thanks! 

 

 

Offline
Last seen: 3 years 5 months ago
Joined: 08/20/2012
Posts: 25

Some of the functionality of the Traditional C++ Participant Factory is subsumed into the DomainParticipant constructors. In this case, you might want to look further to the XML App Creation feature and define the entity tree itself via XML. But if you do want to create the entities (Participant, Publisher, Subscriber, DataWriter, DataReader) manually, you can just call the DomainParticipant constructor directly. In this case, it seems you need this constructor and a QosProvider to access the profile defined in XML, so that you can supply the QoS object to that Participant constructor. 

Offline
Last seen: 2 months 2 weeks ago
Joined: 04/02/2013
Posts: 194

Given this traditional C++ API code:

DDSDomainParticipantFactory::get_instance()->create_participant_with_profile(0, "MyLibrary", "MyProfile", ...);

The equivalent Modern C++ API code is:

DomainParticipant participant(0, QosProvider::Default().participant_qos("MyLibrary::MyProfile"));

 

Offline
Last seen: 2 months 2 weeks ago
Joined: 04/02/2013
Posts: 194

This article describes some of the differences between the Traditional and Modern C++ APIs: https://community.rti.com/kb/differences-between-modern-and-traditional-c-apis

Offline
Last seen: 4 years 2 months ago
Joined: 07/22/2019
Posts: 11

Thank you Alejandro. That worked