@@ -188,6 +188,24 @@ RMW_WARN_UNUSED
188188rmw_ret_t
189189rmw_publish (const rmw_publisher_t * publisher , const void * ros_message );
190190
191+ /// Retrieve the number of matched subscriptions to a publisher.
192+ /**
193+ * Query the underlying middleware to determine how many subscriptions are
194+ * matched to a given publisher.
195+ *
196+ * \param[in] publisher the publisher object to inspect
197+ * \param[out] subscription_count the number of subscriptions matched
198+ * \return `RMW_RET_OK` if successful, or
199+ * \return `RMW_RET_INVALID_ARGUMENT` if either argument is null, or
200+ * \return `RMW_RET_ERROR` if an unexpected error occurs.
201+ */
202+ RMW_PUBLIC
203+ RMW_WARN_UNUSED
204+ rmw_ret_t
205+ rmw_publisher_count_matched_subscriptions (
206+ const rmw_publisher_t * publisher ,
207+ size_t * subscription_count );
208+
191209/// Publish an already serialized message.
192210/**
193211 * The publisher must already be registered with the correct message type
@@ -267,6 +285,24 @@ RMW_WARN_UNUSED
267285rmw_ret_t
268286rmw_destroy_subscription (rmw_node_t * node , rmw_subscription_t * subscription );
269287
288+ /// Retrieve the number of matched publishers to a subscription.
289+ /**
290+ * Query the underlying middleware to determine how many publishers are
291+ * matched to a given subscription.
292+ *
293+ * \param[in] subscription the subscription object to inspect
294+ * \param[out] publisher_count the number of publishers matched
295+ * \return `RMW_RET_OK` if successful, or
296+ * \return `RMW_RET_INVALID_ARGUMENT` if either argument is null, or
297+ * \return `RMW_RET_ERROR` if an unexpected error occurs.
298+ */
299+ RMW_PUBLIC
300+ RMW_WARN_UNUSED
301+ rmw_ret_t
302+ rmw_subscription_count_matched_publishers (
303+ const rmw_subscription_t * subscription ,
304+ size_t * publisher_count );
305+
270306RMW_PUBLIC
271307RMW_WARN_UNUSED
272308rmw_ret_t
0 commit comments