clean up publisher and subscription creation logic (#867)
* streamline creation of publishers after removing deprecated API Signed-off-by: William Woodall <william@osrfoundation.org> * use deduced template arguments to cleanup create_subscription Signed-off-by: William Woodall <william@osrfoundation.org> * add missing file Signed-off-by: William Woodall <william@osrfoundation.org> * streamline creation of subscriptions after removing deprecated API Signed-off-by: William Woodall <william@osrfoundation.org> * small subscription code cleanup to match publisher's style Signed-off-by: William Woodall <william@osrfoundation.org> * some fixes to rclcpp_lifecycle to match rclcpp Signed-off-by: William Woodall <william@osrfoundation.org> * add README to the rclcpp/detail include directory Signed-off-by: William Woodall <william@osrfoundation.org> * fixup SubscriptionBase's use of visibility macros Signed-off-by: William Woodall <william@osrfoundation.org> * reapply function to create default options, as it is still needed on Windows Signed-off-by: William Woodall <william@osrfoundation.org> * address review comments Signed-off-by: William Woodall <william@osrfoundation.org> * workaround cppcheck 1.89 syntax error Signed-off-by: William Woodall <william@osrfoundation.org>
This commit is contained in:
parent
7728d8a38c
commit
81049c42c0
22 changed files with 381 additions and 297 deletions
|
@ -166,8 +166,9 @@ public:
|
|||
create_publisher(
|
||||
const std::string & topic_name,
|
||||
const rclcpp::QoS & qos,
|
||||
const PublisherOptionsWithAllocator<AllocatorT> & options =
|
||||
create_default_publisher_options<AllocatorT>()
|
||||
const PublisherOptionsWithAllocator<AllocatorT> & options = (
|
||||
create_default_publisher_options<AllocatorT>()
|
||||
)
|
||||
);
|
||||
|
||||
/// Create and return a Subscription.
|
||||
|
@ -179,15 +180,17 @@ public:
|
|||
* \param[in] msg_mem_strat The message memory strategy to use for allocating messages.
|
||||
* \return Shared pointer to the created subscription.
|
||||
*/
|
||||
/* TODO(jacquelinekay):
|
||||
Windows build breaks when static member function passed as default
|
||||
argument to msg_mem_strat, nullptr is a workaround.
|
||||
*/
|
||||
template<
|
||||
typename MessageT,
|
||||
typename CallbackT,
|
||||
typename AllocatorT = std::allocator<void>,
|
||||
typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>>
|
||||
typename CallbackMessageT =
|
||||
typename rclcpp::subscription_traits::has_message_type<CallbackT>::type,
|
||||
typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>,
|
||||
typename MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<
|
||||
CallbackMessageT,
|
||||
AllocatorT
|
||||
>>
|
||||
std::shared_ptr<SubscriptionT>
|
||||
create_subscription(
|
||||
const std::string & topic_name,
|
||||
|
@ -195,10 +198,10 @@ public:
|
|||
CallbackT && callback,
|
||||
const SubscriptionOptionsWithAllocator<AllocatorT> & options =
|
||||
create_default_subscription_options<AllocatorT>(),
|
||||
typename rclcpp::message_memory_strategy::MessageMemoryStrategy<
|
||||
typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, AllocatorT
|
||||
>::SharedPtr
|
||||
msg_mem_strat = nullptr);
|
||||
typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = (
|
||||
MessageMemoryStrategyT::create_default()
|
||||
)
|
||||
);
|
||||
|
||||
/// Create a timer.
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue