Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@

%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)
{
Expand Down Expand Up @@ -55,6 +61,13 @@
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)
Expand Down Expand Up @@ -93,6 +106,14 @@
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,
Expand All @@ -113,6 +134,41 @@
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)
{
Expand All @@ -135,6 +191,14 @@
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,
Expand All @@ -155,6 +219,41 @@
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)
{
Expand Down Expand Up @@ -183,8 +282,10 @@
%ignore eprosima::fastdds::dds::DomainParticipant::~DomainParticipant;
%ignore eprosima::fastdds::dds::DomainParticipant::set_listener;
%ignore eprosima::fastdds::dds::DomainParticipant::create_publisher;
%ignore eprosima::fastdds::dds::DomainParticipant::create_publisher_with_profile;
%ignore eprosima::fastdds::dds::DomainParticipant::create_subscriber;
%ignore eprosima::fastdds::dds::DomainParticipant::delete_publisher;
%ignore eprosima::fastdds::dds::DomainParticipant::delete_subscriber;
%ignore eprosima::fastdds::dds::DomainParticipant::create_subscriber_with_profile;

%include "fastdds/dds/domain/DomainParticipant.hpp"
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
*/
%extend eprosima::fastdds::dds::DomainParticipantFactory
{
/**
* Create a Participant.
*
* @param domain_id Domain Id.
* @param qos DomainParticipantQos Reference.
* @param listener DomainParticipantListener Pointer (default: nullptr)
* @param mask StatusMask Reference (default: all)
* @return DomainParticipant pointer. (nullptr if not created.)
*/
DomainParticipant* create_participant(
DomainId_t domain_id,
const DomainParticipantQos& qos,
Expand All @@ -44,6 +53,71 @@
return self->create_participant(domain_id, qos, listener, mask);
}

/**
* Create a Participant.
*
* @param domain_id Domain Id.
* @param profile_name Participant profile name.
* @param listener DomainParticipantListener Pointer (default: nullptr)
* @param mask StatusMask Reference (default: all)
* @return DomainParticipant pointer. (nullptr if not created.)
*/
DomainParticipant* create_participant_with_profile(
DomainId_t domain_id,
const std::string& profile_name,
DomainParticipantListener* 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_participant_with_profile(domain_id, profile_name, listener, mask);
}

/**
* Create a Participant.
*
* @param profile_name Participant profile name.
* @param listener DomainParticipantListener Pointer (default: nullptr)
* @param mask StatusMask Reference (default: all)
* @return DomainParticipant pointer. (nullptr if not created.)
*/
DomainParticipant* create_participant_with_profile(
const std::string& profile_name,
DomainParticipantListener* 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_participant_with_profile(profile_name, listener, mask);
}

/**
* Remove a Participant and all associated publishers and subscribers.
*
* @param part Pointer to the participant.
* @return RETCODE_PRECONDITION_NOT_MET if the participant has active entities, RETCODE_OK if the participant is correctly
* deleted and RETCODE_ERROR otherwise.
*/
ReturnCode_t delete_participant(
DomainParticipant* part)
{
Expand All @@ -68,6 +142,7 @@
}

%ignore eprosima::fastdds::dds::DomainParticipantFactory::create_participant;
%ignore eprosima::fastdds::dds::DomainParticipantFactory::create_participant_with_profile;
%ignore eprosima::fastdds::dds::DomainParticipantFactory::delete_participant;

%include "fastdds/dds/domain/DomainParticipantFactory.hpp"
69 changes: 69 additions & 0 deletions fastdds_python/src/swig/fastdds/dds/publisher/Publisher.i
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@

%extend eprosima::fastdds::dds::Publisher
{
/**
* Modifies the PublisherListener, sets the mask to StatusMask::all()
*
* @param listener new value for the PublisherListener
* @return RETCODE_OK
*/
ReturnCode_t set_listener(
PublisherListener* listener)
{
Expand Down Expand Up @@ -55,6 +61,14 @@
return ret;
}


/**
* Modifies the PublisherListener.
*
* @param listener new value for the PublisherListener
* @param mask StatusMask that holds statuses the listener responds to
* @return RETCODE_OK
*/
ReturnCode_t set_listener(
PublisherListener* listener,
const StatusMask& mask)
Expand Down Expand Up @@ -93,6 +107,15 @@
return ret;
}

/**
* This operation creates a DataWriter. The returned DataWriter will be attached and belongs to the Publisher.
*
* @param topic Topic the DataWriter will be listening
* @param qos QoS of the DataWriter.
* @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 DataWriter. nullptr if failed.
*/
DataWriter* create_datawriter(
Topic* topic,
const DataWriterQos& writer_qos,
Expand All @@ -114,6 +137,51 @@
return self->create_datawriter(topic, writer_qos, listener, mask);
}

/**
* This operation creates a DataWriter. The returned DataWriter will be attached and belongs to the Publisher.
*
* @param topic Topic the DataWriter will be listening
* @param profile_name DataWriter 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 DataWriter. nullptr if failed.
*/
DataWriter* create_datawriter_with_profile(
Topic* topic,
const std::string& profile_name,
DataWriterListener* 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_datawriter_with_profile(topic, profile_name, listener, mask);
}

/**
* This operation deletes a DataWriter that belongs to the Publisher.
*
* The delete_datawriter operation must be called on the same Publisher object used to create the DataWriter.
* If delete_datawriter is called on a different Publisher, the operation will have no effect and it will
* return false.
*
* The deletion of the DataWriter will automatically unregister all instances.
* Depending on the settings of the WRITER_DATA_LIFECYCLE QosPolicy, the deletion of the DataWriter
* may also dispose all instances.
*
* @param writer DataWriter to delete
* @return RETCODE_PRECONDITION_NOT_MET if it does not belong to this Publisher, RETCODE_OK if it is correctly deleted and
* RETCODE_ERROR otherwise.
*/
ReturnCode_t delete_datawriter(
const DataWriter* writer)
{
Expand Down Expand Up @@ -141,6 +209,7 @@
%ignore eprosima::fastdds::dds::Publisher::~Publisher;
%ignore eprosima::fastdds::dds::Publisher::set_listener;
%ignore eprosima::fastdds::dds::Publisher::create_datawriter;
%ignore eprosima::fastdds::dds::Publisher::create_datawriter_with_profile;
%ignore eprosima::fastdds::dds::Publisher::delete_datawriter;

%include "fastdds/dds/publisher/Publisher.hpp"
Loading