|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
25 reader = wrappedReader;
26 if (reader->isTextMode()) {
35 if (writer->isTextMode()) {
36 writer->convertTextMode();
59 bool ok = reader->expectBlock(data, len);
61 readerStore.appendBlock(data, len);
68 std::string str = reader->expectText(terminatingChar);
69 readerStore.appendText(str, terminatingChar);
75 std::int8_t x = reader->expectInt8();
76 readerStore.appendInt8(x);
82 std::int16_t x = reader->expectInt16();
83 readerStore.appendInt16(x);
89 std::int32_t x = reader->expectInt32();
91 readerStore.appendInt32(x);
100 std::int64_t x = reader->expectInt64();
101 readerStore.appendInt64(x);
108 readerStore.appendFloat32(x);
115 readerStore.appendFloat64(x);
121 bool ok = reader->pushInt(x);
122 skipNextInt = skipNextInt || ok;
143 return reader->getSize();
148 writer = reader->getWriter();
156 return reader->getReference();
161 return reader->getRemoteContact();
166 return reader->getLocalContact();
173 return writer->isValid();
175 return reader->isValid();
182 return writer->isActive();
184 return reader->isActive();
191 return writer->isError();
193 return reader->isError();
198 writer->appendBlock(data, len);
199 writerStore.appendBlock(data, len);
204 writer->appendInt8(data);
205 writerStore.appendInt8(data);
210 writer->appendInt16(data);
211 writerStore.appendInt16(data);
216 writer->appendInt32(data);
217 writerStore.appendInt32(data);
222 writer->appendInt64(data);
223 writerStore.appendInt64(data);
228 writer->appendFloat32(data);
229 writerStore.appendFloat32(data);
234 writer->appendFloat64(data);
235 writerStore.appendFloat64(data);
240 writer->appendText(str, terminate);
241 writerStore.appendText(str, terminate);
246 writer->appendExternalBlock(data, len);
247 writerStore.appendExternalBlock(data, len);
252 writer->declareSizes(argc, argv);
257 writer->setReplyHandler(reader);
262 writer->setReference(obj);
272 bool ok = readerStore.write(connection);
274 writerStore.write(connection);
278 return readerStore.write(connection);
298 return reader->setSize(len);
size_t getSize() const override
Checks how much data is available.
void setReplyHandler(yarp::os::PortReader &reader) override
This sets a handler to deal with replies to the message.
std::int16_t expectInt16() override
Read a 16-bit integer from the network connection.
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
bool isActive() const override
This is a base class for objects that can be both read from and be written to the YARP network.
void init(yarp::os::ConnectionReader *wrappedReader)
Call this to wrap a specific ConnectionReader.
A base class for nested structures that can be searched.
const yarp::os::Searchable & getConnectionModifiers() const override
Access modifiers associated with the connection, if any.
yarp::os::SizedWriter * getBuffer() const override
bool isTextMode() const override
Check if the connection is text mode.
void appendText(const std::string &str, const char terminate) override
Send a terminated string to the network connection.
void declareSizes(int argc, int *argv) override
If you can easily determine how many blocks there are in a message, call this first,...
yarp::conf::float32_t expectFloat32() override
Read a 32-bit floating point number from the network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
A helper for creating cached object descriptions.
bool isBareMode() const override
Check if the connection is bare mode.
yarp::os::ConnectionWriter * getWriter() override
Gets a way to reply to the message, if possible.
std::int8_t expectInt8() override
Read a 8-bit integer from the network connection.
void setReference(yarp::os::Portable *obj) override
Stores a direct pointer to the object being sent.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
An interface for writing to a network connection.
void appendInt16(std::int16_t data) override
Send a representation of a 16-bit integer to the network connection.
const yarp::os::impl::BufferedConnectionWriter & getReply() const
std::string expectText(const char terminatingChar) override
Read some text from the network connection.
void fini()
Call this when all reading/writing has been done.
std::int32_t expectInt32() override
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.
bool isError() const override
void appendBlock(const char *data, size_t len) override
Send a block of data to the network connection.
const yarp::os::impl::BufferedConnectionWriter & getMessage() const
void appendExternalBlock(const char *data, size_t len) override
Send a block of data to the network connection, without making a copy.
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
An interface for reading from a network connection.
void appendFloat32(yarp::conf::float32_t data) override
Send a representation of a 32-bit floating point number to the network connection.
std::int64_t expectInt64() override
Read a 64-bit integer from the network connection.
yarp::os::Contact getLocalContact() const override
Gets information about who is receiving the data, if that information is available.
bool pushInt(int x) override
Store an integer to return on the next call to expectInt()
void requestDrop() override
Tag the connection to be dropped after the current message.
void appendFloat64(yarp::conf::float64_t data) override
Send a representation of a 64-bit floating point number to the network connection.
bool expectBlock(char *data, size_t len) override
Read a block of data from the network connection.
bool convertTextMode() override
Reads in a standard description in text mode, and converts it to a standard description in binary.
yarp::os::Contact getRemoteContact() const override
Gets information about who is supplying the data being read, if that information is available.
void appendInt32(std::int32_t data) override
Send a representation of a 32-bit integer to the network connection.
bool setSize(size_t len) override
yarp::conf::float64_t expectFloat64() override
Read a 64-bit floating point number from the network connection.
bool isValid() const override
yarp::os::Portable * getReference() const override
Get a direct pointer to the object being sent, if possible.
void appendInt8(std::int8_t data) override
Send a representation of a 8-bit integer to the network connection.
Minimal requirements for an efficient Writer.
void appendInt64(std::int64_t data) override
Send a representation of a 64-bit integer to the network connection.