Skip to content

Commit

Permalink
Add rmw_publisher_wait_for_all_acked (#188)
Browse files Browse the repository at this point in the history
Signed-off-by: Barry Xu <barry.xu@sony.com>
  • Loading branch information
Barry-Xu-2018 authored Jun 17, 2021
1 parent 6454f91 commit a2e93cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rmw_implementation/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ RMW_INTERFACE_FN(
rmw_ret_t, RMW_RET_ERROR,
1, ARG_TYPES(const rmw_publisher_t *))

RMW_INTERFACE_FN(
rmw_publisher_wait_for_all_acked,
rmw_ret_t, RMW_RET_ERROR,
2, ARG_TYPES(const rmw_publisher_t *, rmw_time_t))

RMW_INTERFACE_FN(
rmw_serialize,
rmw_ret_t, RMW_RET_ERROR,
Expand Down Expand Up @@ -702,6 +707,7 @@ void prefetch_symbols(void)
GET_SYMBOL(rmw_publisher_event_init)
GET_SYMBOL(rmw_publish_serialized_message)
GET_SYMBOL(rmw_publisher_assert_liveliness)
GET_SYMBOL(rmw_publisher_wait_for_all_acked)
GET_SYMBOL(rmw_get_serialized_message_size)
GET_SYMBOL(rmw_serialize)
GET_SYMBOL(rmw_deserialize)
Expand Down Expand Up @@ -804,6 +810,7 @@ unload_library()
symbol_rmw_publish_serialized_message = nullptr;
symbol_rmw_get_serialized_message_size = nullptr;
symbol_rmw_publisher_assert_liveliness = nullptr;
symbol_rmw_publisher_wait_for_all_acked = nullptr;
symbol_rmw_serialize = nullptr;
symbol_rmw_deserialize = nullptr;
symbol_rmw_init_subscription_allocation = nullptr;
Expand Down
9 changes: 9 additions & 0 deletions test_rmw_implementation/test/test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,15 @@ TEST_F(CLASSNAME(TestPublisherUse, RMW_IMPLEMENTATION), publish_serialized_with_
});
}

TEST_F(CLASSNAME(TestPublisherUse, RMW_IMPLEMENTATION), wait_for_all_acked_with_best_effort) {
// For best effort, alway return RMW_RET_OK immediately
rmw_ret_t ret = rmw_publisher_wait_for_all_acked(pub, {0, 0});
EXPECT_EQ(ret, RMW_RET_OK);

ret = rmw_publisher_wait_for_all_acked(nullptr, {0, 0});
EXPECT_EQ(ret, RMW_RET_INVALID_ARGUMENT);
}


class CLASSNAME (TestPublisherUseLoan, RMW_IMPLEMENTATION)
: public CLASSNAME(TestPublisherUse, RMW_IMPLEMENTATION)
Expand Down

0 comments on commit a2e93cd

Please sign in to comment.