8#ifndef YARP_OS_IMPL_STORABLE_H
9#define YARP_OS_IMPL_STORABLE_H
24 BOTTLE_TAG_FLOAT32 | \
25 BOTTLE_TAG_FLOAT64 | \
26 BOTTLE_TAG_VOCAB32 | \
27 BOTTLE_TAG_VOCAB64 | \
76 return createStorable();
81 return cloneStorable();
84 static Storable* createByCode(std::int32_t
id);
220 return static_cast<const char*
>(
nullptr);
242 bool check(
const std::string& key)
const override;
371 std::string
toString()
const override;
372 void fromString(
const std::string& src)
override;
374 static const std::int32_t
code;
457 std::string
toString()
const override;
458 void fromString(
const std::string& src)
override;
460 static const std::int32_t
code;
481 return static_cast<std::int8_t
>(x);
543 std::string
toString()
const override;
544 void fromString(
const std::string& src)
override;
546 static const std::int32_t
code;
557 return static_cast<std::int8_t
>(x);
567 return static_cast<std::int16_t
>(x);
628 std::string
toString()
const override;
629 void fromString(
const std::string& src)
override;
631 static const std::int32_t
code;
652 return static_cast<std::int8_t
>(x);
657 return static_cast<std::int16_t
>(x);
662 return static_cast<std::int32_t
>(x);
713 std::string
toString()
const override;
714 void fromString(
const std::string& src)
override;
716 static const std::int32_t
code;
732 return static_cast<std::int8_t
>(x);
737 return static_cast<std::int16_t
>(x);
742 return static_cast<std::int32_t
>(x);
747 return static_cast<std::int64_t
>(x);
788 std::string
toString()
const override;
789 void fromString(
const std::string& src)
override;
791 static const std::int32_t
code;
807 return static_cast<std::int8_t
>(x);
812 return static_cast<std::int16_t
>(x);
817 return static_cast<std::int32_t
>(x);
822 return static_cast<std::int64_t
>(x);
862 std::string
toString()
const override;
863 void fromString(
const std::string& src)
override;
864 std::string toStringNested()
const override;
865 void fromStringNested(
const std::string& src)
override;
867 static const std::int32_t
code;
878 return (x == 0 || x ==
'1');
948 std::string
toString()
const override;
949 void fromString(
const std::string& src)
override;
950 std::string toStringNested()
const override;
951 void fromStringNested(
const std::string& src)
override;
953 static const std::int32_t
code;
964 return (x == 0 || x ==
'1');
1035 std::string
toString()
const override;
1036 void fromString(
const std::string& src)
override;
1037 std::string toStringNested()
const override;
1038 void fromStringNested(
const std::string& src)
override;
1065 static std::string quotedString(
const std::string& x);
1093 std::string
tmp((
char*)
alt.asBlob(),
alt.asBlobLength());
1100 std::string
toString()
const override;
1101 void fromString(
const std::string& src)
override;
1102 std::string toStringNested()
const override;
1103 void fromStringNested(
const std::string& src)
override;
1150 content = *(
alt.asList());
1158 std::string
toString()
const override;
1159 void fromString(
const std::string& src)
override;
1160 std::string toStringNested()
const override;
1161 void fromStringNested(
const std::string& src)
override;
1166 return code + subCode();
1182 std::int32_t subCode()
const override;
1186 return content.
find(key);
1215 content = *(
alt.asDict());
1223 std::string
toString()
const override;
1224 void fromString(
const std::string& src)
override;
1225 std::string toStringNested()
const override;
1226 void fromStringNested(
const std::string& src)
override;
1249 return content.
find(key);
1259template <
typename T>
1262 std::int32_t
c = -1;
1264 for (
unsigned int i = 0; i < content.size(); ++i) {
1265 std::int32_t
sc = content.get(i).getCode();
1279 content.specialize(
c);
bool operator==(const struct v4l2_control &left, const struct v4l2_control &right)
std::string toString(const T &value)
convert an arbitrary type to string.
const yarp::os::LogComponent & STORABLE()
const yarp::os::LogComponent & STORABLE()
A simple collection of objects that can be described and transmitted in a portable way.
Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
An interface for writing to a network connection.
A class for storing options and configuration information.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
A single item in a Bottle.
virtual Storable * createStorable() const =0
Factory method.
Searchable * asSearchable() const override
Get dictionary or list value.
size_t asBlobLength() const override
Get binary data length.
virtual std::string toStringNested() const
Create string representation, including any syntax that should wrap it such as braces or parentheses.
yarp::os::Property * asDict() const override
Get dictionary (hash table) value.
std::int8_t asInt8() const override
Get 8-bit integer value.
virtual ~Storable()
Destructor.
std::int64_t asInt64() const override
Get 64-bit integer value.
bool isVocab32() const override
Checks if value is a 32bit vocabulary identifier.
bool isList() const override
Checks if value is a list.
bool isInt16() const override
Checks if value is a 16-bit integer.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
virtual bool writeRaw(ConnectionWriter &connection) const =0
bool isNull() const override
Checks if the object is invalid.
const char * asBlob() const override
Get binary data value.
std::string asString() const override
Get string value.
bool isDict() const override
Checks if value is a dictionary.
yarp::os::Value * clone() const override
Create a copy of the value.
bool isBlob() const override
Checks if value is a binary object.
virtual void fromStringNested(const std::string &src)
Initialize from a string representation.
bool isVocab64() const override
Checks if value is a 64bit vocabulary identifier.
virtual void fromString(const std::string &src)=0
Initialize from a string representation, assuming that any syntax around this representation such as ...
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
bool isFloat32() const override
Checks if value is a 32-bit floating point number.
bool isBool() const override
Checks if value is a boolean.
std::string toString() const override=0
Return a standard text representation of the content of the object.
virtual std::int32_t subCode() const
Return a code describing this item, used in serializing bottles.
bool asBool() const override
Get boolean value.
bool isString() const override
Checks if value is a string.
virtual void copy(const Storable &alt)=0
Become a copy of the passed item.
virtual Storable * cloneStorable() const
Typed synonym for clone()
bool isInt32() const override
Checks if value is a 32-bit integer.
bool isInt8() const override
Checks if value is a 8-bit integer.
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
yarp::os::Bottle * asList() const override
Get list value.
bool isInt64() const override
Checks if value is a 64-bit integer.
yarp::conf::vocab64_t asVocab64() const override
Get 64 bit vocabulary identifier as an integer.
virtual bool readRaw(ConnectionReader &connection)=0
bool isLeaf() const override
bool isFloat64() const override
Checks if value is a 64-bit floating point number.
yarp::os::Value * create() const override
Create a new value of the same type.
std::int16_t asInt16() const override
Get 16-bit integer value.
std::int32_t asInt32() const override
Get 32-bit integer value.
bool isBlob() const override
Checks if value is a binary object.
Storable * createStorable() const override
Factory method.
size_t asBlobLength() const override
Get binary data length.
static const std::int32_t code
StoreBlob(const std::string &x)
const char * asBlob() const override
Get binary data value.
void copy(const Storable &alt) override
Become a copy of the passed item.
std::int32_t getCode() const override
Get standard type code of value.
yarp::os::Property & internal()
yarp::os::Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void copy(const Storable &alt) override
Become a copy of the passed item.
bool isDict() const override
Checks if value is a dictionary.
yarp::os::Property * asDict() const override
Get dictionary (hash table) value.
std::int32_t getCode() const override
Get standard type code of value.
Storable * createStorable() const override
Factory method.
static const std::int32_t code
yarp::os::Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
A 32-bit floating point number item.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
bool isFloat32() const override
Checks if value is a 32-bit floating point number.
void copy(const Storable &alt) override
Become a copy of the passed item.
std::int8_t asInt8() const override
Get 8-bit integer value.
std::int64_t asInt64() const override
Get 64-bit integer value.
std::int32_t getCode() const override
Get standard type code of value.
static const std::int32_t code
std::int16_t asInt16() const override
Get 16-bit integer value.
StoreFloat32(yarp::conf::float32_t x)
Storable * createStorable() const override
Factory method.
std::int32_t asInt32() const override
Get 32-bit integer value.
A 64-bit floating point number item.
StoreFloat64(yarp::conf::float64_t x)
std::int16_t asInt16() const override
Get 16-bit integer value.
std::int64_t asInt64() const override
Get 64-bit integer value.
bool isFloat64() const override
Checks if value is a 64-bit floating point number.
std::int32_t asInt32() const override
Get 32-bit integer value.
Storable * createStorable() const override
Factory method.
std::int8_t asInt8() const override
Get 8-bit integer value.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
void copy(const Storable &alt) override
Become a copy of the passed item.
static const std::int32_t code
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
std::int32_t getCode() const override
Get standard type code of value.
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
bool asBool() const override
Get boolean value.
std::int32_t getCode() const override
Get standard type code of value.
void copy(const Storable &alt) override
Become a copy of the passed item.
static const std::int32_t code
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
std::int8_t asInt8() const override
Get 8-bit integer value.
std::int32_t asInt32() const override
Get 32-bit integer value.
bool isInt16() const override
Checks if value is a 16-bit integer.
Storable * createStorable() const override
Factory method.
std::int16_t asInt16() const override
Get 16-bit integer value.
StoreInt16(std::int16_t x)
std::int64_t asInt64() const override
Get 64-bit integer value.
std::int32_t getCode() const override
Get standard type code of value.
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
StoreInt32(std::int32_t x)
bool isInt32() const override
Checks if value is a 32-bit integer.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
std::int8_t asInt8() const override
Get 8-bit integer value.
std::int32_t asInt32() const override
Get 32-bit integer value.
bool asBool() const override
Get boolean value.
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Storable * createStorable() const override
Factory method.
std::int64_t asInt64() const override
Get 64-bit integer value.
static const std::int32_t code
std::int16_t asInt16() const override
Get 16-bit integer value.
void copy(const Storable &alt) override
Become a copy of the passed item.
std::int32_t getCode() const override
Get standard type code of value.
static const std::int32_t code
std::int8_t asInt8() const override
Get 8-bit integer value.
bool asBool() const override
Get boolean value.
std::int64_t asInt64() const override
Get 64-bit integer value.
void copy(const Storable &alt) override
Become a copy of the passed item.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
std::int16_t asInt16() const override
Get 16-bit integer value.
bool isInt64() const override
Checks if value is a 64-bit integer.
Storable * createStorable() const override
Factory method.
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
StoreInt64(std::int64_t x)
std::int32_t asInt32() const override
Get 32-bit integer value.
std::int32_t asInt32() const override
Get 32-bit integer value.
bool asBool() const override
Get boolean value.
static const std::int32_t code
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
void copy(const Storable &alt) override
Become a copy of the passed item.
std::int32_t getCode() const override
Get standard type code of value.
std::int8_t asInt8() const override
Get 8-bit integer value.
Storable * createStorable() const override
Factory method.
std::int16_t asInt16() const override
Get 16-bit integer value.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
std::int64_t asInt64() const override
Get 64-bit integer value.
bool isInt8() const override
Checks if value is a 8-bit integer.
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
yarp::os::Bottle & internal()
Storable * createStorable() const override
Factory method.
yarp::os::Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void copy(const Storable &alt) override
Become a copy of the passed item.
bool isList() const override
Checks if value is a list.
std::int32_t getCode() const override
Get standard type code of value.
yarp::os::Bottle * asList() const override
Get list value.
static const std::int32_t code
yarp::os::Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
std::int32_t getCode() const override
Get standard type code of value.
std::string toString() const override
Return a standard text representation of the content of the object.
Storable * createStorable() const override
Factory method.
void copy(const Storable &alt) override
Become a copy of the passed item.
bool writeRaw(ConnectionWriter &connection) const override
bool readRaw(ConnectionReader &connection) override
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
bool isNull() const override
Checks if the object is invalid.
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Storable * createStorable() const override
Factory method.
StoreString(const std::string &x)
std::int32_t getCode() const override
Get standard type code of value.
void copy(const Storable &alt) override
Become a copy of the passed item.
std::string asString() const override
Get string value.
static const std::int32_t code
bool isString() const override
Checks if value is a string.
A 32 bit vocabulary item.
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
std::int32_t getCode() const override
Get standard type code of value.
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
std::string asString() const override
Get string value.
void copy(const Storable &alt) override
Become a copy of the passed item.
bool asBool() const override
Get boolean value.
std::int64_t asInt64() const override
Get 64-bit integer value.
Storable * createStorable() const override
Factory method.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
std::int32_t asInt32() const override
Get 32-bit integer value.
bool isVocab32() const override
Checks if value is a 32bit vocabulary identifier.
static const std::int32_t code
StoreVocab32(yarp::conf::vocab32_t x)
bool isBool() const override
Checks if value is a boolean.
A 64 bit vocabulary item.
std::int32_t getCode() const override
Get standard type code of value.
bool isVocab64() const override
Checks if value is a 64bit vocabulary identifier.
StoreVocab64(yarp::conf::vocab64_t x)
std::int64_t asInt64() const override
Get 64-bit integer value.
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
void copy(const Storable &alt) override
Become a copy of the passed item.
std::int32_t asInt32() const override
Get 32-bit integer value.
static const std::int32_t code
std::string asString() const override
Get string value.
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
bool asBool() const override
Get boolean value.
bool isBool() const override
Checks if value is a boolean.
yarp::conf::vocab64_t asVocab64() const override
Get 64 bit vocabulary identifier as an integer.
Storable * createStorable() const override
Factory method.
#define yCAssert(component, x)
#define YARP_DECLARE_LOG_COMPONENT(name)
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
The components from which ports and connections are built.
std::int32_t subCoder(T &content)
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.