25#ifndef YARP_ROSMSG_sensor_msgs_CompressedImage_h
26#define YARP_ROSMSG_sensor_msgs_CompressedImage_h
44 std::vector<std::uint8_t> data;
68 if (!header.
read(connection)) {
75 if (!connection.
expectBlock((
char*)format.c_str(), len)) {
82 if (len > 0 && !connection.
expectBlock((
char*)&data[0],
sizeof(std::uint8_t)*len)) {
98 if (!header.
read(connection)) {
113 for (
int i=0; i<len; i++) {
114 data[i] = (std::uint8_t)connection.
expectInt8();
123 return (connection.
isBareMode() ? readBare(connection)
124 : readBottle(connection));
130 if (!header.
write(connection)) {
153 if (!header.
write(connection)) {
165 for (
size_t i=0; i<data.size(); i++) {
176 return (connection.
isBareMode() ? writeBare(connection)
177 : writeBottle(connection));
186 static constexpr const char* typeName =
"sensor_msgs/CompressedImage";
189 static constexpr const char* typeChecksum =
"8f7a12909da2c9d3332d540a0977563f";
192 static constexpr const char* typeText =
"\
193# This message contains a compressed image\n\
195Header header # Header timestamp should be acquisition time of image\n\
196 # Header frame_id should be optical frame of camera\n\
197 # origin of frame should be optical center of cameara\n\
198 # +x should point to the right in the image\n\
199 # +y should point down in the image\n\
200 # +z should point into to plane of the image\n\
202string format # Specifies the format of the data\n\
203 # Acceptable values:\n\
205uint8[] data # Compressed image buffer\n\
207================================================================================\n\
208MSG: std_msgs/Header\n\
209# Standard metadata for higher-level stamped data types.\n\
210# This is generally used to communicate timestamped data \n\
211# in a particular coordinate frame.\n\
213# sequence ID: consecutively increasing ID \n\
215#Two-integer timestamp that is expressed as:\n\
216# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
217# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
218# time-handling sugar is provided by the client library\n\
220#Frame this data is associated with\n\
#define BOTTLE_TAG_STRING
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
static Type byName(const char *name)
Type & addProperty(const char *key, const Value &val)
A single value (typically within a Bottle).
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
bool readString(std::string &str, bool *is_vocab=nullptr)
yarp::rosmsg::sensor_msgs::CompressedImage CompressedImage
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
The main, catch-all namespace for YARP.