From 6d5fa34db0034325c89a04ab339e5fa96aa41ceb Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Wed, 3 Jul 2024 07:33:20 +0200 Subject: [PATCH] Remove doxygen warnings (#154) Signed-off-by: eduponz (cherry picked from commit 9d1675c2f8e5c103015e66e62390767f482e3644) # Conflicts: # fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i # fastdds_python/src/swig/fastdds/dds/subscriber/DataReader.i --- .../fastdds/dds/domain/DomainParticipant.i | 268 ++++++++++++++++++ .../swig/fastdds/dds/publisher/DataWriter.i | 1 + .../swig/fastdds/dds/subscriber/DataReader.i | 87 ++++++ .../swig/fastdds/rtps/common/InstanceHandle.i | 1 + 4 files changed, 357 insertions(+) diff --git a/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i b/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i index ec1bcb2c..23246ec1 100644 --- a/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i +++ b/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i @@ -16,8 +16,276 @@ #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(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(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(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(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 +%template(DomainParticipantVector) std::vector; +%typemap(doctype) std::vector "DomainParticipantVector"; + %include "fastdds/dds/domain/DomainParticipant.hpp" diff --git a/fastdds_python/src/swig/fastdds/dds/publisher/DataWriter.i b/fastdds_python/src/swig/fastdds/dds/publisher/DataWriter.i index 78a4539b..365902e8 100644 --- a/fastdds_python/src/swig/fastdds/dds/publisher/DataWriter.i +++ b/fastdds_python/src/swig/fastdds/dds/publisher/DataWriter.i @@ -48,6 +48,7 @@ // Template for std::vector %template(DataWriterVector) std::vector; +%typemap(doctype) std::vector "DataWriterVector"; %include "fastdds/dds/publisher/DataWriter.hpp" diff --git a/fastdds_python/src/swig/fastdds/dds/subscriber/DataReader.i b/fastdds_python/src/swig/fastdds/dds/subscriber/DataReader.i index 7726cc51..0ed19f14 100644 --- a/fastdds_python/src/swig/fastdds/dds/subscriber/DataReader.i +++ b/fastdds_python/src/swig/fastdds/dds/subscriber/DataReader.i @@ -18,7 +18,10 @@ // Template for std::vector %template(DataReaderVector) std::vector; +%typemap(doctype) std::vector "DataReaderVector"; + %template(SampleInfoSeq) eprosima::fastdds::dds::LoanableSequence; +%typemap(doctype) eprosima::fastdds::dds::LoanableSequence "SampleInfoSeq"; %extend eprosima::fastdds::dds::LoanableSequence { size_t __len__() const @@ -32,4 +35,88 @@ } } +<<<<<<< HEAD +======= + +%extend eprosima::fastdds::dds::DataReader +{ + ReturnCode_t set_listener( + DataReaderListener* listener) + { + eprosima::fastdds::dds::DataReaderListener* old_listener = + const_cast(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; + } + + ReturnCode_t set_listener( + DataReaderListener* listener, + const StatusMask& mask) + { + eprosima::fastdds::dds::DataReaderListener* old_listener = + const_cast(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; + } +} + +%ignore eprosima::fastdds::dds::DataReader::set_listener; + +>>>>>>> 9d1675c (Remove doxygen warnings (#154)) %include "fastdds/dds/subscriber/DataReader.hpp" diff --git a/fastdds_python/src/swig/fastdds/rtps/common/InstanceHandle.i b/fastdds_python/src/swig/fastdds/rtps/common/InstanceHandle.i index 97a0580c..5ea7b280 100644 --- a/fastdds_python/src/swig/fastdds/rtps/common/InstanceHandle.i +++ b/fastdds_python/src/swig/fastdds/rtps/common/InstanceHandle.i @@ -77,6 +77,7 @@ long hash(const eprosima::fastrtps::rtps::InstanceHandle_t& handle) // Template for std::vector %template(InstanceHandleVector) std::vector; +%typemap(doctype) std::vector"InstanceHandleVector"; %include "fastdds/rtps/common/InstanceHandle.h"