Replaced create_subscription_with_unique_ptr_callback with create_subscription

This commit is contained in:
Esteve Fernandez 2015-10-14 15:12:57 -07:00
parent 535008f6e8
commit b0a2b7610d
3 changed files with 11 additions and 52 deletions

View file

@ -114,35 +114,28 @@ struct AnySubscriptionCallback
{ {
const_shared_ptr_with_info_callback = callback; const_shared_ptr_with_info_callback = callback;
} }
/*
template<typename CallbackT, template<
typename CallbackT,
typename std::enable_if< typename std::enable_if<
function_traits<CallbackT>::arity == 1 rclcpp::check_argument_types<
>::type * = nullptr, CallbackT,
typename std::enable_if<
std::is_same<
typename function_traits<CallbackT>::template argument_type<0>,
typename std::unique_ptr<MessageT> typename std::unique_ptr<MessageT>
>::value >::value
>::type * = nullptr >::type * = nullptr
> >
void set(CallbackT callback) void set(CallbackT callback)
{ {
static_assert(std::is_same<
typename function_traits<CallbackT>::template argument_type<0>,
typename std::unique_ptr<MessageT>
>::value, "Not a unique pointer");
unique_ptr_callback = callback; unique_ptr_callback = callback;
} }
template<typename CallbackT, template<
typename CallbackT,
typename std::enable_if< typename std::enable_if<
function_traits<CallbackT>::arity == 2 rclcpp::check_argument_types<
>::type * = nullptr, CallbackT,
typename std::enable_if< typename std::unique_ptr<MessageT>,
std::is_same< const rmw_message_info_t &
typename function_traits<CallbackT>::template argument_type<0>,
typename std::unique_ptr<MessageT>
>::value >::value
>::type * = nullptr >::type * = nullptr
> >
@ -150,7 +143,6 @@ struct AnySubscriptionCallback
{ {
unique_ptr_with_info_callback = callback; unique_ptr_with_info_callback = callback;
} }
*/
}; };
} /* namespace any_subscription_callback */ } /* namespace any_subscription_callback */

View file

@ -164,17 +164,6 @@ public:
typename rclcpp::message_memory_strategy::MessageMemoryStrategy<MessageT>::SharedPtr typename rclcpp::message_memory_strategy::MessageMemoryStrategy<MessageT>::SharedPtr
msg_mem_strat = nullptr); msg_mem_strat = nullptr);
template<typename MessageT>
typename rclcpp::subscription::Subscription<MessageT>::SharedPtr
create_subscription_with_unique_ptr_callback(
const std::string & topic_name,
const rmw_qos_profile_t & qos_profile,
typename rclcpp::subscription::AnySubscriptionCallback<MessageT>::UniquePtrCallback callback,
rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr,
bool ignore_local_publications = false,
typename rclcpp::message_memory_strategy::MessageMemoryStrategy<MessageT>::SharedPtr
msg_mem_strat = nullptr);
/// Create a timer. /// Create a timer.
/** /**
* \param[in] period Time interval between triggers of the callback. * \param[in] period Time interval between triggers of the callback.

View file

@ -251,28 +251,6 @@ Node::create_subscription(
msg_mem_strat); msg_mem_strat);
} }
template<typename MessageT>
typename rclcpp::subscription::Subscription<MessageT>::SharedPtr
Node::create_subscription_with_unique_ptr_callback(
const std::string & topic_name,
const rmw_qos_profile_t & qos_profile,
typename rclcpp::subscription::AnySubscriptionCallback<MessageT>::UniquePtrCallback callback,
rclcpp::callback_group::CallbackGroup::SharedPtr group,
bool ignore_local_publications,
typename rclcpp::message_memory_strategy::MessageMemoryStrategy<MessageT>::SharedPtr
msg_mem_strat)
{
rclcpp::subscription::AnySubscriptionCallback<MessageT> any_subscription_callback;
any_subscription_callback.unique_ptr_callback = callback;
return this->create_subscription_internal(
topic_name,
qos_profile,
any_subscription_callback,
group,
ignore_local_publications,
msg_mem_strat);
}
template<typename MessageT> template<typename MessageT>
typename subscription::Subscription<MessageT>::SharedPtr typename subscription::Subscription<MessageT>::SharedPtr
Node::create_subscription_internal( Node::create_subscription_internal(