Coverage Report

Created: 2026-02-14 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Fast-DDS/src/cpp/fastdds/domain/DomainParticipantFactory.cpp
Line
Count
Source
1
// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
/**
16
 * @file DomainParticipantFactory.cpp
17
 *
18
 */
19
20
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
21
22
#include <thread>
23
24
#include <fastdds/dds/domain/DomainParticipant.hpp>
25
#include <fastdds/dds/domain/qos/DomainParticipantFactoryQos.hpp>
26
#include <fastdds/dds/log/Log.hpp>
27
#include <fastdds/dds/xtypes/dynamic_types/DynamicDataFactory.hpp>
28
#include <fastdds/dds/xtypes/dynamic_types/DynamicTypeBuilderFactory.hpp>
29
#include <fastdds/rtps/participant/RTPSParticipant.hpp>
30
#include <fastdds/rtps/RTPSDomain.hpp>
31
#include <fastdds/utils/QosConverters.hpp>
32
33
#include <fastdds/domain/DomainParticipantImpl.hpp>
34
#include <fastdds/log/LogResources.hpp>
35
#include <rtps/history/TopicPayloadPoolRegistry.hpp>
36
#include <rtps/domain/RTPSDomainImpl.hpp>
37
#include <statistics/fastdds/domain/DomainParticipantImpl.hpp>
38
#include <utils/shared_memory/SharedMemWatchdog.hpp>
39
#include <utils/SystemInfo.hpp>
40
#include <xmlparser/XMLEndpointParser.h>
41
#include <xmlparser/XMLProfileManager.h>
42
43
using namespace eprosima::fastdds::xmlparser;
44
45
using eprosima::fastdds::rtps::RTPSDomain;
46
using eprosima::fastdds::rtps::RTPSParticipant;
47
48
namespace eprosima {
49
namespace fastdds {
50
namespace dds {
51
52
DomainParticipantFactory::DomainParticipantFactory()
53
1
    : default_xml_profiles_loaded(false)
54
1
    , default_domain_id_(0)
55
1
    , default_participant_qos_(PARTICIPANT_QOS_DEFAULT)
56
1
    , topic_pool_(rtps::TopicPayloadPoolRegistry::instance())
57
1
    , rtps_domain_(rtps::RTPSDomainImpl::get_instance())
58
1
    , log_resources_(detail::get_log_resources())
59
1
{
60
1
}
61
62
DomainParticipantFactory::~DomainParticipantFactory()
63
1
{
64
1
    {
65
1
        std::lock_guard<std::mutex> guard(mtx_participants_);
66
1
        for (auto it : participants_)
67
0
        {
68
0
            for (auto pit : it.second)
69
0
            {
70
0
                pit->disable();
71
0
                delete pit;
72
0
            }
73
0
        }
74
1
        participants_.clear();
75
1
    }
76
77
    // Deletes DynamicTypes and TypeObject factories
78
1
    dds::DynamicDataFactory::delete_instance();
79
1
    dds::DynamicTypeBuilderFactory::delete_instance();
80
81
1
    std::this_thread::sleep_for(std::chrono::milliseconds(100));
82
1
    Log::KillThread();
83
1
}
84
85
DomainParticipantFactory* DomainParticipantFactory::get_instance()
86
22.2k
{
87
22.2k
    return get_shared_instance().get();
88
22.2k
}
89
90
std::shared_ptr<DomainParticipantFactory> DomainParticipantFactory::get_shared_instance()
91
22.2k
{
92
    // Note we need a custom deleter, since the destructor is protected.
93
22.2k
    static std::shared_ptr<DomainParticipantFactory> instance(
94
22.2k
        new DomainParticipantFactory(),
95
22.2k
        [](DomainParticipantFactory* p)
96
22.2k
        {
97
1
            delete p;
98
1
        });
99
22.2k
    return instance;
100
22.2k
}
101
102
ReturnCode_t DomainParticipantFactory::delete_participant(
103
        DomainParticipant* part)
104
0
{
105
0
    using PartVectorIt = std::vector<DomainParticipantImpl*>::iterator;
106
0
    using VectorIt = std::map<DomainId_t, std::vector<DomainParticipantImpl*>>::iterator;
107
108
0
    if (part != nullptr)
109
0
    {
110
0
        std::lock_guard<std::mutex> guard(mtx_participants_);
111
0
#ifdef FASTDDS_STATISTICS
112
        // Delete builtin statistics entities
113
0
        statistics::dds::DomainParticipantImpl* stat_part_impl =
114
0
                static_cast<statistics::dds::DomainParticipantImpl*>(part->impl_);
115
0
        stat_part_impl->delete_statistics_builtin_entities();
116
0
#endif // ifdef FASTDDS_STATISTICS
117
0
        if (part->has_active_entities())
118
0
        {
119
0
            return RETCODE_PRECONDITION_NOT_MET;
120
0
        }
121
122
0
        VectorIt vit = participants_.find(part->get_domain_id());
123
124
0
        if (vit != participants_.end())
125
0
        {
126
0
            for (PartVectorIt pit = vit->second.begin(); pit != vit->second.end();)
127
0
            {
128
0
                if ((*pit)->get_participant() == part
129
0
                        || (*pit)->get_participant()->guid() == part->guid())
130
0
                {
131
0
                    (*pit)->disable();
132
0
                    delete (*pit);
133
0
                    PartVectorIt next_it = vit->second.erase(pit);
134
0
                    pit = next_it;
135
0
                    break;
136
0
                }
137
0
                else
138
0
                {
139
0
                    ++pit;
140
0
                }
141
0
            }
142
0
            if (vit->second.empty())
143
0
            {
144
0
                participants_.erase(vit);
145
0
            }
146
0
            return RETCODE_OK;
147
0
        }
148
0
    }
149
0
    return RETCODE_ERROR;
150
0
}
151
152
DomainParticipant* DomainParticipantFactory::create_participant(
153
        DomainId_t did,
154
        const DomainParticipantQos& qos,
155
        DomainParticipantListener* listener,
156
        const StatusMask& mask)
157
0
{
158
0
    load_profiles();
159
160
0
    const DomainParticipantQos& pqos = (&qos == &PARTICIPANT_QOS_DEFAULT) ? default_participant_qos_ : qos;
161
162
0
    DomainParticipant* dom_part = new DomainParticipant(mask);
163
#ifndef FASTDDS_STATISTICS
164
    DomainParticipantImpl* dom_part_impl = new DomainParticipantImpl(dom_part, did, pqos, listener);
165
#else
166
0
    statistics::dds::DomainParticipantImpl* dom_part_impl =
167
0
            new statistics::dds::DomainParticipantImpl(dom_part, did, pqos, listener);
168
0
#endif // FASTDDS_STATISTICS
169
170
0
    if (fastdds::rtps::GUID_t::unknown() != dom_part_impl->guid())
171
0
    {
172
0
        {
173
0
            std::lock_guard<std::mutex> guard(mtx_participants_);
174
0
            using VectorIt = std::map<DomainId_t, std::vector<DomainParticipantImpl*>>::iterator;
175
0
            VectorIt vector_it = participants_.find(did);
176
177
0
            if (vector_it == participants_.end())
178
0
            {
179
                // Insert the vector
180
0
                std::vector<DomainParticipantImpl*> new_vector;
181
0
                auto pair_it = participants_.insert(std::make_pair(did, std::move(new_vector)));
182
0
                vector_it = pair_it.first;
183
0
            }
184
185
0
            vector_it->second.push_back(dom_part_impl);
186
0
        }
187
188
0
        if (factory_qos_.entity_factory().autoenable_created_entities)
189
0
        {
190
0
            if (RETCODE_OK != dom_part->enable())
191
0
            {
192
0
                delete_participant(dom_part);
193
0
                return nullptr;
194
0
            }
195
0
        }
196
0
    }
197
0
    else
198
0
    {
199
0
        delete dom_part_impl;
200
0
        return nullptr;
201
0
    }
202
203
0
    return dom_part;
204
0
}
205
206
DomainParticipant* DomainParticipantFactory::create_participant(
207
        const DomainParticipantExtendedQos& extended_qos,
208
        DomainParticipantListener* listener,
209
        const StatusMask& mask)
210
0
{
211
0
    return create_participant(extended_qos.domainId(), extended_qos, listener, mask);
212
0
}
213
214
DomainParticipant* DomainParticipantFactory::create_participant_with_default_profile()
215
0
{
216
0
    return create_participant_with_default_profile(nullptr, StatusMask::none());
217
0
}
218
219
DomainParticipant* DomainParticipantFactory::create_participant_with_default_profile(
220
        DomainParticipantListener* listener,
221
        const StatusMask& mask)
222
0
{
223
0
    load_profiles();
224
0
    return create_participant(default_domain_id_, default_participant_qos_, listener, mask);
225
0
}
226
227
DomainParticipant* DomainParticipantFactory::create_participant_with_profile(
228
        DomainId_t did,
229
        const std::string& profile_name,
230
        DomainParticipantListener* listener,
231
        const StatusMask& mask)
232
0
{
233
0
    load_profiles();
234
235
    // TODO (Miguel C): Change when we have full XML support for DDS QoS profiles
236
0
    ParticipantAttributes attr;
237
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(profile_name, attr))
238
0
    {
239
0
        DomainParticipantQos qos = default_participant_qos_;
240
0
        utils::set_qos_from_attributes(qos, attr.rtps);
241
0
        return create_participant(did, qos, listener, mask);
242
0
    }
243
244
0
    return nullptr;
245
0
}
246
247
DomainParticipant* DomainParticipantFactory::create_participant_with_profile(
248
        const std::string& profile_name,
249
        DomainParticipantListener* listener,
250
        const StatusMask& mask)
251
0
{
252
0
    load_profiles();
253
254
    // TODO (Miguel C): Change when we have full XML support for DDS QoS profiles
255
0
    ParticipantAttributes attr;
256
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(profile_name, attr))
257
0
    {
258
0
        DomainParticipantQos qos = default_participant_qos_;
259
0
        utils::set_qos_from_attributes(qos, attr.rtps);
260
0
        return create_participant(attr.domainId, qos, listener, mask);
261
0
    }
262
263
0
    return nullptr;
264
0
}
265
266
DomainParticipant* DomainParticipantFactory::lookup_participant(
267
        DomainId_t domain_id) const
268
0
{
269
0
    std::lock_guard<std::mutex> guard(mtx_participants_);
270
271
0
    auto it = participants_.find(domain_id);
272
0
    if (it != participants_.end() && it->second.size() > 0)
273
0
    {
274
0
        return it->second.front()->get_participant();
275
0
    }
276
277
0
    return nullptr;
278
0
}
279
280
std::vector<DomainParticipant*> DomainParticipantFactory::lookup_participants(
281
        DomainId_t domain_id) const
282
0
{
283
0
    std::lock_guard<std::mutex> guard(mtx_participants_);
284
285
0
    std::vector<DomainParticipant*> result;
286
0
    auto it = participants_.find(domain_id);
287
0
    if (it != participants_.end())
288
0
    {
289
0
        const std::vector<DomainParticipantImpl*>& v = it->second;
290
0
        for (auto pit = v.begin(); pit != v.end(); ++pit)
291
0
        {
292
0
            result.push_back((*pit)->get_participant());
293
0
        }
294
0
    }
295
296
0
    return result;
297
0
}
298
299
ReturnCode_t DomainParticipantFactory::get_default_participant_qos(
300
        DomainParticipantQos& qos) const
301
0
{
302
0
    qos = default_participant_qos_;
303
0
    return RETCODE_OK;
304
0
}
305
306
const DomainParticipantQos& DomainParticipantFactory::get_default_participant_qos() const
307
0
{
308
0
    return default_participant_qos_;
309
0
}
310
311
ReturnCode_t DomainParticipantFactory::set_default_participant_qos(
312
        const DomainParticipantQos& qos)
313
0
{
314
0
    if (&qos == &PARTICIPANT_QOS_DEFAULT)
315
0
    {
316
0
        reset_default_participant_qos();
317
0
        return RETCODE_OK;
318
0
    }
319
320
0
    ReturnCode_t ret_val = DomainParticipantImpl::check_qos(qos);
321
0
    if (RETCODE_OK != ret_val)
322
0
    {
323
0
        return ret_val;
324
0
    }
325
0
    DomainParticipantImpl::set_qos(default_participant_qos_, qos, true);
326
0
    return RETCODE_OK;
327
0
}
328
329
ReturnCode_t DomainParticipantFactory::get_participant_qos_from_profile(
330
        const std::string& profile_name,
331
        DomainParticipantQos& qos) const
332
0
{
333
0
    ParticipantAttributes attr;
334
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(profile_name, attr, false))
335
0
    {
336
0
        qos = default_participant_qos_;
337
0
        utils::set_qos_from_attributes(qos, attr.rtps);
338
0
        return RETCODE_OK;
339
0
    }
340
341
0
    return RETCODE_BAD_PARAMETER;
342
0
}
343
344
ReturnCode_t DomainParticipantFactory::get_participant_qos_from_xml(
345
        const std::string& xml,
346
        DomainParticipantQos& qos) const
347
0
{
348
0
    ParticipantAttributes attr;
349
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fill_participant_attributes_from_xml(xml, attr, false))
350
0
    {
351
0
        qos = default_participant_qos_;
352
0
        utils::set_qos_from_attributes(qos, attr.rtps);
353
0
        return RETCODE_OK;
354
0
    }
355
356
0
    return RETCODE_BAD_PARAMETER;
357
0
}
358
359
ReturnCode_t DomainParticipantFactory::get_participant_qos_from_xml(
360
        const std::string& xml,
361
        DomainParticipantQos& qos,
362
        const std::string& profile_name) const
363
0
{
364
0
    if (profile_name.empty())
365
0
    {
366
0
        EPROSIMA_LOG_ERROR(DDS_DOMAIN, "Provided profile name must be non-empty");
367
0
        return RETCODE_BAD_PARAMETER;
368
0
    }
369
370
0
    ParticipantAttributes attr;
371
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fill_participant_attributes_from_xml(xml, attr, true, profile_name))
372
0
    {
373
0
        qos = default_participant_qos_;
374
0
        utils::set_qos_from_attributes(qos, attr.rtps);
375
0
        return RETCODE_OK;
376
0
    }
377
378
0
    return RETCODE_BAD_PARAMETER;
379
0
}
380
381
ReturnCode_t DomainParticipantFactory::get_default_participant_qos_from_xml(
382
        const std::string& xml,
383
        DomainParticipantQos& qos) const
384
0
{
385
0
    ParticipantAttributes attr;
386
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fill_default_participant_attributes_from_xml(xml, attr, true))
387
0
    {
388
0
        qos = default_participant_qos_;
389
0
        utils::set_qos_from_attributes(qos, attr.rtps);
390
0
        return RETCODE_OK;
391
0
    }
392
393
0
    return RETCODE_BAD_PARAMETER;
394
0
}
395
396
ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_profile(
397
        const std::string& profile_name,
398
        DomainParticipantExtendedQos& extended_qos) const
399
0
{
400
0
    ParticipantAttributes attr;
401
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(profile_name, attr, false))
402
0
    {
403
0
        extended_qos = default_participant_qos_;
404
0
        utils::set_extended_qos_from_attributes(extended_qos, attr);
405
0
        return RETCODE_OK;
406
0
    }
407
408
0
    return RETCODE_BAD_PARAMETER;
409
0
}
410
411
ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_xml(
412
        const std::string& xml,
413
        DomainParticipantExtendedQos& extended_qos) const
414
0
{
415
0
    ParticipantAttributes attr;
416
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fill_participant_attributes_from_xml(xml, attr, false))
417
0
    {
418
0
        extended_qos = default_participant_qos_;
419
0
        utils::set_extended_qos_from_attributes(extended_qos, attr);
420
0
        return RETCODE_OK;
421
0
    }
422
423
0
    return RETCODE_BAD_PARAMETER;
424
0
}
425
426
ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_xml(
427
        const std::string& xml,
428
        DomainParticipantExtendedQos& extended_qos,
429
        const std::string& profile_name) const
430
0
{
431
0
    if (profile_name.empty())
432
0
    {
433
0
        EPROSIMA_LOG_ERROR(DDS_DOMAIN, "Provided profile name must be non-empty");
434
0
        return RETCODE_BAD_PARAMETER;
435
0
    }
436
437
0
    ParticipantAttributes attr;
438
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fill_participant_attributes_from_xml(xml, attr, true, profile_name))
439
0
    {
440
0
        extended_qos = default_participant_qos_;
441
0
        utils::set_extended_qos_from_attributes(extended_qos, attr);
442
0
        return RETCODE_OK;
443
0
    }
444
445
0
    return RETCODE_BAD_PARAMETER;
446
0
}
447
448
ReturnCode_t DomainParticipantFactory::get_default_participant_extended_qos_from_xml(
449
        const std::string& xml,
450
        DomainParticipantExtendedQos& extended_qos) const
451
0
{
452
0
    ParticipantAttributes attr;
453
0
    if (XMLP_ret::XML_OK == XMLProfileManager::fill_default_participant_attributes_from_xml(xml, attr, true))
454
0
    {
455
0
        extended_qos = default_participant_qos_;
456
0
        utils::set_extended_qos_from_attributes(extended_qos, attr);
457
0
        return RETCODE_OK;
458
0
    }
459
460
0
    return RETCODE_BAD_PARAMETER;
461
0
}
462
463
ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_default_profile(
464
        DomainParticipantExtendedQos& extended_qos) const
465
0
{
466
0
    ParticipantAttributes attr;
467
0
    XMLProfileManager::getDefaultParticipantAttributes(attr);
468
0
    utils::set_extended_qos_from_attributes(extended_qos, attr);
469
0
    return RETCODE_OK;
470
0
}
471
472
ReturnCode_t DomainParticipantFactory::load_profiles()
473
0
{
474
    // NOTE: This could be done with a bool atomic to avoid taking the mutex in most cases, however the use of
475
    // atomic over mutex is not deterministically better, and this way is easier to read and understand.
476
477
    // Only load profiles once, if not, wait for profiles to be loaded
478
0
    std::lock_guard<std::mutex> _(default_xml_profiles_loaded_mtx_);
479
0
    if (!default_xml_profiles_loaded)
480
0
    {
481
0
        SystemInfo::set_environment_file();
482
0
        XMLProfileManager::loadDefaultXMLFile();
483
484
        // Change as already loaded
485
0
        default_xml_profiles_loaded = true;
486
487
        // Only change factory qos when not explicitly set by the user
488
0
        if (factory_qos_ == PARTICIPANT_FACTORY_QOS_DEFAULT)
489
0
        {
490
0
            XMLProfileManager::getDefaultDomainParticipantFactoryQos(factory_qos_);
491
0
        }
492
493
        // Only change default participant qos when not explicitly set by the user
494
0
        if (default_participant_qos_ == PARTICIPANT_QOS_DEFAULT)
495
0
        {
496
0
            reset_default_participant_qos();
497
0
        }
498
        // Take the default domain id from the default participant profile
499
0
        ParticipantAttributes attr;
500
0
        XMLProfileManager::getDefaultParticipantAttributes(attr);
501
0
        default_domain_id_ = attr.domainId;
502
503
0
        RTPSDomain::set_filewatch_thread_config(factory_qos_.file_watch_threads(), factory_qos_.file_watch_threads());
504
0
    }
505
506
0
    return RETCODE_OK;
507
0
}
508
509
ReturnCode_t DomainParticipantFactory::load_XML_profiles_file(
510
        const std::string& xml_profile_file)
511
0
{
512
0
    if (XMLP_ret::XML_ERROR == XMLProfileManager::loadXMLFile(xml_profile_file))
513
0
    {
514
0
        EPROSIMA_LOG_ERROR(DDS_DOMAIN, "Problem loading XML file '" << xml_profile_file << "'");
515
0
        return RETCODE_ERROR;
516
0
    }
517
0
    return RETCODE_OK;
518
0
}
519
520
ReturnCode_t DomainParticipantFactory::load_XML_profiles_string(
521
        const char* data,
522
        size_t length)
523
22.2k
{
524
22.2k
    if (XMLP_ret::XML_ERROR == XMLProfileManager::loadXMLString(data, length))
525
19.9k
    {
526
19.9k
        EPROSIMA_LOG_ERROR(DDS_DOMAIN, "Problem loading XML string");
527
19.9k
        return RETCODE_ERROR;
528
19.9k
    }
529
2.30k
    return RETCODE_OK;
530
22.2k
}
531
532
ReturnCode_t DomainParticipantFactory::check_xml_static_discovery(
533
        std::string& xml_file)
534
0
{
535
0
    xmlparser::XMLEndpointParser parser;
536
0
    if (XMLP_ret::XML_OK != parser.loadXMLFile(xml_file))
537
0
    {
538
0
        EPROSIMA_LOG_ERROR(DDS_DOMAIN, "Error parsing xml file");
539
0
        return RETCODE_ERROR;
540
0
    }
541
0
    return RETCODE_OK;
542
0
}
543
544
ReturnCode_t DomainParticipantFactory::get_qos(
545
        DomainParticipantFactoryQos& qos) const
546
0
{
547
0
    qos = factory_qos_;
548
0
    return RETCODE_OK;
549
0
}
550
551
ReturnCode_t DomainParticipantFactory::set_qos(
552
        const DomainParticipantFactoryQos& qos)
553
0
{
554
0
    ReturnCode_t ret_val = check_qos(qos);
555
0
    if (RETCODE_OK != ret_val)
556
0
    {
557
0
        return ret_val;
558
0
    }
559
0
    if (!can_qos_be_updated(factory_qos_, qos))
560
0
    {
561
0
        return RETCODE_IMMUTABLE_POLICY;
562
0
    }
563
0
    set_qos(factory_qos_, qos, false);
564
0
    return RETCODE_OK;
565
0
}
566
567
xtypes::ITypeObjectRegistry& DomainParticipantFactory::type_object_registry()
568
0
{
569
0
    return rtps_domain_->type_object_registry();
570
0
}
571
572
void DomainParticipantFactory::reset_default_participant_qos()
573
0
{
574
    // TODO (Miguel C): Change when we have full XML support for DDS QoS profiles
575
0
    DomainParticipantImpl::set_qos(default_participant_qos_, PARTICIPANT_QOS_DEFAULT, true);
576
0
    if (true == default_xml_profiles_loaded)
577
0
    {
578
0
        ParticipantAttributes attr;
579
0
        XMLProfileManager::getDefaultParticipantAttributes(attr);
580
0
        utils::set_qos_from_attributes(default_participant_qos_, attr.rtps);
581
0
    }
582
0
}
583
584
void DomainParticipantFactory::set_qos(
585
        DomainParticipantFactoryQos& to,
586
        const DomainParticipantFactoryQos& from,
587
        bool first_time)
588
0
{
589
0
    (void) first_time;
590
    //As all the Qos can always be updated and none of them need to be sent
591
0
    to = from;
592
593
0
    rtps::SharedMemWatchdog::set_thread_settings(to.shm_watchdog_thread());
594
0
}
595
596
ReturnCode_t DomainParticipantFactory::check_qos(
597
        const DomainParticipantFactoryQos& qos)
598
0
{
599
0
    (void) qos;
600
    //There is no restriction by the moment with the contained Qos
601
0
    return RETCODE_OK;
602
0
}
603
604
bool DomainParticipantFactory::can_qos_be_updated(
605
        const DomainParticipantFactoryQos& to,
606
        const DomainParticipantFactoryQos& from)
607
0
{
608
0
    (void) to;
609
0
    (void) from;
610
    //All the DomainParticipantFactoryQos can be updated
611
0
    return true;
612
0
}
613
614
void DomainParticipantFactory::participant_has_been_deleted(
615
        DomainParticipantImpl* part)
616
0
{
617
0
    std::lock_guard<std::mutex> guard(mtx_participants_);
618
0
    auto it = participants_.find(part->get_domain_id());
619
0
    if (it != participants_.end())
620
0
    {
621
0
        for (auto pit = it->second.begin(); pit != it->second.end();)
622
0
        {
623
0
            if ((*pit) == part || (*pit)->guid() == part->guid())
624
0
            {
625
0
                pit = it->second.erase(pit);
626
0
            }
627
0
            else
628
0
            {
629
0
                ++pit;
630
0
            }
631
0
        }
632
0
        if (it->second.empty())
633
0
        {
634
0
            participants_.erase(it);
635
0
        }
636
0
    }
637
0
}
638
639
ReturnCode_t DomainParticipantFactory::get_library_settings(
640
        LibrarySettings& library_settings) const
641
0
{
642
0
    rtps_domain_->get_library_settings(library_settings);
643
0
    return RETCODE_OK;
644
0
}
645
646
ReturnCode_t DomainParticipantFactory::set_library_settings(
647
        const LibrarySettings& library_settings)
648
0
{
649
0
    if (rtps_domain_->set_library_settings(library_settings))
650
0
    {
651
0
        return RETCODE_OK;
652
0
    }
653
0
    return RETCODE_PRECONDITION_NOT_MET;
654
0
}
655
656
ReturnCode_t DomainParticipantFactory::get_dynamic_type_builder_from_xml_by_name(
657
        const std::string& type_name,
658
        DynamicTypeBuilder::_ref_type& type_builder)
659
0
{
660
0
    if (type_name.empty())
661
0
    {
662
0
        return RETCODE_BAD_PARAMETER;
663
0
    }
664
0
    if (XMLP_ret::XML_OK != XMLProfileManager::getDynamicTypeBuilderByName(type_builder, type_name))
665
0
    {
666
0
        return RETCODE_NO_DATA;
667
0
    }
668
0
    return RETCODE_OK;
669
0
}
670
671
} /* namespace dds */
672
} /* namespace fastdds */
673
} /* namespace eprosima */