@@ -54,6 +54,7 @@ namespace dds {
5454
5555DomainParticipantFactory::DomainParticipantFactory ()
5656 : default_xml_profiles_loaded(false )
57+ , default_domain_id_(0 )
5758 , default_participant_qos_(PARTICIPANT_QOS_DEFAULT )
5859 , topic_pool_(fastrtps::rtps::TopicPayloadPoolRegistry::instance())
5960 , rtps_domain_(fastrtps::rtps::RTPSDomainImpl::get_instance())
@@ -155,7 +156,7 @@ ReturnCode_t DomainParticipantFactory::delete_participant(
155156DomainParticipant* DomainParticipantFactory::create_participant (
156157 DomainId_t did,
157158 const DomainParticipantQos& qos,
158- DomainParticipantListener* listen ,
159+ DomainParticipantListener* listener ,
159160 const StatusMask& mask)
160161{
161162 load_profiles ();
@@ -164,10 +165,10 @@ DomainParticipant* DomainParticipantFactory::create_participant(
164165
165166 DomainParticipant* dom_part = new DomainParticipant (mask);
166167#ifndef FASTDDS_STATISTICS
167- DomainParticipantImpl* dom_part_impl = new DomainParticipantImpl (dom_part, did, pqos, listen );
168+ DomainParticipantImpl* dom_part_impl = new DomainParticipantImpl (dom_part, did, pqos, listener );
168169#else
169170 eprosima::fastdds::statistics::dds::DomainParticipantImpl* dom_part_impl =
170- new eprosima::fastdds::statistics::dds::DomainParticipantImpl (dom_part, did, pqos, listen );
171+ new eprosima::fastdds::statistics::dds::DomainParticipantImpl (dom_part, did, pqos, listener );
171172#endif // FASTDDS_STATISTICS
172173
173174 if (fastrtps::rtps::GUID_t::unknown () != dom_part_impl->guid ())
@@ -206,10 +207,23 @@ DomainParticipant* DomainParticipantFactory::create_participant(
206207 return dom_part;
207208}
208209
210+ DomainParticipant* DomainParticipantFactory::create_participant_with_default_profile ()
211+ {
212+ return create_participant_with_default_profile (nullptr , StatusMask::none ());
213+ }
214+
215+ DomainParticipant* DomainParticipantFactory::create_participant_with_default_profile (
216+ DomainParticipantListener* listener,
217+ const StatusMask& mask)
218+ {
219+ load_profiles ();
220+ return create_participant (default_domain_id_, default_participant_qos_, listener, mask);
221+ }
222+
209223DomainParticipant* DomainParticipantFactory::create_participant_with_profile (
210224 DomainId_t did,
211225 const std::string& profile_name,
212- DomainParticipantListener* listen ,
226+ DomainParticipantListener* listener ,
213227 const StatusMask& mask)
214228{
215229 load_profiles ();
@@ -220,15 +234,15 @@ DomainParticipant* DomainParticipantFactory::create_participant_with_profile(
220234 {
221235 DomainParticipantQos qos = default_participant_qos_;
222236 utils::set_qos_from_attributes (qos, attr.rtps );
223- return create_participant (did, qos, listen , mask);
237+ return create_participant (did, qos, listener , mask);
224238 }
225239
226240 return nullptr ;
227241}
228242
229243DomainParticipant* DomainParticipantFactory::create_participant_with_profile (
230244 const std::string& profile_name,
231- DomainParticipantListener* listen ,
245+ DomainParticipantListener* listener ,
232246 const StatusMask& mask)
233247{
234248 load_profiles ();
@@ -239,7 +253,7 @@ DomainParticipant* DomainParticipantFactory::create_participant_with_profile(
239253 {
240254 DomainParticipantQos qos = default_participant_qos_;
241255 utils::set_qos_from_attributes (qos, attr.rtps );
242- return create_participant (attr.domainId , qos, listen , mask);
256+ return create_participant (attr.domainId , qos, listener , mask);
243257 }
244258
245259 return nullptr ;
@@ -349,6 +363,10 @@ ReturnCode_t DomainParticipantFactory::load_profiles()
349363 {
350364 reset_default_participant_qos ();
351365 }
366+ // Take the default domain id from the default participant profile
367+ eprosima::fastdds::ParticipantAttributes attr;
368+ XMLProfileManager::getDefaultParticipantAttributes (attr);
369+ default_domain_id_ = attr.domainId ;
352370
353371 RTPSDomain::set_filewatch_thread_config (factory_qos_.file_watch_threads (), factory_qos_.file_watch_threads ());
354372 }
0 commit comments