69 std::int32_t subCode = 0;
104 storable->asList()->implementation->setNested(
true);
116 storable->asList()->implementation->specialize(subCode);
117 storable->asList()->implementation->setNested(
true);
144 return !
val2.isNull();
174 return std::to_string(x);
179 x =
static_cast<std::int8_t
>(
strtol(src.c_str(),
static_cast<char**
>(
nullptr), 0));
200 return std::to_string(x);
205 x =
static_cast<std::int16_t
>(
strtol(src.c_str(),
static_cast<char**
>(
nullptr), 0));
226 return std::to_string(x);
231 x =
strtol(src.c_str(),
static_cast<char**
>(
nullptr), 0);
252 return std::to_string(x);
257 x =
strtoll(src.c_str(),
static_cast<char**
>(
nullptr), 0);
300 return std::string(
"[") +
toString() +
"]";
306 if (src.length() > 0) {
310 }
else if (src ==
"true") {
311 x =
static_cast<int>(
'1');
312 }
else if (src ==
"false") {
357 return std::string(
"[") +
toString() +
"]";
363 if (src.length() > 0) {
367 }
else if (src ==
"true") {
368 x =
static_cast<int>(
'1');
369 }
else if (src ==
"false") {
398 x = yarp::conf::numeric::from_string<yarp::conf::float32_t>(src);
424 x = yarp::conf::numeric::from_string<yarp::conf::float64_t>(src);
454 for (
unsigned int i = 0; i < x.length(); i++) {
456 if ((ch <
'a' || ch >
'z') && (ch <
'A' || ch >
'Z') && ch !=
'_') {
457 if ((ch >=
'0' && ch <=
'9') || ch ==
'.' || ch ==
'-') {
468 if (x.length() == 0) {
471 if (x ==
"true" || x ==
"false") {
484 }
else if (ch ==
'\r') {
487 }
else if (ch ==
'\0') {
491 if (ch ==
'\\' || ch ==
'\"') {
516 size_t len = src.length();
520 if (src[0] ==
'\"') {
523 for (
size_t i = 0; i < len; i++) {
524 if (
skip && (i == 0 || i == len - 1)) {
539 }
else if (ch ==
'r') {
541 }
else if (ch ==
'0') {
561 reader.
expectBlock(
const_cast<char*
>(x.data()), len);
567 writer.
appendInt32(
static_cast<std::int32_t
>(x.length()));
579 for (
unsigned int i = 0; i < x.length(); i++) {
583 const auto* src =
reinterpret_cast<const unsigned char*
>(&x[i]);
591 return std::string(
"{") +
toString() +
"}";
597 std::string buf(bot.
size(), 0);
598 for (
size_t i = 0; i < bot.
size(); i++) {
599 buf[i] =
static_cast<char>(
static_cast<unsigned char>(bot.
get(i).
asInt32()));
606 if (src.length() > 0) {
609 std::string buf = src.substr(1, src.length() - 2);
619 reader.
expectBlock(
const_cast<char*
>(x.data()), len);
625 writer.
appendInt32(
static_cast<std::int32_t
>(x.length()));
641 return std::string(
"(") + content.
toString() +
")";
651 if (src.length() > 0) {
654 std::string buf = src.substr(1, src.length() - 2);
663 content.
read(reader);
670 content.
write(writer);
676 return subCoder(*(content.implementation));
685 return std::string(content.
toString());
690 return std::string(
"(") + content.
toString() +
")";
700 if (src.length() > 0) {
703 std::string buf = src.substr(1, src.length() - 2);
712 content.
read(reader);
719 content.
write(writer);
#define BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_VOCAB64
#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
A 32 bit vocabulary item.
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
A 64 bit vocabulary item.
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 ...
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.
static const std::int32_t code
void fromStringNested(const std::string &src) override
Initialize from a string representation.
bool readRaw(ConnectionReader &reader) 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.
NetInt64 encode64(const std::string &str)
Convert a string into a vocabulary identifier.
std::string decode64(NetInt64 code)
Convert a vocabulary identifier into a string.
std::int32_t subCoder(T &content)