Coverage Report

Created: 2025-06-13 06:46

/src/Fast-DDS/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp
Line
Count
Source (jump to first uncovered line)
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 DomainParticipantQos.hpp
17
 *
18
 */
19
20
#ifndef FASTDDS_DDS_DOMAIN_QOS__DOMAINPARTICIPANTQOS_HPP
21
#define FASTDDS_DDS_DOMAIN_QOS__DOMAINPARTICIPANTQOS_HPP
22
23
#include <string>
24
25
#include <fastdds/dds/core/policy/QosPolicies.hpp>
26
#include <fastdds/rtps/attributes/BuiltinTransports.hpp>
27
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
28
#include <fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp>
29
#include <fastdds/fastdds_dll.hpp>
30
31
namespace eprosima {
32
namespace fastdds {
33
namespace dds {
34
35
/**
36
 * Class DomainParticipantQos, contains all the possible Qos that can be set for a determined participant.
37
 * Please consult each of them to check for implementation details and default values.
38
 *
39
 * @ingroup FASTDDS_QOS_MODULE
40
 */
41
class DomainParticipantQos
42
{
43
public:
44
45
    friend class DomainParticipantExtendedQos;
46
47
    /*!
48
     * User defined flow controllers to use alongside.
49
     *
50
     * @since 2.4.0
51
     */
52
    using FlowControllerDescriptorList = std::vector<std::shared_ptr<fastdds::rtps::FlowControllerDescriptor>>;
53
54
    /**
55
     * @brief Constructor
56
     */
57
    FASTDDS_EXPORTED_API DomainParticipantQos()
58
4
    {
59
4
#ifdef FASTDDS_STATISTICS
60
        /*
61
         * In the case of Statistics, the following properties are set with an empty value. This is because if these
62
         * properties are set and empty during the enabling of the DomainParticipant, they are fill with the default
63
         * mechanism
64
         */
65
4
        properties_.properties().emplace_back(parameter_policy_physical_data_host, "");
66
4
        properties_.properties().emplace_back(parameter_policy_physical_data_user, "");
67
4
        properties_.properties().emplace_back(parameter_policy_physical_data_process, "");
68
4
#endif // ifdef FASTDDS_STATISTICS
69
4
    }
70
71
    /**
72
     * @brief Destructor
73
     */
74
    FASTDDS_EXPORTED_API virtual ~DomainParticipantQos()
75
1
    {
76
1
    }
77
78
    virtual bool operator ==(
79
            const DomainParticipantQos& b) const
80
0
    {
81
0
        return (this->user_data_ == b.user_data()) &&
82
0
               (this->entity_factory_ == b.entity_factory()) &&
83
0
               (this->allocation_ == b.allocation()) &&
84
0
               (this->properties_ == b.properties()) &&
85
0
               (this->wire_protocol_ == b.wire_protocol()) &&
86
0
               (this->transport_ == b.transport()) &&
87
0
               (this->name_ == b.name()) &&
88
0
               (this->builtin_controllers_sender_thread_ == b.builtin_controllers_sender_thread()) &&
89
0
               (this->timed_events_thread_ == b.timed_events_thread()) &&
90
0
               (this->discovery_server_thread_ == b.discovery_server_thread()) &&
91
0
               (this->typelookup_service_thread_ == b.typelookup_service_thread()) &&
92
#if HAVE_SECURITY
93
               (this->security_log_thread_ == b.security_log_thread()) &&
94
#endif // if HAVE_SECURITY
95
0
               (compare_flow_controllers(b));
96
0
    }
97
98
    /**
99
     * Getter for UserDataQosPolicy
100
     *
101
     * @return UserDataQosPolicy reference
102
     */
103
    const UserDataQosPolicy& user_data() const
104
0
    {
105
0
        return user_data_;
106
0
    }
107
108
    /**
109
     * Getter for UserDataQosPolicy
110
     *
111
     * @return UserDataQosPolicy reference
112
     */
113
    UserDataQosPolicy& user_data()
114
0
    {
115
0
        return user_data_;
116
0
    }
117
118
    /**
119
     * Setter for UserDataQosPolicy
120
     *
121
     * @param value UserDataQosPolicy
122
     */
123
    void user_data(
124
            const UserDataQosPolicy& value)
125
0
    {
126
0
        user_data_ = value;
127
0
    }
128
129
    /**
130
     * Getter for EntityFactoryQosPolicy
131
     *
132
     * @return EntityFactoryQosPolicy reference
133
     */
134
    const EntityFactoryQosPolicy& entity_factory() const
135
0
    {
136
0
        return entity_factory_;
137
0
    }
138
139
    /**
140
     * Getter for EntityFactoryQosPolicy
141
     *
142
     * @return EntityFactoryQosPolicy reference
143
     */
144
    EntityFactoryQosPolicy& entity_factory()
145
0
    {
146
0
        return entity_factory_;
147
0
    }
148
149
    /**
150
     * Setter for EntityFactoryQosPolicy
151
     *
152
     * @param value EntityFactoryQosPolicy
153
     */
154
    void entity_factory(
155
            const EntityFactoryQosPolicy& value)
156
0
    {
157
0
        entity_factory_ = value;
158
0
    }
159
160
    /**
161
     * Getter for ParticipantResourceLimitsQos
162
     *
163
     * @return ParticipantResourceLimitsQos reference
164
     */
165
    const ParticipantResourceLimitsQos& allocation() const
166
0
    {
167
0
        return allocation_;
168
0
    }
169
170
    /**
171
     * Getter for ParticipantResourceLimitsQos
172
     *
173
     * @return ParticipantResourceLimitsQos reference
174
     */
175
    ParticipantResourceLimitsQos& allocation()
176
0
    {
177
0
        return allocation_;
178
0
    }
179
180
    /**
181
     * Setter for ParticipantResourceLimitsQos
182
     *
183
     * @param allocation ParticipantResourceLimitsQos
184
     */
185
    void allocation(
186
            const ParticipantResourceLimitsQos& allocation)
187
0
    {
188
0
        allocation_ = allocation;
189
0
    }
190
191
    /**
192
     * Getter for PropertyPolicyQos
193
     *
194
     * @return PropertyPolicyQos reference
195
     */
196
    const PropertyPolicyQos& properties() const
197
0
    {
198
0
        return properties_;
199
0
    }
200
201
    /**
202
     * Getter for PropertyPolicyQos
203
     *
204
     * @return PropertyPolicyQos reference
205
     */
206
    PropertyPolicyQos& properties()
207
0
    {
208
0
        return properties_;
209
0
    }
210
211
    /**
212
     * Setter for PropertyPolicyQos
213
     *
214
     * @param properties PropertyPolicyQos
215
     */
216
    void properties(
217
            const PropertyPolicyQos& properties)
218
0
    {
219
0
        properties_ = properties;
220
0
    }
221
222
    /**
223
     * Getter for WireProtocolConfigQos
224
     *
225
     * @return WireProtocolConfigQos reference
226
     */
227
    const WireProtocolConfigQos& wire_protocol() const
228
0
    {
229
0
        return wire_protocol_;
230
0
    }
231
232
    /**
233
     * Getter for WireProtocolConfigQos
234
     *
235
     * @return WireProtocolConfigQos reference
236
     */
237
    WireProtocolConfigQos& wire_protocol()
238
0
    {
239
0
        return wire_protocol_;
240
0
    }
241
242
    /**
243
     * Setter for WireProtocolConfigQos
244
     *
245
     * @param wire_protocol WireProtocolConfigQos
246
     */
247
    void wire_protocol(
248
            const WireProtocolConfigQos& wire_protocol)
249
0
    {
250
0
        wire_protocol_ = wire_protocol;
251
0
    }
252
253
    /**
254
     * Getter for TransportConfigQos
255
     *
256
     * @return TransportConfigQos reference
257
     */
258
    const TransportConfigQos& transport() const
259
0
    {
260
0
        return transport_;
261
0
    }
262
263
    /**
264
     * Getter for TransportConfigQos
265
     *
266
     * @return TransportConfigQos reference
267
     */
268
    TransportConfigQos& transport()
269
0
    {
270
0
        return transport_;
271
0
    }
272
273
    /**
274
     * Setter for TransportConfigQos
275
     *
276
     * @param transport TransportConfigQos
277
     */
278
    void transport(
279
            const TransportConfigQos& transport)
280
0
    {
281
0
        transport_ = transport;
282
0
    }
283
284
    /**
285
     * Getter for the Participant name
286
     *
287
     * @return name
288
     */
289
    const fastcdr::string_255& name() const
290
0
    {
291
0
        return name_;
292
0
    }
293
294
    /**
295
     * Getter for the Participant name
296
     *
297
     * @return name
298
     */
299
    fastcdr::string_255& name()
300
0
    {
301
0
        return name_;
302
0
    }
303
304
    /**
305
     * Setter for the Participant name
306
     *
307
     * @param value New name to be set
308
     */
309
    void name(
310
            const fastcdr::string_255& value)
311
0
    {
312
0
        name_ = value;
313
0
    }
314
315
    /**
316
     * Getter for FlowControllerDescriptorList
317
     *
318
     * @return FlowControllerDescriptorList reference
319
     */
320
    FlowControllerDescriptorList& flow_controllers()
321
0
    {
322
0
        return flow_controllers_;
323
0
    }
324
325
    /**
326
     * Compares the flow controllers of two DomainParticipantQos element-wise.
327
     *
328
     * @param qos The DomainParticipantQos to compare with.
329
     * @return true if the flow controllers are the same, false otherwise.
330
     */
331
    FASTDDS_EXPORTED_API bool compare_flow_controllers(
332
            const DomainParticipantQos& qos) const;
333
334
    /**
335
     * Getter for FlowControllerDescriptorList
336
     *
337
     * @return FlowControllerDescriptorList reference
338
     */
339
    const FlowControllerDescriptorList& flow_controllers() const
340
0
    {
341
0
        return flow_controllers_;
342
0
    }
343
344
    /**
345
     * Getter for builtin flow controllers sender threads ThreadSettings
346
     *
347
     * @return rtps::ThreadSettings reference
348
     */
349
    rtps::ThreadSettings& builtin_controllers_sender_thread()
350
0
    {
351
0
        return builtin_controllers_sender_thread_;
352
0
    }
353
354
    /**
355
     * Getter for builtin flow controllers sender threads ThreadSettings
356
     *
357
     * @return rtps::ThreadSettings reference
358
     */
359
    const rtps::ThreadSettings& builtin_controllers_sender_thread() const
360
0
    {
361
0
        return builtin_controllers_sender_thread_;
362
0
    }
363
364
    /**
365
     * Provides a way of easily configuring transport related configuration on certain pre-defined scenarios with
366
     * certain options.
367
     *
368
     * @param transports Defines the transport configuration scenario to setup.
369
     * @param options Defines the options to be used in the transport configuration.
370
     */
371
    FASTDDS_EXPORTED_API void setup_transports(
372
            rtps::BuiltinTransports transports,
373
            const rtps::BuiltinTransportsOptions& options = rtps::BuiltinTransportsOptions());
374
375
    /**
376
     * Setter for the builtin flow controllers sender threads ThreadSettings
377
     *
378
     * @param value New ThreadSettings to be set
379
     */
380
    void builtin_controllers_sender_thread(
381
            const rtps::ThreadSettings& value)
382
0
    {
383
0
        builtin_controllers_sender_thread_ = value;
384
0
    }
385
386
    /**
387
     * Getter for timed event ThreadSettings
388
     *
389
     * @return rtps::ThreadSettings reference
390
     */
391
    rtps::ThreadSettings& timed_events_thread()
392
0
    {
393
0
        return timed_events_thread_;
394
0
    }
395
396
    /**
397
     * Getter for timed event ThreadSettings
398
     *
399
     * @return rtps::ThreadSettings reference
400
     */
401
    const rtps::ThreadSettings& timed_events_thread() const
402
0
    {
403
0
        return timed_events_thread_;
404
0
    }
405
406
    /**
407
     * Setter for the timed event ThreadSettings
408
     *
409
     * @param value New ThreadSettings to be set
410
     */
411
    void timed_events_thread(
412
            const rtps::ThreadSettings& value)
413
0
    {
414
0
        timed_events_thread_ = value;
415
0
    }
416
417
    /**
418
     * Getter for discovery server ThreadSettings
419
     *
420
     * @return rtps::ThreadSettings reference
421
     */
422
    rtps::ThreadSettings& discovery_server_thread()
423
0
    {
424
0
        return discovery_server_thread_;
425
0
    }
426
427
    /**
428
     * Getter for discovery server ThreadSettings
429
     *
430
     * @return rtps::ThreadSettings reference
431
     */
432
    const rtps::ThreadSettings& discovery_server_thread() const
433
0
    {
434
0
        return discovery_server_thread_;
435
0
    }
436
437
    /**
438
     * Setter for the discovery server ThreadSettings
439
     *
440
     * @param value New ThreadSettings to be set
441
     */
442
    void discovery_server_thread(
443
            const rtps::ThreadSettings& value)
444
0
    {
445
0
        discovery_server_thread_ = value;
446
0
    }
447
448
    /**
449
     * Getter for TypeLookup service ThreadSettings
450
     *
451
     * @return rtps::ThreadSettings reference
452
     */
453
    rtps::ThreadSettings& typelookup_service_thread()
454
0
    {
455
0
        return typelookup_service_thread_;
456
0
    }
457
458
    /**
459
     * Getter for TypeLookup service ThreadSettings
460
     *
461
     * @return rtps::ThreadSettings reference
462
     */
463
    const rtps::ThreadSettings& typelookup_service_thread() const
464
0
    {
465
0
        return typelookup_service_thread_;
466
0
    }
467
468
    /**
469
     * Setter for the TypeLookup service ThreadSettings
470
     *
471
     * @param value New ThreadSettings to be set
472
     */
473
    void typelookup_service_thread(
474
            const rtps::ThreadSettings& value)
475
0
    {
476
0
        typelookup_service_thread_ = value;
477
0
    }
478
479
#if HAVE_SECURITY
480
    /**
481
     * Getter for security log ThreadSettings
482
     *
483
     * @return rtps::ThreadSettings reference
484
     */
485
    rtps::ThreadSettings& security_log_thread()
486
    {
487
        return security_log_thread_;
488
    }
489
490
    /**
491
     * Getter for security log ThreadSettings
492
     *
493
     * @return rtps::ThreadSettings reference
494
     */
495
    const rtps::ThreadSettings& security_log_thread() const
496
    {
497
        return security_log_thread_;
498
    }
499
500
    /**
501
     * Setter for the security log ThreadSettings
502
     *
503
     * @param value New ThreadSettings to be set
504
     */
505
    void security_log_thread(
506
            const rtps::ThreadSettings& value)
507
    {
508
        security_log_thread_ = value;
509
    }
510
511
#endif // if HAVE_SECURITY
512
513
private:
514
515
    //!UserData Qos, implemented in the library.
516
    UserDataQosPolicy user_data_;
517
518
    //!EntityFactory Qos, implemented in the library.
519
    EntityFactoryQosPolicy entity_factory_;
520
521
    //!Participant allocation limits
522
    ParticipantResourceLimitsQos allocation_;
523
524
    //!Property policies
525
    PropertyPolicyQos properties_;
526
527
    //!Wire Protocol options
528
    WireProtocolConfigQos wire_protocol_;
529
530
    //!Transport options
531
    TransportConfigQos transport_;
532
533
    //!Name of the participant.
534
    fastcdr::string_255 name_ = "RTPSParticipant";
535
536
    /*! User defined flow controller to use alongside.
537
     *
538
     *  @since 2.4.0
539
     */
540
    FlowControllerDescriptorList flow_controllers_;
541
542
    //! Thread settings for the builtin flow controllers sender threads
543
    rtps::ThreadSettings builtin_controllers_sender_thread_;
544
545
    //! Thread settings for the timed events thread
546
    rtps::ThreadSettings timed_events_thread_;
547
548
    //! Thread settings for the discovery server thread
549
    rtps::ThreadSettings discovery_server_thread_;
550
551
    //! Thread settings for the builtin TypeLookup service requests and replies threads
552
    rtps::ThreadSettings typelookup_service_thread_;
553
554
#if HAVE_SECURITY
555
    //! Thread settings for the security log thread
556
    rtps::ThreadSettings security_log_thread_;
557
#endif // if HAVE_SECURITY
558
559
};
560
561
FASTDDS_EXPORTED_API extern const DomainParticipantQos PARTICIPANT_QOS_DEFAULT;
562
563
564
} // namespace dds
565
} // namespace fastdds
566
} // namespace eprosima
567
568
#endif // FASTDDS_DDS_DOMAIN_QOS__DOMAINPARTICIPANTQOS_HPP