|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #ifndef YARP2_WIREIMAGE
11 #define YARP2_WIREIMAGE
25 namespace wire_rep_utils {
68 ros_seq_stamp({0,0,0}),
73 const std::string& frame) {
82 std::string encoding =
105 char is_bigendian = 0;
113 ros_const_header.
copy();
120 ros_seq_stamp.
seq = seq;
121 ros_seq_stamp.
sec = (int)(
t);
122 ros_seq_stamp.
nsec = (int)((
t-(
int)
t)*1e9);
125 size_t length()
const override {
return 3; }
129 size_t length(
size_t index)
const override {
133 result =
sizeof(ros_seq_stamp);
136 result = ros_const_header.
length();
148 const char *
data(
size_t index)
const override {
149 const char *result = 0 ;
152 result = (
const char *)(&ros_seq_stamp);
155 result = ros_const_header.
get();
size_t length() const override
void copy()
Makes sure data block is owned, making a copy if necessary.
#define YARP_wire_rep_utils_API
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data to the network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
#define YARP_END_PACK
Ends 1 byte packing for structs/classes.
As far as YARP is concerned, on the wire to/from ROS a raw image has:
size_t length(size_t index) const override
void update(const yarp::sig::FlexImage *img, int seq, double t)
std::string toString() const
#define YARP_BEGIN_PACK
Starts 1 byte packing for structs/classes.
const char * data(size_t index) const override
virtual void write(OutputStream &os)
An OutputStream that produces a string.
virtual size_t getPixelSize() const
Gets pixel size in memory in bytes.
size_t getRawImageSize() const
Access to the internal buffer size information (this is how much memory has been allocated for the im...
size_t width() const
Gets width of image in pixels.
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
An abstraction for a block of bytes, with optional responsibility for allocating/destroying that bloc...
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
An interface for writing to a network connection.
Image class with user control of representation details.
void startWrite() const override
Call when writing is about to begin.
size_t height() const
Gets height of image in pixels.
void stopWrite() const override
Call when all writing is finished.
A simple abstraction for a block of bytes.
size_t headerLength() const override
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual SizedWriter * getBuffer() const =0
virtual void appendString(const char *str, const char terminate='\n') final
Send a character sequence to the network connection.
The main, catch-all namespace for YARP.
bool dropRequested() override
size_t getPadding() const
Returns the number of padding bytes.
yarp::os::PortReader * getReplyHandler() override
yarp::os::Portable * getReference() override
static ConnectionWriter * createBufferedConnectionWriter()
Create a connection writer implementation that stores to a buffer which can be read later using getBu...
void init(const yarp::sig::FlexImage &img, const std::string &frame)
Minimal requirements for an efficient Writer.
unsigned char * getRawImage() const
Access to the internal image buffer.
std::int32_t NetInt32
Definition of the NetInt32 type.
virtual int getPixelCode() const
Gets pixel type identifier.