Skip to content

Commit

Permalink
Methods to retrieve matched counts on publisher and subscriber (#155)
Browse files Browse the repository at this point in the history
* Methods to retrieve matched counts on pub/sub.

* Address reviewer feedback with naming and docs.

* Fix typos.

* Apply suggestions from code review

Co-Authored-By: mjcarroll <[email protected]>
  • Loading branch information
mjcarroll authored Nov 28, 2018
1 parent 146052a commit c3b7077
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,24 @@ RMW_WARN_UNUSED
rmw_ret_t
rmw_publish(const rmw_publisher_t * publisher, const void * ros_message);

/// Retrieve the number of matched subscriptions to a publisher.
/**
* Query the underlying middleware to determine how many subscriptions are
* matched to a given publisher.
*
* \param[in] publisher the publisher object to inspect
* \param[out] subscription_count the number of subscriptions matched
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INVALID_ARGUMENT` if either argument is null, or
* \return `RMW_RET_ERROR` if an unexpected error occurs.
*/
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_publisher_count_matched_subscriptions(
const rmw_publisher_t * publisher,
size_t * subscription_count);

/// Publish an already serialized message.
/**
* The publisher must already be registered with the correct message type
Expand Down Expand Up @@ -267,6 +285,24 @@ RMW_WARN_UNUSED
rmw_ret_t
rmw_destroy_subscription(rmw_node_t * node, rmw_subscription_t * subscription);

/// Retrieve the number of matched publishers to a subscription.
/**
* Query the underlying middleware to determine how many publishers are
* matched to a given subscription.
*
* \param[in] subscription the subscription object to inspect
* \param[out] publisher_count the number of publishers matched
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INVALID_ARGUMENT` if either argument is null, or
* \return `RMW_RET_ERROR` if an unexpected error occurs.
*/
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_subscription_count_matched_publishers(
const rmw_subscription_t * subscription,
size_t * publisher_count);

RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
Expand Down

0 comments on commit c3b7077

Please sign in to comment.