Can not write an instance of `rosbag::MessageInstance` to a `rosbag::Stream`
Consider the following peace of code:
for (rosbag::View::iterator m=view.begin(); m!=view.end(); m++){
m->write(stream);
}
Where stream
is a variable of type rosbag::Stream
. When I run the code I get the error:
In file included from *.cpp:6:0:
/opt/ros/indigo/include/rosbag/bag.h: In instantiation of ‘void rosbag::Bag::readMessageDataIntoStream(const rosbag::IndexEntry&, Stream&) const [with Stream = rosbag::BZ2Stream]’:
/opt/ros/indigo/include/rosbag/message_instance.h:170:5: required from ‘void rosbag::MessageInstance::write(Stream&) const [with Stream = rosbag::BZ2Stream]’
*.cpp:194:21: required from here
/opt/ros/indigo/include/rosbag/bag.h:367:118: error: ‘class rosbag::BZ2Stream’ has no member named ‘advance’
memcpy(stream.advance(data_size), current_buffer_->getData() + index_entry.offset + bytes_read, data_size);
As you can see, internally ros library tries to call a method named .advance()
on type rosbag::Stream
. Now if we check the class reference for rosbag::Stream
we can see that there is no method named advance()
but rather advanceOffset(uint64_t nbytes)
which looks like exactly what the library tries to call internally (at least the signature implies that this is what the library needs)
None of the derived classes rosbag::UncompressedStream
nor rosbag::BZ2Stream
have a method named advance()
.
Why do I get the above mentioned error and how can I fix it?