|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
24 flush_if_needed =
false;
26 support_get_mode =
false;
38 if (flush_if_needed) {
46 flush_if_needed =
true;
56 support_get_mode =
true;
61 size_t pending = reader.
getSize();
65 size_t next = (pending <
sizeof(buf)) ? pending :
sizeof(buf);
83 return obj.
read(*
this);
88 return obj.
read(reader);
93 return obj.
read(reader);
98 return obj.
read(reader);
103 if (state->
code < 0) {
116 x = (v != 0) && (v != VOCAB_FAIL);
123 std::int32_t tag = state->
code;
138 x =
static_cast<std::int8_t
>(reader.
expectInt32());
150 std::int32_t tag = state->
code;
162 x =
static_cast<std::int16_t
>(reader.
expectInt8());
168 x =
static_cast<std::int16_t
>(reader.
expectInt32());
180 std::int32_t tag = state->
code;
192 x =
static_cast<std::int32_t
>(reader.
expectInt8());
195 x =
static_cast<std::int32_t
>(reader.
expectInt16());
209 std::int32_t tag = state->
code;
221 x =
static_cast<std::int64_t
>(reader.
expectInt8());
224 x =
static_cast<std::int64_t
>(reader.
expectInt16());
227 x =
static_cast<std::int64_t
>(reader.
expectInt32());
242 std::int32_t tag = state->
code;
281 std::int32_t tag = state->
code;
321 std::int32_t tag = state->
code;
341 if (state->
len <= 0) {
344 std::int32_t tag = state->
code;
345 if (state->
code < 0) {
356 if (is_vocab !=
nullptr) {
369 if (is_vocab !=
nullptr) {
383 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
389 if (state->
len <= 0) {
392 if (state->
code < 0) {
420 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
426 std::int32_t tag = state->
code;
458 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
464 x =
static_cast<std::int32_t
>(converter.
fromString(str));
498 return len == state->
len;
506 if (!support_get_mode) {
509 if (state->
len == 1) {
512 if (state->
len != 4) {
534 flush_if_needed =
false;
536 if (writer !=
nullptr) {
554 flush_if_needed =
true;
561 scanString(str, is_vocab);
565 while (is_vocab && state->
len > 0) {
566 if (state->
code >= 0) {
581 scanString(str2, is_vocab);
597 len =
static_cast<std::uint32_t
>(state->
len);
630 if (!flush_if_needed) {
633 size_t pending = reader.
getSize();
637 void WireReader::scanString(std::string& str,
bool is_vocab)
639 if (!support_get_mode) {
642 if (get_string.empty()) {
643 if (get_mode && get_string.empty()) {
645 get_is_vocab = is_vocab;
646 }
else if (str ==
"get") {
A simple collection of objects that can be described and transmitted in a portable way.
bool readI16(std::int16_t &x)
bool readString(std::string &str, bool *is_vocab=nullptr)
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
virtual bool read(ConnectionReader &reader)=0
Read this object from a network connection.
virtual bool read(yarp::os::idl::WireReader &reader)
bool readFloat32(yarp::conf::float32_t &x)
#define BOTTLE_TAG_STRING
bool readBinary(std::string &str)
virtual size_t getSize() const =0
Checks how much data is available.
virtual bool isValid() const =0
const std::string & getString() const
WireReader(ConnectionReader &reader)
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
ConnectionWriter & getWriter()
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
#define BOTTLE_TAG_FLOAT32
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual std::int64_t expectInt64()=0
Read a 64-bit integer from the network connection.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
bool readI64(std::int64_t &x)
bool readNested(WirePortable &obj)
void readListBegin(yarp::os::idl::WireState &nstate, std::uint32_t &len)
bool read(WirePortable &obj)
An interface for reading from a network connection.
#define BOTTLE_TAG_FLOAT64
bool readEnum(std::int32_t &x, yarp::os::idl::WireVocab &converter)
virtual std::int16_t expectInt16()=0
Read a 16-bit integer from the network connection.
virtual bool pushInt(int x)=0
Store an integer to return on the next call to expectInt()
An interface to the operating system, including Port based communication.
virtual int fromString(const std::string &input)=0
virtual yarp::conf::float32_t expectFloat32()=0
Read a 32-bit floating point number from the network connection.
constexpr yarp::conf::vocab32_t VOCAB_IS
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
bool readI32(std::int32_t &x)
bool readFloat64(yarp::conf::float64_t &x)
void readMapBegin(yarp::os::idl::WireState &nstate, yarp::os::idl::WireState &nstate2, std::uint32_t &len)
void readSetBegin(yarp::os::idl::WireState &nstate, std::uint32_t &len)
bool readI8(std::int8_t &x)
bool readVocab(std::int32_t &x)