Merge pull request #127 from ros2/publish_const_reference

small changes to make the publish const reference api work
This commit is contained in:
William Woodall 2015-10-14 13:56:17 -07:00
commit a2592d5d89

View file

@ -295,14 +295,13 @@ public:
return this->publish(unique_msg); return this->publish(unique_msg);
} }
void void
publish(const MessageT & msg) publish(const MessageT & msg)
{ {
// Avoid allocating when not using intra process. // Avoid allocating when not using intra process.
if (!store_intra_process_message_) { if (!store_intra_process_message_) {
// In this case we're not using intra process. // In this case we're not using intra process.
return this->do_inter_process_publish(msg.get()); return this->do_inter_process_publish(&msg);
} }
// Otherwise we have to allocate memory in a unique_ptr and pass it along. // Otherwise we have to allocate memory in a unique_ptr and pass it along.
std::unique_ptr<MessageT> unique_msg(new MessageT(msg)); std::unique_ptr<MessageT> unique_msg(new MessageT(msg));