-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathDomainParticipant.i
More file actions
291 lines (251 loc) · 9.69 KB
/
DomainParticipant.i
File metadata and controls
291 lines (251 loc) · 9.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
// Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
%{
#include "fastdds/dds/domain/DomainParticipant.hpp"
%}
<<<<<<< HEAD
=======
%extend eprosima::fastdds::dds::DomainParticipant
{
/**
* Modifies the DomainParticipantListener, sets the mask to StatusMask::all()
*
* @param listener new value for the DomainParticipantListener
* @return RETCODE_OK
*/
ReturnCode_t set_listener(
DomainParticipantListener* listener)
{
eprosima::fastdds::dds::DomainParticipantListener* old_listener =
const_cast<eprosima::fastdds::dds::DomainParticipantListener*>(self->get_listener());
eprosima::fastrtps::types::ReturnCode_t ret = self->set_listener(listener);
if ( (eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK == ret) && (listener != old_listener) )
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
Py_INCREF(director->swig_get_self());
}
}
if (nullptr != old_listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(old_listener);
if (nullptr != director)
{
Py_DECREF(director->swig_get_self());
}
}
SWIG_PYTHON_THREAD_END_BLOCK;
}
return ret;
}
/**
* Modifies the DomainParticipantListener.
*
* @param listener new value for the DomainParticipantListener
* @param mask StatusMask that holds statuses the listener responds to
* @return RETCODE_OK
*/
ReturnCode_t set_listener(
DomainParticipantListener* listener,
const StatusMask& mask)
{
eprosima::fastdds::dds::DomainParticipantListener* old_listener =
const_cast<eprosima::fastdds::dds::DomainParticipantListener*>(self->get_listener());
eprosima::fastrtps::types::ReturnCode_t ret = self->set_listener(listener, mask);
if ( (eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK == ret) && (listener != old_listener) )
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
Py_INCREF(director->swig_get_self());
}
}
if (nullptr != old_listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(old_listener);
if (nullptr != director)
{
Py_DECREF(director->swig_get_self());
}
}
SWIG_PYTHON_THREAD_END_BLOCK;
}
return ret;
}
/**
* Create a Publisher in this Participant.
*
* @param qos QoS of the Publisher.
* @param listener Pointer to the listener (default: nullptr)
* @param mask StatusMask that holds statuses the listener responds to (default: all)
* @return Pointer to the created Publisher.
*/
Publisher* create_publisher(
const PublisherQos& qos,
PublisherListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
{
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
return self->create_publisher(qos, listener, mask);
}
/**
* Create a Publisher in this Participant.
*
* @param profile_name Publisher profile name.
* @param listener Pointer to the listener (default: nullptr)
* @param mask StatusMask that holds statuses the listener responds to (default: all)
* @return Pointer to the created Publisher.
*/
Publisher* create_publisher_with_profile(
const std::string& profile_name,
PublisherListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
{
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
return self->create_publisher_with_profile(profile_name, listener, mask);
}
/**
* Deletes an existing Publisher.
*
* @param publisher to be deleted.
* @return RETCODE_PRECONDITION_NOT_MET if the publisher does not belong to this participant or if it has active DataWriters,
* RETCODE_OK if it is correctly deleted and RETCODE_ERROR otherwise.
*/
ReturnCode_t delete_publisher(
const Publisher* publisher)
{
eprosima::fastdds::dds::PublisherListener* listener =
const_cast<eprosima::fastdds::dds::PublisherListener*>(publisher->get_listener());
eprosima::fastrtps::types::ReturnCode_t ret = self->delete_publisher(publisher);
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_DECREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
return ret;
}
/**
* Create a Subscriber in this Participant.
*
* @param qos QoS of the Subscriber.
* @param listener Pointer to the listener (default: nullptr)
* @param mask StatusMask that holds statuses the listener responds to (default: all)
* @return Pointer to the created Subscriber.
*/
Subscriber* create_subscriber(
const SubscriberQos& qos,
SubscriberListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
{
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
return self->create_subscriber(qos, listener, mask);
}
/**
* Create a Subscriber in this Participant.
*
* @param profile_name Subscriber profile name.
* @param listener Pointer to the listener (default: nullptr)
* @param mask StatusMask that holds statuses the listener responds to (default: all)
* @return Pointer to the created Subscriber.
*/
RTPS_DllAPI Subscriber* create_subscriber_with_profile(
const std::string& profile_name,
SubscriberListener* listener = nullptr,
const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all())
{
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_INCREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
return self->create_subscriber_with_profile(profile_name, listener, mask);
}
/**
* Deletes an existing Subscriber.
*
* @param subscriber to be deleted.
* @return RETCODE_PRECONDITION_NOT_MET if the subscriber does not belong to this participant or if it has active DataReaders,
* RETCODE_OK if it is correctly deleted and RETCODE_ERROR otherwise.
*/
ReturnCode_t delete_subscriber(
const Subscriber* subscriber)
{
eprosima::fastdds::dds::SubscriberListener* listener =
const_cast<eprosima::fastdds::dds::SubscriberListener*>(subscriber->get_listener());
eprosima::fastrtps::types::ReturnCode_t ret = self->delete_subscriber(subscriber);
if (nullptr != listener)
{
Swig::Director* director = SWIG_DIRECTOR_CAST(listener);
if (nullptr != director)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_DECREF(director->swig_get_self());
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
return ret;
}
}
>>>>>>> 9d1675c (Remove doxygen warnings (#154))
%ignore eprosima::fastdds::dds::DomainParticipant::has_active_entities;
%ignore eprosima::fastdds::dds::DomainParticipant::DomainParticipant;
%ignore eprosima::fastdds::dds::DomainParticipant::~DomainParticipant;
// Template for std::vector<DomainParticipant*>
%template(DomainParticipantVector) std::vector<eprosima::fastdds::dds::DomainParticipant*>;
%typemap(doctype) std::vector<eprosima::fastdds::dds::DomainParticipant*> "DomainParticipantVector";
%include "fastdds/dds/domain/DomainParticipant.hpp"