21 flush_if_needed =
false;
23 support_get_mode =
false;
35 if (flush_if_needed) {
43 flush_if_needed =
true;
53 support_get_mode =
true;
58 size_t pending = reader.
getSize();
62 size_t next = (pending <
sizeof(buf)) ? pending :
sizeof(buf);
80 return obj.
read(*
this);
85 return obj.
read(reader);
90 return obj.
read(reader);
95 return obj.
read(reader);
100 if (state->
code < 0) {
113 x = (v != 0) && (v != VOCAB_FAIL);
120 std::int32_t tag = state->
code;
135 x =
static_cast<std::int8_t
>(reader.
expectInt32());
147 std::int32_t tag = state->
code;
159 x =
static_cast<std::int16_t
>(reader.
expectInt8());
165 x =
static_cast<std::int16_t
>(reader.
expectInt32());
177 std::int32_t tag = state->
code;
189 x =
static_cast<std::int32_t
>(reader.
expectInt8());
192 x =
static_cast<std::int32_t
>(reader.
expectInt16());
207 std::int32_t tag = state->
code;
219 x =
static_cast<std::int64_t
>(reader.
expectInt8());
222 x =
static_cast<std::int64_t
>(reader.
expectInt16());
225 x =
static_cast<std::int64_t
>(reader.
expectInt32());
240 std::int32_t tag = state->
code;
279 std::int32_t tag = state->
code;
318 return readI8(
reinterpret_cast<std::int8_t&
>(x));
323 return readI16(
reinterpret_cast<std::int16_t&
>(x));
328 return readI32(
reinterpret_cast<std::int32_t&
>(x));
333 return readI64(
reinterpret_cast<std::int64_t&
>(x));
338 std::int32_t tag = state->
code;
359 std::int32_t tag = state->
code;
384 if (state->
len <= 0) {
387 std::int32_t tag = state->
code;
388 if (state->
code < 0) {
399 if (is_vocab !=
nullptr) {
412 if (is_vocab !=
nullptr) {
422 if (len != 0 &&
noMore()) {
426 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
432 if (state->
len <= 0) {
435 if (state->
code < 0) {
463 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
469 std::int32_t tag = state->
code;
501 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
507 x =
static_cast<std::int32_t
>(converter.
fromString(str));
541 return len == state->
len;
549 if (!support_get_mode) {
552 if (state->
len == 1) {
555 if (state->
len != 4) {
577 flush_if_needed =
false;
579 if (writer !=
nullptr) {
597 flush_if_needed =
true;
604 scanString(str, is_vocab);
608 while (is_vocab && state->
len > 0) {
609 if (state->
code >= 0) {
624 scanString(str2, is_vocab);
640 len =
static_cast<std::uint32_t
>(state->
len);
673 if (!flush_if_needed) {
676 size_t pending = reader.
getSize();
680 void WireReader::scanString(std::string& str,
bool is_vocab)
682 if (!support_get_mode) {
685 if (get_string.empty()) {
686 if (get_mode && get_string.empty()) {
688 get_is_vocab = is_vocab;
689 }
else if (str ==
"get") {
#define BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_STRING
#define BOTTLE_TAG_VOCAB32
#define BOTTLE_TAG_FLOAT32
constexpr yarp::conf::vocab32_t VOCAB_IS
A simple collection of objects that can be described and transmitted in a portable way.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
An interface for reading from a network connection.
virtual size_t getSize() const =0
Checks how much data is available.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool pushInt(int x)=0
Store an integer to return on the next call to expectInt()
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 yarp::conf::float32_t expectFloat32()=0
Read a 32-bit floating point number from the network connection.
virtual std::int64_t expectInt64()=0
Read a 64-bit integer from the network connection.
virtual bool isValid() const =0
virtual bool isError() const =0
virtual std::int16_t expectInt16()=0
Read a 16-bit integer from the network connection.
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
An interface for writing to a network connection.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
virtual bool read(ConnectionReader &reader)=0
Read this object from a network connection.
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
virtual bool read(yarp::os::idl::WireReader &reader)
const std::string & getString() const
bool getIsVocab32() const
ConnectionWriter & getWriter()
bool readVocab32(yarp::conf::vocab32_t &x)
bool readEnum(std::int32_t &x, yarp::os::idl::WireVocab &converter)
bool readNested(WirePortable &obj)
bool readUI8(std::uint8_t &x)
bool readString(std::string &str, bool *is_vocab=nullptr)
void readMapBegin(yarp::os::idl::WireState &nstate, yarp::os::idl::WireState &nstate2, std::uint32_t &len)
bool readUI16(std::uint16_t &x)
bool readUI32(std::uint32_t &x)
bool readFloat32(yarp::conf::float32_t &x)
bool readI32(std::int32_t &x)
void readSetBegin(yarp::os::idl::WireState &nstate, std::uint32_t &len)
bool readI16(std::int16_t &x)
bool readI8(std::int8_t &x)
bool readBinary(std::string &str)
WireReader(ConnectionReader &reader)
void readListBegin(yarp::os::idl::WireState &nstate, std::uint32_t &len)
bool readUI64(std::uint64_t &x)
bool read(WirePortable &obj)
bool readSizeT(std::size_t &x)
bool readFloat64(yarp::conf::float64_t &x)
bool readI64(std::int64_t &x)
virtual int fromString(const std::string &input)=0
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
An interface to the operating system, including Port based communication.
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.