29 if (flush_if_needed) {
37 flush_if_needed =
true;
47 support_get_mode =
true;
52 size_t pending = reader.
getSize();
56 size_t next = (pending <
sizeof(buf)) ? pending :
sizeof(buf);
94 if (state->
code < 0) {
114 std::int32_t tag = state->
code;
129 x =
static_cast<std::int8_t
>(reader.
expectInt32());
141 std::int32_t tag = state->
code;
153 x =
static_cast<std::int16_t
>(reader.
expectInt8());
159 x =
static_cast<std::int16_t
>(reader.
expectInt32());
171 std::int32_t tag = state->
code;
183 x =
static_cast<std::int32_t
>(reader.
expectInt8());
186 x =
static_cast<std::int32_t
>(reader.
expectInt16());
201 std::int32_t tag = state->
code;
213 x =
static_cast<std::int64_t
>(reader.
expectInt8());
216 x =
static_cast<std::int64_t
>(reader.
expectInt16());
219 x =
static_cast<std::int64_t
>(reader.
expectInt32());
234 std::int32_t tag = state->
code;
273 std::int32_t tag = state->
code;
312 return readI8(
reinterpret_cast<std::int8_t&
>(x));
317 return readI16(
reinterpret_cast<std::int16_t&
>(x));
322 return readI32(
reinterpret_cast<std::int32_t&
>(x));
327 return readI64(
reinterpret_cast<std::int64_t&
>(x));
332 std::int32_t tag = state->
code;
353 std::int32_t tag = state->
code;
378 if (state->
len <= 0) {
381 std::int32_t tag = state->
code;
382 if (state->
code < 0) {
416 if (len != 0 &&
noMore()) {
420 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
426 if (state->
len <= 0) {
439 if (state->
len <= 0) {
442 if (state->
code < 0) {
470 reader.
expectBlock(
const_cast<char*
>(str.data()), len);
489 int code = (
x1 & (~BOTTLE_TAG_LIST));
502 return len == state->
len;
510 if (!support_get_mode) {
513 if (state->
len == 1) {
516 if (state->
len != 4) {
543 flush_if_needed =
false;
545 if (writer !=
nullptr) {
563 flush_if_needed =
true;
575 if (state->
code >= 0) {
606 len =
static_cast<size_t>(state->
len);
639 if (!flush_if_needed) {
642 size_t pending = reader.
getSize();
646void WireReader::scanString(std::string& str,
bool is_vocab)
648 if (!support_get_mode) {
651 if (get_string.empty()) {
652 if (get_mode && get_string.empty()) {
655 }
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.
A mini-server for performing network communication in the background.
T * read(bool shouldWait=true) override
Read an available object from the port.
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 ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
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.
An interface for writing to a network connection.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
const std::string & getString() const
bool getIsVocab32() const
ConnectionWriter & getWriter()
bool readVocab32(yarp::conf::vocab32_t &x)
bool readNested(WirePortable &obj)
bool readUI8(std::uint8_t &x)
bool readString(std::string &str, bool *is_vocab=nullptr)
bool readUI16(std::uint16_t &x)
bool readUI32(std::uint32_t &x)
void readListBegin(yarp::os::idl::WireState &nstate, size_t &len)
ConnectionReader & getReader()
bool readFloat32(yarp::conf::float32_t &x)
bool readI32(std::int32_t &x)
bool readI16(std::int16_t &x)
std::string readTag(size_t len=static_cast< size_t >(-1))
bool readI8(std::int8_t &x)
bool readBinary(std::string &str)
WireReader(ConnectionReader &reader)
void readMapBegin(yarp::os::idl::WireState &nstate, yarp::os::idl::WireState &nstate2, size_t &len)
bool readBlock(char *const data, size_t len)
bool readUI64(std::uint64_t &x)
bool read(WirePortable &obj)
void readSetBegin(yarp::os::idl::WireState &nstate, size_t &len)
bool readSizeT(std::size_t &x)
bool readFloat64(yarp::conf::float64_t &x)
bool readI64(std::int64_t &x)
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.