expected primary-expression before ‘*’ token
I have written a code that converts a std::string in sensor_msgs::Laserscan::constPtr structure. The code is given below:
std::vector<char> scan_vectr;
boost::system::error_code ignored_error;
std::size_t lens=tcp_socket.read_some(boost::asio::buffer(scan_vectr),ignored_error);
std::string scan_str(scan_vectr.begin(),scan_vectr.end());
//Deserialize the std::string in sensor_msgs::LaserScan structure
std::size_t serial_size = scan_str.size();
boost::shared_array<uint8_t> buffer(new uint8_t[serial_size]);
for (std::size_t i = 0; i < serial_size; ++i)
{
buffer[i] = scan_str[i];
}
ros::serialization::IStream stream(buffer.get(), serial_size);
const sensor_msgs::LaserScan::ConstPtr scan;
ros::serialization::Serializer<const sensor_msgs::LaserScan>::read(stream,sensor_msgs::LaserScan::ConstPtr *scan);
In the last line of the code, I am getting this error...
/opt/ros/indigo/include/ros/serialization.h: In instantiation of ‘static void ros::serialization::Serializer<T>::read(Stream&, typename boost::call_traits<T>::reference) [with Stream = ros::serialization::IStream; T = const sensor_msgs::LaserScan_<std::allocator<void> >; typename boost::call_traits<T>::reference = const sensor_msgs::LaserScan_<std::allocator<void> >&]’:
/home/collab/catkin_ws/src/slam_gmapping/gmapping_server/src/slam_gmapping.cpp:315:82: required from here
/opt/ros/indigo/include/ros/serialization.h:136:5: error: ‘const struct sensor_msgs::LaserScan_<std::allocator<void> >’ has no member named ‘deserialize’
t.deserialize(stream.getData());
^
I don't know how to handle it, please someone help me to get rid of this error. Thank you.