Skip to content

Commit

Permalink
implement matched_publications
Browse files Browse the repository at this point in the history
  • Loading branch information
trittsv committed Feb 3, 2025
1 parent 6e1f116 commit d141472
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,25 @@ AnyDataReaderDelegate::subscription_matched_status()
::dds::core::InstanceHandleSeq
AnyDataReaderDelegate::matched_publications()
{
ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported");
::dds::core::InstanceHandleSeq handleSeq;
dds_return_t rc;

dds_subscription_matched_status_t status;
rc = dds_get_subscription_matched_status (ddsc_entity, &status);
ISOCPP_DDSC_RESULT_CHECK_AND_THROW(rc, "dds_get_subscription_matched_status failed.");

if (status.current_count > 0) {
std::vector<dds_instance_handle_t> ddsc_instance_handles;
ddsc_instance_handles.resize(status.current_count);

rc = dds_get_matched_publications(ddsc_entity, ddsc_instance_handles.data(), ddsc_instance_handles.size());
ISOCPP_DDSC_RESULT_CHECK_AND_THROW(rc, "dds_get_matched_publications failed.");

for (const auto& handle : ddsc_instance_handles) {
handleSeq.push_back(::dds::core::InstanceHandle(handle));
}
}

return handleSeq;
}

Expand Down

0 comments on commit d141472

Please sign in to comment.