8 #ifndef YARP_OS_IMPL_STORABLE_H
9 #define YARP_OS_IMPL_STORABLE_H
23 BOTTLE_TAG_FLOAT32 | \
24 BOTTLE_TAG_FLOAT64 | \
25 BOTTLE_TAG_VOCAB32 | \
76 return createStorable();
81 return cloneStorable();
84 static Storable* createByCode(std::int32_t
id);
210 return static_cast<const char*
>(
nullptr);
232 bool check(
const std::string& key)
const override;
361 std::string
toString()
const override;
362 void fromString(
const std::string& src)
override;
364 static const std::int32_t
code;
447 std::string
toString()
const override;
448 void fromString(
const std::string& src)
override;
450 static const std::int32_t
code;
471 return static_cast<std::int8_t
>(x);
533 std::string
toString()
const override;
534 void fromString(
const std::string& src)
override;
536 static const std::int32_t
code;
547 return static_cast<std::int8_t
>(x);
557 return static_cast<std::int16_t
>(x);
618 std::string
toString()
const override;
619 void fromString(
const std::string& src)
override;
621 static const std::int32_t
code;
642 return static_cast<std::int8_t
>(x);
647 return static_cast<std::int16_t
>(x);
652 return static_cast<std::int32_t
>(x);
703 std::string
toString()
const override;
704 void fromString(
const std::string& src)
override;
706 static const std::int32_t
code;
722 return static_cast<std::int8_t
>(x);
727 return static_cast<std::int16_t
>(x);
732 return static_cast<std::int32_t
>(x);
737 return static_cast<std::int64_t
>(x);
778 std::string
toString()
const override;
779 void fromString(
const std::string& src)
override;
781 static const std::int32_t
code;
797 return static_cast<std::int8_t
>(x);
802 return static_cast<std::int16_t
>(x);
807 return static_cast<std::int32_t
>(x);
812 return static_cast<std::int64_t
>(x);
852 std::string
toString()
const override;
853 void fromString(
const std::string& src)
override;
854 std::string toStringNested()
const override;
855 void fromStringNested(
const std::string& src)
override;
857 static const std::int32_t
code;
868 return (x == 0 || x ==
'1');
939 std::string
toString()
const override;
940 void fromString(
const std::string& src)
override;
941 std::string toStringNested()
const override;
942 void fromStringNested(
const std::string& src)
override;
944 static const std::int32_t
code;
969 static std::string quotedString(
const std::string& x);
1004 std::string
toString()
const override;
1005 void fromString(
const std::string& src)
override;
1006 std::string toStringNested()
const override;
1007 void fromStringNested(
const std::string& src)
override;
1054 content = *(alt.
asList());
1062 std::string
toString()
const override;
1063 void fromString(
const std::string& src)
override;
1064 std::string toStringNested()
const override;
1065 void fromStringNested(
const std::string& src)
override;
1070 return code + subCode();
1086 std::int32_t subCode()
const override;
1090 return content.
find(key);
1119 content = *(alt.
asDict());
1127 std::string
toString()
const override;
1128 void fromString(
const std::string& src)
override;
1129 std::string toStringNested()
const override;
1130 void fromStringNested(
const std::string& src)
override;
1153 return content.
find(key);
1163 template <
typename T>
1166 std::int32_t c = -1;
1168 for (
unsigned int i = 0; i < content.size(); ++i) {
1169 std::int32_t sc = content.get(i).getCode();
1183 content.specialize(c);
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.
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.
const char * asBlob() const override
Get binary data 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.
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 vocabulary identifier.
virtual Storable * cloneStorable() const
Typed synonym for clone()
bool isList() const override
Checks if value is a list.
yarp::os::Property * asDict() const override
Get dictionary (hash table) value.
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
yarp::os::Value * clone() const override
Create a copy of the value.
virtual Storable * createStorable() const =0
Factory method.
bool isNull() const override
Checks if the object is invalid.
std::string asString() const override
Get string value.
bool isDict() const override
Checks if value is a dictionary.
bool isBlob() const override
Checks if value is a binary object.
virtual void fromStringNested(const std::string &src)
Initialize from a string representation.
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.
yarp::os::Value * create() const override
Create a new value of the same type.
std::string toString() const override=0
Return a standard text representation of the content of the object.
yarp::os::Bottle * asList() const override
Get list value.
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.
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 vocabulary identifier as an integer.
Searchable * asSearchable() const override
Get dictionary or list value.
bool isInt64() const override
Checks if value is a 64-bit 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.
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.
const char * asBlob() const override
Get binary data value.
size_t asBlobLength() const override
Get binary data length.
Storable * createStorable() const override
Factory method.
static const std::int32_t code
StoreBlob(const std::string &x)
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::Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
yarp::os::Property * asDict() const override
Get dictionary (hash table) value.
void copy(const Storable &alt) override
Become a copy of the passed item.
bool isDict() const override
Checks if value is a dictionary.
std::int32_t getCode() const override
Get standard type code of 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.
Storable * createStorable() const override
Factory method.
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)
std::int32_t asInt32() const override
Get 32-bit integer value.
Storable * createStorable() const override
Factory method.
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 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 vocabulary identifier as an integer.
std::int64_t asInt64() const override
Get 64-bit integer value.
static const std::int32_t code
Storable * createStorable() const override
Factory method.
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.
Storable * createStorable() const override
Factory method.
yarp::conf::vocab32_t asVocab32() const override
Get 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.
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 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.
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.
Storable * createStorable() const override
Factory method.
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 * asList() const override
Get list value.
void copy(const Storable &alt) override
Become a copy of the passed item.
yarp::os::Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
yarp::os::Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
bool isList() const override
Checks if value is a list.
std::int32_t getCode() const override
Get standard type code of value.
Storable * createStorable() const override
Factory method.
static const std::int32_t code
Storable * createStorable() const override
Factory method.
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.
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 vocabulary identifier as an integer.
StoreString(const std::string &x)
std::int32_t getCode() const override
Get standard type code of value.
Storable * createStorable() const override
Factory method.
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.
yarp::conf::vocab32_t asVocab32() const override
Get 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 vocabulary identifier.
static const std::int32_t code
StoreVocab32(yarp::conf::vocab32_t x)
bool isBool() const override
Checks if value is a boolean.
std::string toString(const T &value)
convert an arbitrary type to string.
#define yCAssert(component, x)
#define YARP_DECLARE_LOG_COMPONENT(name)
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
std::int32_t subCoder(T &content)
std::string findGroup(const robotinterface::ParamList &list, const std::string &name)
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
The main, catch-all namespace for YARP.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.