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

ContentFilteredTopic Support #706

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions rcl/include/rcl/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,15 @@ RCL_PUBLIC
bool
rcl_subscription_can_loan_messages(const rcl_subscription_t * subscription);

/// Check if subscription instance support ContentFilteredTopic.
/**
* Depending on the middleware.
* this will return true if the middleware can support ContentFilteredTopic.
*/
RCL_PUBLIC
bool
rcl_subscription_is_cft_supported(const rcl_subscription_t * subscription);

#ifdef __cplusplus
}
#endif
Expand Down
9 changes: 9 additions & 0 deletions rcl/src/rcl/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,15 @@ rcl_subscription_can_loan_messages(const rcl_subscription_t * subscription)
return subscription->impl->rmw_handle->can_loan_messages;
}

bool
rcl_subscription_is_cft_supported(const rcl_subscription_t * subscription)
{
if (!rcl_subscription_is_valid(subscription)) {
return false; // error message already set
}
return subscription->impl->rmw_handle->is_cft_supported;
}

#ifdef __cplusplus
}
#endif
4 changes: 4 additions & 0 deletions rcl/test/rcl/test_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ TEST_F(CLASSNAME(TestSubscriptionFixtureInit, RMW_IMPLEMENTATION), test_subscrip
rcl_reset_error();
EXPECT_FALSE(rcl_subscription_can_loan_messages(nullptr));
rcl_reset_error();
EXPECT_FALSE(rcl_subscription_is_cft_supported(nullptr));
rcl_reset_error();
EXPECT_EQ(NULL, rcl_subscription_get_rmw_handle(nullptr));
rcl_reset_error();
EXPECT_EQ(NULL, rcl_subscription_get_topic_name(nullptr));
Expand All @@ -742,6 +744,8 @@ TEST_F(CLASSNAME(TestSubscriptionFixtureInit, RMW_IMPLEMENTATION), test_subscrip
rcl_reset_error();
EXPECT_FALSE(rcl_subscription_can_loan_messages(&subscription_zero_init));
rcl_reset_error();
EXPECT_FALSE(rcl_subscription_is_cft_supported(&subscription_zero_init));
rcl_reset_error();
EXPECT_EQ(NULL, rcl_subscription_get_rmw_handle(&subscription_zero_init));
rcl_reset_error();
EXPECT_EQ(NULL, rcl_subscription_get_topic_name(&subscription_zero_init));
Expand Down