Skip to content

Commit fb1dba6

Browse files
Create DomainParticipantExtendedQos.i (#146)
* Refs #20869: Create DomainParticipantExtendedQos.i Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #20869: Add create_participant test with ExtendedQos Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com> * Extend DomainParticipantFactory.i API Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com> --------- Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com> Co-authored-by: elianalf <62831776+elianalf@users.noreply.github.com>
1 parent 2c25e60 commit fb1dba6

4 files changed

Lines changed: 58 additions & 0 deletions

File tree

fastdds_python/src/swig/fastdds.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ namespace xtypes {
226226
%include "fastdds/dds/domain/DomainParticipantListener.i"
227227
%include "fastdds/dds/domain/qos/DomainParticipantFactoryQos.i"
228228
%include "fastdds/dds/domain/qos/DomainParticipantQos.i"
229+
%include "fastdds/dds/domain/qos/DomainParticipantExtendedQos.i"
229230
%include "fastdds/dds/domain/qos/ReplierQos.i"
230231
%include "fastdds/dds/domain/qos/RequesterQos.i"
231232
%include "fastdds/dds/domain/DomainParticipant.i"

fastdds_python/src/swig/fastdds/dds/domain/DomainParticipantFactory.i

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,34 @@
4848
return self->create_participant(domain_id, qos, listener, mask);
4949
}
5050

51+
/**
52+
* Create a Participant.
53+
*
54+
* @param extended_qos DomainParticipantExtendedQos Reference.
55+
* @param listener DomainParticipantListener Pointer (default: nullptr)
56+
* @param mask StatusMask Reference (default: all)
57+
* @return DomainParticipant pointer. (nullptr if not created.)
58+
*/
59+
DomainParticipant* create_participant(
60+
const DomainParticipantExtendedQos& extended_qos,
61+
DomainParticipantListener* listener = nullptr,
62+
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
63+
{
64+
if (nullptr != listener)
65+
{
66+
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
67+
68+
if (nullptr != director)
69+
{
70+
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
71+
Py_INCREF(director->swig_get_self());
72+
SWIG_PYTHON_THREAD_END_BLOCK;
73+
}
74+
}
75+
76+
return self->create_participant(extended_qos.domainId(), extended_qos, listener, mask);
77+
}
78+
5179
/**
5280
* Create a Participant.
5381
*
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2022 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+
#include "fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp"
17+
%}
18+
19+
%include "fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp"

fastdds_python/test/api/test_domainparticipantfactory.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ def test(status_mask_1, status_mask_2, listnr=None):
111111
m,
112112
listener)
113113

114+
# Overload 4
115+
extended_qos = fastdds.DomainParticipantExtendedQos()
116+
participant = factory.create_participant(
117+
extended_qos)
118+
assert(participant.is_enabled())
119+
assert(fastdds.StatusMask.all() == participant.get_status_mask())
120+
assert(participant is not None)
121+
assert(fastdds.RETCODE_OK ==
122+
factory.delete_participant(participant))
123+
114124

115125
def test_create_participant_with_profile():
116126
"""

0 commit comments

Comments
 (0)