ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ros::serialization::OStream

asked 2017-04-25 03:59:33 -0500

user_123 gravatar image

Is there any standard way of converting ros::serialization::OStream to any standard format like std::string or std::stringstream?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-04-25 05:07:24 -0500

Davide Faconti gravatar image

Hi,

I suggest you to take a look to the way it is done in tool_topics:ShapeShifter

http://docs.ros.org/diamondback/api/t...

I expect the function you want to write to look like this

void copyToString(ros::serialization::OStream& stream, std::string& output)
{
   output.resize( stream.getLength()  );
   memcpy(stream.getData(),  &output[0], stream.getLength());
}
edit flag offensive delete link more

Comments

Actually I would like to send the ros::serialization::OStream over a boost::asio::socket, I'm not sure how can I send it through a boost::socket or do I need to transform it in another format...

user_123 gravatar image user_123  ( 2017-04-25 23:51:19 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-04-25 03:59:33 -0500

Seen: 468 times

Last updated: Apr 25 '17