Skip to content

Commit

Permalink
Remove doxygen warnings (#154)
Browse files Browse the repository at this point in the history
Signed-off-by: eduponz <[email protected]>
(cherry picked from commit 9d1675c)

# Conflicts:
#	fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i
#	fastdds_python/src/swig/fastdds/dds/subscriber/DataReader.i
  • Loading branch information
EduPonz authored and mergify[bot] committed Jul 3, 2024
1 parent e9b617c commit 6d5fa34
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 0 deletions.
268 changes: 268 additions & 0 deletions fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i
Original file line number Diff line number Diff line change
Expand Up @@ -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<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"
1 change: 1 addition & 0 deletions fastdds_python/src/swig/fastdds/dds/publisher/DataWriter.i
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

// Template for std::vector<DataWriter*>
%template(DataWriterVector) std::vector<eprosima::fastdds::dds::DataWriter*>;
%typemap(doctype) std::vector<eprosima::fastdds::dds::DataWriter*> "DataWriterVector";

%include "fastdds/dds/publisher/DataWriter.hpp"

Expand Down
87 changes: 87 additions & 0 deletions fastdds_python/src/swig/fastdds/dds/subscriber/DataReader.i
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

// Template for std::vector<DataReader*>
%template(DataReaderVector) std::vector<eprosima::fastdds::dds::DataReader*>;
%typemap(doctype) std::vector<eprosima::fastdds::dds::DataReader*> "DataReaderVector";

%template(SampleInfoSeq) eprosima::fastdds::dds::LoanableSequence<eprosima::fastdds::dds::SampleInfo>;
%typemap(doctype) eprosima::fastdds::dds::LoanableSequence<eprosima::fastdds::dds::SampleInfo> "SampleInfoSeq";
%extend eprosima::fastdds::dds::LoanableSequence<eprosima::fastdds::dds::SampleInfo>
{
size_t __len__() const
Expand All @@ -32,4 +35,88 @@
}
}

<<<<<<< HEAD
=======

%extend eprosima::fastdds::dds::DataReader
{
ReturnCode_t set_listener(
DataReaderListener* listener)
{
eprosima::fastdds::dds::DataReaderListener* old_listener =
const_cast<eprosima::fastdds::dds::DataReaderListener*>(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<eprosima::fastdds::dds::DataReaderListener*>(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"
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ long hash(const eprosima::fastrtps::rtps::InstanceHandle_t& handle)

// Template for std::vector<InstanceHandle_t>
%template(InstanceHandleVector) std::vector<eprosima::fastrtps::rtps::InstanceHandle_t>;
%typemap(doctype) std::vector<eprosima::fastrtps::rtps::InstanceHandle_t>"InstanceHandleVector";

%include "fastdds/rtps/common/InstanceHandle.h"

Expand Down

0 comments on commit 6d5fa34

Please sign in to comment.