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 | \
75 return createStorable();
80 return cloneStorable();
83 static Storable* createByCode(std::int32_t
id);
209 return static_cast<const char*
>(
nullptr);
223 bool check(
const std::string& key)
const override;
352 std::string
toString()
const override;
353 void fromString(
const std::string& src)
override;
355 static const std::int32_t
code;
438 std::string
toString()
const override;
439 void fromString(
const std::string& src)
override;
441 static const std::int32_t
code;
462 return static_cast<std::int8_t
>(x);
524 std::string
toString()
const override;
525 void fromString(
const std::string& src)
override;
527 static const std::int32_t
code;
538 return static_cast<std::int8_t
>(x);
548 return static_cast<std::int16_t
>(x);
609 std::string
toString()
const override;
610 void fromString(
const std::string& src)
override;
612 static const std::int32_t
code;
633 return static_cast<std::int8_t
>(x);
638 return static_cast<std::int16_t
>(x);
643 return static_cast<std::int32_t
>(x);
694 std::string
toString()
const override;
695 void fromString(
const std::string& src)
override;
697 static const std::int32_t
code;
713 return static_cast<std::int8_t
>(x);
718 return static_cast<std::int16_t
>(x);
723 return static_cast<std::int32_t
>(x);
728 return static_cast<std::int64_t
>(x);
769 std::string
toString()
const override;
770 void fromString(
const std::string& src)
override;
772 static const std::int32_t
code;
788 return static_cast<std::int8_t
>(x);
793 return static_cast<std::int16_t
>(x);
798 return static_cast<std::int32_t
>(x);
803 return static_cast<std::int64_t
>(x);
843 std::string
toString()
const override;
844 void fromString(
const std::string& src)
override;
845 std::string toStringNested()
const override;
846 void fromStringNested(
const std::string& src)
override;
848 static const std::int32_t
code;
859 return (x == 0 || x ==
'1');
929 std::string
toString()
const override;
930 void fromString(
const std::string& src)
override;
931 std::string toStringNested()
const override;
932 void fromStringNested(
const std::string& src)
override;
934 static const std::int32_t
code;
945 return (x == 0 || x ==
'1');
1016 std::string
toString()
const override;
1017 void fromString(
const std::string& src)
override;
1018 std::string toStringNested()
const override;
1019 void fromStringNested(
const std::string& src)
override;
1046 static std::string quotedString(
const std::string& x);
1074 std::string
tmp((
char*)
alt.asBlob(),
alt.asBlobLength());
1081 std::string
toString()
const override;
1082 void fromString(
const std::string& src)
override;
1083 std::string toStringNested()
const override;
1084 void fromStringNested(
const std::string& src)
override;
1131 content = *(
alt.asList());
1139 std::string
toString()
const override;
1140 void fromString(
const std::string& src)
override;
1141 std::string toStringNested()
const override;
1142 void fromStringNested(
const std::string& src)
override;
1147 return code + subCode();
1163 std::int32_t subCode()
const override;
1167 return content.
find(key);
1176template <
typename T>
1179 std::int32_t
c = -1;
1181 for (
unsigned int i = 0; i < content.size(); ++i) {
1182 std::int32_t
sc = content.get(i).getCode();
1196 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.
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.
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 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.
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.
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.