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