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


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

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

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

Davide Faconti gravatar image


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

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


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 -0600 )edit

Question Tools



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

Seen: 446 times

Last updated: Apr 25 '17