67 std::int32_t subCode = 0;
99 storable->asList()->implementation->setNested(
true);
111 storable->asList()->implementation->specialize(subCode);
112 storable->asList()->implementation->setNested(
true);
139 return !
val2.isNull();
169 return std::to_string(x);
174 x =
static_cast<std::int8_t
>(
strtol(src.c_str(),
static_cast<char**
>(
nullptr), 0));
195 return std::to_string(x);
200 x =
static_cast<std::int16_t
>(
strtol(src.c_str(),
static_cast<char**
>(
nullptr), 0));
221 return std::to_string(x);
226 x =
strtol(src.c_str(),
static_cast<char**
>(
nullptr), 0);
247 return std::to_string(x);
252 x =
strtoll(src.c_str(),
static_cast<char**
>(
nullptr), 0);
295 return std::string(
"[") +
toString() +
"]";
301 if (src.length() > 0) {
305 }
else if (src ==
"true") {
306 x =
static_cast<int>(
'1');
307 }
else if (src ==
"false") {
337 x = yarp::conf::numeric::from_string<yarp::conf::float32_t>(src);
363 x = yarp::conf::numeric::from_string<yarp::conf::float64_t>(src);
393 for (
unsigned int i = 0; i < x.length(); i++) {
395 if ((ch <
'a' || ch >
'z') && (ch <
'A' || ch >
'Z') && ch !=
'_') {
396 if ((ch >=
'0' && ch <=
'9') || ch ==
'.' || ch ==
'-') {
407 if (x.length() == 0) {
410 if (x ==
"true" || x ==
"false") {
423 }
else if (ch ==
'\r') {
426 }
else if (ch ==
'\0') {
430 if (ch ==
'\\' || ch ==
'\"') {
455 size_t len = src.length();
459 if (src[0] ==
'\"') {
462 for (
size_t i = 0; i < len; i++) {
463 if (
skip && (i == 0 || i == len - 1)) {
478 }
else if (ch ==
'r') {
480 }
else if (ch ==
'0') {
500 reader.
expectBlock(
const_cast<char*
>(x.data()), len);
506 writer.
appendInt32(
static_cast<std::int32_t
>(x.length()));
518 for (
unsigned int i = 0; i < x.length(); i++) {
522 const auto* src =
reinterpret_cast<const unsigned char*
>(&x[i]);
530 return std::string(
"{") +
toString() +
"}";
536 std::string buf(bot.
size(), 0);
537 for (
size_t i = 0; i < bot.
size(); i++) {
538 buf[i] =
static_cast<char>(
static_cast<unsigned char>(bot.
get(i).
asInt32()));
545 if (src.length() > 0) {
548 std::string buf = src.substr(1, src.length() - 2);
558 reader.
expectBlock(
const_cast<char*
>(x.data()), len);
564 writer.
appendInt32(
static_cast<std::int32_t
>(x.length()));
580 return std::string(
"(") + content.
toString() +
")";
590 if (src.length() > 0) {
593 std::string buf = src.substr(1, src.length() - 2);
602 content.
read(reader);
609 content.
write(writer);
615 return subCoder(*(content.implementation));
624 return std::string(content.
toString());
629 return std::string(
"(") + content.
toString() +
")";
639 if (src.length() > 0) {
642 std::string buf = src.substr(1, src.length() - 2);
651 content.
read(reader);
658 content.
write(writer);
#define BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_STRING
#define BOTTLE_TAG_VOCAB32
#define BOTTLE_TAG_FLOAT32
const yarp::os::LogComponent & STORABLE()
A simple collection of objects that can be described and transmitted in a portable way.
static Bottle & getNullBottle()
A special Bottle with no content.
void fromString(const std::string &text)
Initializes bottle from a string.
size_type size() const
Gets the number of elements in the bottle.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
bool isNull() const override
Checks if the object is invalid.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
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 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.
virtual void appendInt64(std::int64_t data)=0
Send a representation of a 64-bit integer to the network connection.
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual void appendFloat32(yarp::conf::float32_t data)=0
Send a representation of a 32-bit floating point number to the network connection.
virtual void appendInt16(std::int16_t data)=0
Send a representation of a 16-bit integer to the network connection.
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number to the network connection.
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data to the network connection.
std::string toString() const override
Return a standard text representation of the content of the object.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
bool write(ConnectionWriter &writer) const override
Write this object to a network connection.
bool read(ConnectionReader &reader) override
Read this object from a network connection.
A single value (typically within a Bottle).
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual std::int32_t getCode() const
Get standard type code of value.
A flexible data format for holding a bunch of numbers and strings.
static StoreNull & getNull()
A single item in a Bottle.
virtual bool writeRaw(ConnectionWriter &connection) const =0
bool write(ConnectionWriter &connection) const override
Write this object to a network connection.
yarp::os::Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
std::string toString() const override=0
Return a standard text representation of the content of the object.
bool operator==(const yarp::os::Value &alt) const
bool check(const std::string &key) const override
Check if there exists a property of the given name.
bool read(ConnectionReader &connection) override
Read this object from a network connection.
virtual bool readRaw(ConnectionReader &connection)=0
yarp::os::Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
bool writeRaw(ConnectionWriter &writer) const override
bool readRaw(ConnectionReader &reader) override
static const std::int32_t code
std::string toString() const override
Return a standard text representation of the content of the object.
void fromStringNested(const std::string &src) override
Initialize from a string representation.
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
void fromStringNested(const std::string &src) override
Initialize from a string representation.
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
std::string toString() const override
Return a standard text representation of the content of the object.
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
bool writeRaw(ConnectionWriter &writer) const override
bool readRaw(ConnectionReader &reader) override
A 32-bit floating point number item.
bool writeRaw(ConnectionWriter &writer) const override
bool readRaw(ConnectionReader &reader) override
std::string toString() const override
Return a standard text representation of the content of the object.
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
static const std::int32_t code
A 64-bit floating point number item.
bool writeRaw(ConnectionWriter &writer) const override
bool readRaw(ConnectionReader &reader) override
std::string toString() const override
Return a standard text representation of the content of the object.
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
static const std::int32_t code
static const std::int32_t code
bool writeRaw(ConnectionWriter &writer) const override
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
bool readRaw(ConnectionReader &reader) override
std::string toString() const override
Return a standard text representation of the content of the object.
bool writeRaw(ConnectionWriter &writer) const override
std::string toString() const override
Return a standard text representation of the content of the object.
bool readRaw(ConnectionReader &reader) override
static const std::int32_t code
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
bool readRaw(ConnectionReader &reader) override
static const std::int32_t code
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
std::string toString() const override
Return a standard text representation of the content of the object.
bool writeRaw(ConnectionWriter &writer) const override
std::string toString() const override
Return a standard text representation of the content of the object.
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
static const std::int32_t code
bool writeRaw(ConnectionWriter &writer) const override
bool readRaw(ConnectionReader &reader) override
bool readRaw(ConnectionReader &reader) override
void fromStringNested(const std::string &src) override
Initialize from a string representation.
std::int32_t subCode() const override
Return a code describing this item, used in serializing bottles.
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
std::string toString() const override
Return a standard text representation of the content of the object.
bool writeRaw(ConnectionWriter &writer) const override
static const std::int32_t code
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
bool readRaw(ConnectionReader &reader) override
static std::string quotedString(const std::string &x)
std::string toString() const override
Return a standard text representation of the content of the object.
void fromStringNested(const std::string &src) override
Initialize from a string representation.
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
bool writeRaw(ConnectionWriter &writer) const override
static const std::int32_t code
std::string toString() const override
Return a standard text representation of the content of the object.
void fromStringNested(const std::string &src) override
Initialize from a string representation.
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
bool readRaw(ConnectionReader &reader) override
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
static const std::int32_t code
bool writeRaw(ConnectionWriter &writer) const override
#define yCAssert(component, x)
#define YARP_OS_LOG_COMPONENT(name, name_string)
std::string to_string(IntegerType x)
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
std::int32_t subCoder(T &content)