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 | \
74 return createStorable();
79 return cloneStorable();
82 static Storable* createByCode(std::int32_t
id);
208 return static_cast<const char*
>(
nullptr);
230 bool check(
const std::string& key)
const override;
359 std::string
toString()
const override;
360 void fromString(
const std::string& src)
override;
362 static const std::int32_t
code;
445 std::string
toString()
const override;
446 void fromString(
const std::string& src)
override;
448 static const std::int32_t
code;
469 return static_cast<std::int8_t
>(x);
531 std::string
toString()
const override;
532 void fromString(
const std::string& src)
override;
534 static const std::int32_t
code;
545 return static_cast<std::int8_t
>(x);
555 return static_cast<std::int16_t
>(x);
616 std::string
toString()
const override;
617 void fromString(
const std::string& src)
override;
619 static const std::int32_t
code;
640 return static_cast<std::int8_t
>(x);
645 return static_cast<std::int16_t
>(x);
650 return static_cast<std::int32_t
>(x);
701 std::string
toString()
const override;
702 void fromString(
const std::string& src)
override;
704 static const std::int32_t
code;
720 return static_cast<std::int8_t
>(x);
725 return static_cast<std::int16_t
>(x);
730 return static_cast<std::int32_t
>(x);
735 return static_cast<std::int64_t
>(x);
776 std::string
toString()
const override;
777 void fromString(
const std::string& src)
override;
779 static const std::int32_t
code;
795 return static_cast<std::int8_t
>(x);
800 return static_cast<std::int16_t
>(x);
805 return static_cast<std::int32_t
>(x);
810 return static_cast<std::int64_t
>(x);
850 std::string
toString()
const override;
851 void fromString(
const std::string& src)
override;
852 std::string toStringNested()
const override;
853 void fromStringNested(
const std::string& src)
override;
855 static const std::int32_t
code;
866 return (x == 0 || x ==
'1');
937 std::string
toString()
const override;
938 void fromString(
const std::string& src)
override;
939 std::string toStringNested()
const override;
940 void fromStringNested(
const std::string& src)
override;
942 static const std::int32_t
code;
967 static std::string quotedString(
const std::string& x);
995 std::string
tmp((
char*)
alt.asBlob(),
alt.asBlobLength());
1002 std::string
toString()
const override;
1003 void fromString(
const std::string& src)
override;
1004 std::string toStringNested()
const override;
1005 void fromStringNested(
const std::string& src)
override;
1052 content = *(
alt.asList());
1060 std::string
toString()
const override;
1061 void fromString(
const std::string& src)
override;
1062 std::string toStringNested()
const override;
1063 void fromStringNested(
const std::string& src)
override;
1068 return code + subCode();
1084 std::int32_t subCode()
const override;
1088 return content.
find(key);
1117 content = *(
alt.asDict());
1125 std::string
toString()
const override;
1126 void fromString(
const std::string& src)
override;
1127 std::string toStringNested()
const override;
1128 void fromStringNested(
const std::string& src)
override;
1151 return content.
find(key);
1161template <
typename T>
1164 std::int32_t
c = -1;
1166 for (
unsigned int i = 0;
i < content.size(); ++
i) {
1167 std::int32_t
sc = content.get(
i).getCode();
1181 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 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.
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 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.
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 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.
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 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 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 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.
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.
#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.