Modern C++ Equivalent of DDSTheParticipantFactory ?

4 posts / 0 new
Last post
Offline
Joined: 10/22/2018
Posts: 5
Modern C++ Equivalent of DDSTheParticipantFactory ?

hi,

I'm reading the waitset_status_cond examples codes, and I try to understand the different between C++ & C++11.

in C++, the domain participant can be create via:

participant = DDSTheParticipantFactory->create_participant(
domainId, DDS_PARTICIPANT_QOS_DEFAULT,
NULL /* listener */, DDS_STATUS_MASK_NONE);

in C++11, I don't see any equilvalent.

// When not explicitly provided to the constructor, the
// created DomainParticipants's QoS is default, has a NULL listener, and a
// status mask dds::core::status::StatusMask::all()
// Creating a DomainParticipants on domain id
dds::domain::DomainParticipant participant1(domainId) ;

can someone please explain how do I get the DDS_PARTICIPANT_QOS_DEFAULT in modern C++11?
basically what I try to do is to create the domain participant using this constructor but I couldn't figure out how do I get the DDS_PARTICIPANT_QOS_DEFAULT
DomainParticipant (int32_t the_domain_id, const dds::domain::qos::DomainParticipantQos &the_qos, dds::domain::DomainParticipantListener *the_listener=NULL, const dds::core::status::StatusMask &mask=dds::core::status::StatusMask::all())

thanks

sara's picture
Offline
Joined: 01/16/2013
Posts: 118

Hi David,

Looking into the API doc I see that you can get the default QoS profile from the dds::domain::qos::DomainParticipantQos default constructor.

That said, I think it's better that you use the DomainParticipant constructor that only takes the ID if you plan to use all the defaults:


dds::domain::DomainParticipant::DomainParticipant ( int32_t the_domain_id )
Create a new DomainParticipant with default Qos.

 

Same as DomainParticipant(int32_t, const dds::domain::qos::DomainParticipantQos&, dds::domain::DomainParticipantListener*, const dds::core::status::StatusMask&) except that it uses the default DomainParticipantQos

Let me know how it goes.

All the best,
Sara

 
Offline
Joined: 10/22/2018
Posts: 5

Thanks Sara.

the reason I use that constructor because I want to set the StatusMask to StatusMask::none()

I'm pretty new to RTI DDS for C++ so any help is appreciated.

 

sara's picture
Offline
Joined: 01/16/2013
Posts: 118

Hi David,

If you use the constructor, you can use the first function that I mentioned. Something like: 

dds::domain::DomainParticipant participant (domain_id, dds::domain::qos::DomainParticipantQos(),NULL, dds::core::status::StatusMask::none());

Thanks,
Sara