Skip to content

Commit

Permalink
enabled publishing of rcl_serialized_message_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hampp committed Apr 17, 2020
1 parent e90f043 commit 9f6d560
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rclcpp/include/rclcpp/publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ class Publisher : public PublisherBase
this->do_publish_message(msg);
}

template<class T = MessageT>
typename std::enable_if<!std::is_same<T, rcl_serialized_message_t>::value>::type
publish(const rcl_serialized_message_t & serialized_msg)
{
this->do_publish_message<rcl_serialized_message_t>(serialized_msg);
}

/// Publish a serialized message. Non specialized version to prevent compiling errors.
template<typename TDeleter, typename T>
void publish(std::unique_ptr<T, TDeleter> serialized_msg)
Expand Down Expand Up @@ -322,7 +329,7 @@ class Publisher : public PublisherBase

template<class T = MessageT>
typename std::enable_if<std::is_same<T, rcl_serialized_message_t>::value>::type
do_publish_message(const MessageT & msg)
do_publish_message(const T & msg)
{
// Kept for backwards compatibility. Copies compelete memory!
this->publish(std::make_unique<rclcpp::experimental::SerializedMessage>(msg));
Expand Down

0 comments on commit 9f6d560

Please sign in to comment.