Class MessageBufferStreamSource

Class Documentation

class MessageBufferStreamSource

A Boost IOStreams source device designed to read bytes directly from a ROS message byte array (‘uint8[]’)

Public Types

typedef char char_type
typedef boost::iostreams::source_tag category

Public Functions

explicit MessageBufferStreamSource(const std::vector<unsigned char> &data)

Construct a stream source from a previously populated data vector.

The input vector type is designed to work with ROS message fields of type ‘uint8[]’

Parameters:

data[in] A byte vector from a ROS message

MessageBufferStreamSource operator=(const MessageBufferStreamSource&) = delete

The stream source is non-copyable.

std::streamsize read(char_type *s, std::streamsize n)

Read up to n characters from the data vector.

This fulfills the Boost IOStreams source concept.

Parameters:
  • s[in] The destination location

  • n[in] The number of bytes to read from the stream

Returns:

The number of bytes read, or -1 to indicate EOF