Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21808] DataWriter/Reader get_matched_publication/subscription() Tests & Feature 3.x #5312

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Mario-DL
Copy link
Member

@Mario-DL Mario-DL commented Oct 9, 2024

Description

This PR is a forward port of #5284, implementing the following APIs

DDS

  • DataWriter::get_matched_subscriptions()
  • DataWriter::get_matched_subscription_data()
  • DataReader::get_matched_publications()
  • DataReader::get_matched_publication_data()

RTPS

  • RTPSParticipant::get_publication_info()
  • RTPSParticipant::get_subscription_info()
  • RTPSReader::matched_writers_guids()
  • RTPSWriter::matched_readers_guids()

In the 3.x series.

Related PRs:

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • Any new/modified methods have been properly documented using Doxygen.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • Changes are API compatible.
  • New feature has been added to the versions.md file (if applicable).
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • N/A Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@Mario-DL Mario-DL added this to the v3.2.0 milestone Oct 9, 2024
@Mario-DL Mario-DL requested review from richiprosima and removed request for richiprosima October 9, 2024 08:35
@github-actions github-actions bot added the ci-pending PR which CI is running label Oct 9, 2024
@Mario-DL Mario-DL requested review from richiprosima and removed request for richiprosima October 9, 2024 12:55
@richiware richiware self-requested a review October 17, 2024 08:03
Copy link
Member

@richiware richiware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also pending a PR to Python bindings.

* @brief Retrieves in a subscription associated with the DataWriter
*
* @param[out] subscription_data subscription data struct
* @param subscription_handle InstanceHandle_t of the subscription
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param subscription_handle InstanceHandle_t of the subscription
* @param subscription_handle @ref InstanceHandle_t of the subscription

*
* @param[out] subscription_data subscription data struct
* @param subscription_handle InstanceHandle_t of the subscription
* @return RETCODE_BAD_PARAMETER if the DataWriter is not matched with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return RETCODE_BAD_PARAMETER if the DataWriter is not matched with
* @return @ref RETCODE_BAD_PARAMETER if the DataWriter is not matched with

* @param[out] subscription_data subscription data struct
* @param subscription_handle InstanceHandle_t of the subscription
* @return RETCODE_BAD_PARAMETER if the DataWriter is not matched with
* the given subscription handle, RETCODE_OK otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* the given subscription handle, RETCODE_OK otherwise.
* the given subscription handle, @ref RETCODE_OK otherwise.

Comment on lines 398 to 403
* @brief Fills the given vector with the InstanceHandle_t of matched DataReaders
*
* @param[out] subscription_handles Vector where the InstanceHandle_t are returned
* @return RETCODE_OK if the operation succeeds.
*
* @note Returning an empty list is not an error, it returns RETCODE_OK.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @brief Fills the given vector with the InstanceHandle_t of matched DataReaders
*
* @param[out] subscription_handles Vector where the InstanceHandle_t are returned
* @return RETCODE_OK if the operation succeeds.
*
* @note Returning an empty list is not an error, it returns RETCODE_OK.
* @brief Fills the given vector with the @ref InstanceHandle_t of matched DataReaders
*
* @param[out] subscription_handles Vector where the @ref InstanceHandle_t are returned
* @return @ref RETCODE_OK if the operation succeeds.
*
* @note Returning an empty list is not an error, it returns @ref RETCODE_OK.

Comment on lines 241 to 243
* @param publication_handle InstanceHandle_t of the publication
* @return RETCODE_BAD_PARAMETER if the DataReader is not matched with
* the given publication handle, RETCODE_OK otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param publication_handle InstanceHandle_t of the publication
* @return RETCODE_BAD_PARAMETER if the DataReader is not matched with
* the given publication handle, RETCODE_OK otherwise.
* @param publication_handle @ref InstanceHandle_t of the publication
* @return @ref RETCODE_BAD_PARAMETER if the DataReader is not matched with
* the given publication handle, @ref RETCODE_OK otherwise.

guids.reserve(matched_writers_.size());
for (const RemoteWriterInfo_t& writer : matched_writers_)
{
guids.push_back(writer.guid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
guids.push_back(writer.guid);
guids.emplace_back(writer.guid);

for_matched_readers(matched_local_readers_, matched_datasharing_readers_, matched_remote_readers_,
[&guids](const ReaderProxy* reader)
{
guids.push_back(reader->guid());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
guids.push_back(reader->guid());
guids.emplace_back(reader->guid());

std::vector<GUID_t>& guids) const
{
std::lock_guard<RecursiveTimedMutex> guard(mp_mutex);
guids.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can reserve the space like in other methods

for_matched_readers(matched_local_readers_, matched_datasharing_readers_, matched_remote_readers_,
[&guids](const ReaderLocator& reader)
{
guids.push_back(reader.remote_guid());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
guids.push_back(reader.remote_guid());
guids.emplace_back(reader.remote_guid());

std::vector<GUID_t>& guids) const
{
std::lock_guard<RecursiveTimedMutex> guard(mp_mutex);
guids.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can reserve previously like in other methods

… Test implementation 3.x

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
… Feature implementation 3.x

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-pending PR which CI is running
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants