A single item in a Bottle. More...
#include <yarp/os/impl/Storable.h>
Public Member Functions | |
virtual | ~Storable () |
Destructor. More... | |
virtual Storable * | createStorable () const =0 |
Factory method. More... | |
virtual Storable * | cloneStorable () const |
Typed synonym for clone() More... | |
virtual void | copy (const Storable &alt)=0 |
Become a copy of the passed item. More... | |
bool | operator== (const yarp::os::Value &alt) const |
yarp::os::Value * | create () const override |
Create a new value of the same type. More... | |
yarp::os::Value * | clone () const override |
Create a copy of the value. More... | |
bool | read (ConnectionReader &connection) override |
Read this object from a network connection. More... | |
bool | write (ConnectionWriter &connection) const override |
Write this object to a network connection. More... | |
virtual bool | readRaw (ConnectionReader &connection)=0 |
virtual bool | writeRaw (ConnectionWriter &connection) const =0 |
bool | isBool () const override |
Checks if value is a boolean. More... | |
bool | asBool () const override |
Get boolean value. More... | |
bool | isInt8 () const override |
Checks if value is a 8-bit integer. More... | |
std::int8_t | asInt8 () const override |
Get 8-bit integer value. More... | |
bool | isInt16 () const override |
Checks if value is a 16-bit integer. More... | |
std::int16_t | asInt16 () const override |
Get 16-bit integer value. More... | |
bool | isInt32 () const override |
Checks if value is a 32-bit integer. More... | |
std::int32_t | asInt32 () const override |
Get 32-bit integer value. More... | |
bool | isInt64 () const override |
Checks if value is a 64-bit integer. More... | |
std::int64_t | asInt64 () const override |
Get 64-bit integer value. More... | |
bool | isFloat32 () const override |
Checks if value is a 32-bit floating point number. More... | |
yarp::conf::float32_t | asFloat32 () const override |
Get 32-bit floating point value. More... | |
bool | isFloat64 () const override |
Checks if value is a 64-bit floating point number. More... | |
yarp::conf::float64_t | asFloat64 () const override |
Get 64-bit floating point value. More... | |
bool | isString () const override |
Checks if value is a string. More... | |
std::string | asString () const override |
Get string value. More... | |
bool | isList () const override |
Checks if value is a list. More... | |
yarp::os::Bottle * | asList () const override |
Get list value. More... | |
bool | isDict () const override |
Checks if value is a dictionary. More... | |
yarp::os::Property * | asDict () const override |
Get dictionary (hash table) value. More... | |
bool | isVocab () const override |
Checks if value is a vocabulary identifier. More... | |
std::int32_t | asVocab () const override |
Get vocabulary identifier as an integer. More... | |
bool | isBlob () const override |
Checks if value is a binary object. More... | |
const char * | asBlob () const override |
Get binary data value. More... | |
size_t | asBlobLength () const override |
Get binary data length. More... | |
bool | isNull () const override |
Checks if the object is invalid. More... | |
Searchable * | asSearchable () const override |
Get dictionary or list value. More... | |
bool | check (const std::string &key) const override |
Check if there exists a property of the given name. More... | |
yarp::os::Value & | find (const std::string &key) const override |
Gets a value corresponding to a given keyword. More... | |
yarp::os::Bottle & | findGroup (const std::string &key) const override |
Gets a list corresponding to a given keyword. More... | |
virtual void | fromString (const std::string &src)=0 |
Initialize from a string representation, assuming that any syntax around this representation such as braces or parentheses has already been consumed. More... | |
virtual void | fromStringNested (const std::string &src) |
Initialize from a string representation. More... | |
std::string | toString () const override=0 |
Return a standard text representation of the content of the object. More... | |
virtual std::string | toStringNested () const |
Create string representation, including any syntax that should wrap it such as braces or parentheses. More... | |
virtual std::int32_t | subCode () const |
Return a code describing this item, used in serializing bottles. More... | |
bool | isLeaf () const override |
Public Member Functions inherited from yarp::os::Value | |
Value () | |
Construct a list Value. More... | |
Value (std::int32_t x, bool isVocab=false) | |
Construct an integer Value. More... | |
Value (yarp::conf::float64_t x) | |
Construct a floating point Value. More... | |
Value (const std::string &str, bool isVocab=false) | |
Construct a string Value. More... | |
Value (void *data, int length) | |
Construct a binary data Value. More... | |
Value (const Value &alt) | |
Copy constructor. More... | |
const Value & | operator= (const Value &alt) |
Assignment operator. More... | |
virtual | ~Value () |
Destructor. More... | |
virtual bool | isInt () const final |
Checks if value is an integer. More... | |
virtual bool | isDouble () const final |
Checks if value is a floating point number. More... | |
virtual int | asInt () const final |
Get integer value. More... | |
virtual double | asDouble () const final |
Get floating point value. More... | |
bool | read (ConnectionReader &connection) override |
Read this object from a network connection. More... | |
bool | write (ConnectionWriter &connection) const override |
Write this object to a network connection. More... | |
bool | check (const std::string &key) const override |
Check if there exists a property of the given name. More... | |
Value & | find (const std::string &key) const override |
Gets a value corresponding to a given keyword. More... | |
Bottle & | findGroup (const std::string &key) const override |
Gets a list corresponding to a given keyword. More... | |
bool | operator== (const Value &alt) const |
Equality test. More... | |
bool | operator!= (const Value &alt) const |
Inequality test. More... | |
void | fromString (const char *str) |
Set value to correspond to a textual representation. More... | |
std::string | toString () const override |
Return a standard text representation of the content of the object. More... | |
virtual std::int32_t | getCode () const |
Get standard type code of value. More... | |
bool | isNull () const override |
Checks if the object is invalid. More... | |
virtual bool | check (const std::string &key) const=0 |
Check if there exists a property of the given name. More... | |
virtual bool | check (const std::string &key, const std::string &comment) const |
Check if there exists a property of the given name. More... | |
virtual bool | check (const std::string &key, Value *&result, const std::string &comment="") const |
Gets a value corresponding to a given keyword. More... | |
virtual Value | check (const std::string &key, const Value &fallback, const std::string &comment="") const |
Gets a value corresponding to a given keyword. More... | |
virtual Bottle & | findGroup (const std::string &key) const=0 |
Gets a list corresponding to a given keyword. More... | |
Bottle & | findGroup (const std::string &key, const std::string &comment) const |
Gets a list corresponding to a given keyword. More... | |
Public Member Functions inherited from yarp::os::Portable | |
virtual Type | getType () const |
Public Member Functions inherited from yarp::os::PortReader | |
virtual | ~PortReader () |
Destructor. More... | |
virtual Type | getReadType () const |
Public Member Functions inherited from yarp::os::PortWriter | |
virtual | ~PortWriter () |
Destructor. More... | |
virtual void | onCompletion () const |
This is called when the port has finished all writing operations. More... | |
virtual void | onCommencement () const |
This is called when the port is about to begin writing operations. More... | |
virtual yarp::os::Type | getWriteType () const |
Public Member Functions inherited from yarp::os::Searchable | |
Searchable () | |
Default constructor. More... | |
Searchable (const Searchable &rhs)=default | |
Copy constructor. More... | |
Searchable (Searchable &&rhs) noexcept=default | |
Move constructor. More... | |
virtual | ~Searchable () |
Destructor. More... | |
Searchable & | operator= (const Searchable &rhs)=default |
Copy assignment operator. More... | |
Searchable & | operator= (Searchable &&rhs) noexcept=default |
Move assignment operator. More... | |
virtual bool | check (const std::string &key, const std::string &comment) const |
Check if there exists a property of the given name. More... | |
Bottle & | findGroup (const std::string &key, const std::string &comment) const |
Gets a list corresponding to a given keyword. More... | |
virtual bool | check (const std::string &key, Value *&result, const std::string &comment="") const |
Gets a value corresponding to a given keyword. More... | |
virtual Value | check (const std::string &key, const Value &fallback, const std::string &comment="") const |
Gets a value corresponding to a given keyword. More... | |
Static Public Member Functions | |
static Storable * | createByCode (std::int32_t id) |
Static Public Member Functions inherited from yarp::os::Value | |
static Value * | makeInt (int x) |
Create an integer Value. More... | |
static Value * | makeInt8 (std::int8_t x) |
Create a 8-bit integer Value. More... | |
static Value * | makeInt16 (std::int16_t x) |
Create a 16-bit integer Value. More... | |
static Value * | makeInt32 (std::int32_t x) |
Create a 32-bit integer Value. More... | |
static Value * | makeInt64 (std::int64_t x) |
Create a 64-bit integer Value. More... | |
static Value * | makeDouble (double x) |
Create a floating point Value. More... | |
static Value * | makeFloat32 (yarp::conf::float32_t x) |
Create a 32-bit floating point Value. More... | |
static Value * | makeFloat64 (yarp::conf::float64_t x) |
Create a 64-bit floating point Value. More... | |
static Value * | makeString (const std::string &str) |
Create a string Value. More... | |
static Value * | makeVocab (std::int32_t v) |
Create a vocabulary identifier Value. More... | |
static Value * | makeVocab (const std::string &str) |
Create a vocabulary identifier Value. More... | |
static Value * | makeBlob (void *data, int length) |
Create a Value containing binary data. More... | |
static Value * | makeList () |
Create a list Value. More... | |
static Value * | makeList (const char *txt) |
Create a list Value and initialize it. More... | |
static Value * | makeValue (const std::string &txt) |
Create a Value from a text description. More... | |
static Value & | getNullValue () |
Return an invalid, "null" Value. More... | |
Static Public Member Functions inherited from yarp::os::Portable | |
static bool | copyPortable (const PortWriter &writer, PortReader &reader) |
Copy one portable to another, via writing and reading. More... | |
A single item in a Bottle.
This extends the public yarp::os::Value interface with some implementation-specific details.
Definition at line 46 of file Storable.h.
|
virtualdefault |
Destructor.
|
inlineoverridevirtual |
Get binary data value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreBlob.
Definition at line 211 of file Storable.h.
|
inlineoverridevirtual |
Get binary data length.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreBlob.
Definition at line 216 of file Storable.h.
|
inlineoverridevirtual |
Get boolean value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreVocab, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 101 of file Storable.h.
|
inlineoverridevirtual |
Get dictionary (hash table) value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreDict.
Definition at line 191 of file Storable.h.
|
inlineoverridevirtual |
Get 32-bit floating point value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 151 of file Storable.h.
|
inlineoverridevirtual |
Get 64-bit floating point value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 161 of file Storable.h.
|
inlineoverridevirtual |
Get 16-bit integer value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 121 of file Storable.h.
|
inlineoverridevirtual |
Get 32-bit integer value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 131 of file Storable.h.
|
inlineoverridevirtual |
Get 64-bit integer value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 141 of file Storable.h.
|
inlineoverridevirtual |
Get 8-bit integer value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 111 of file Storable.h.
|
inlineoverridevirtual |
Get list value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreList.
Definition at line 181 of file Storable.h.
|
inlineoverridevirtual |
Get dictionary or list value.
Reimplemented from yarp::os::Value.
Definition at line 227 of file Storable.h.
|
inlineoverridevirtual |
Get string value.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreString, and yarp::os::impl::StoreVocab.
Definition at line 171 of file Storable.h.
|
inlineoverridevirtual |
Get vocabulary identifier as an integer.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, and yarp::os::impl::StoreInt8.
Definition at line 201 of file Storable.h.
|
overridevirtual |
Check if there exists a property of the given name.
key | the name to check for |
Implements yarp::os::Searchable.
Definition at line 135 of file Storable.cpp.
|
inlineoverridevirtual |
Create a copy of the value.
Reimplemented from yarp::os::Value.
Definition at line 82 of file Storable.h.
|
inlinevirtual |
Typed synonym for clone()
Definition at line 62 of file Storable.h.
|
pure virtual |
Become a copy of the passed item.
Implemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::StoreNull.
|
inlineoverridevirtual |
Create a new value of the same type.
Reimplemented from yarp::os::Value.
Definition at line 77 of file Storable.h.
|
static |
Definition at line 67 of file Storable.cpp.
|
pure virtual |
Factory method.
Implemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::StoreNull.
|
overridevirtual |
Gets a value corresponding to a given keyword.
key | The keyword to look for |
Implements yarp::os::Searchable.
Reimplemented in yarp::os::impl::StoreDict, and yarp::os::impl::StoreList.
Definition at line 123 of file Storable.cpp.
|
overridevirtual |
Gets a list corresponding to a given keyword.
key | The keyword to look for |
Implements yarp::os::Searchable.
Reimplemented in yarp::os::impl::StoreDict, and yarp::os::impl::StoreList.
Definition at line 129 of file Storable.cpp.
|
pure virtual |
Initialize from a string representation, assuming that any syntax around this representation such as braces or parentheses has already been consumed.
Implemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::StoreNull.
|
inlinevirtual |
Initialize from a string representation.
This should consume any syntax around that representation such as braces or parentheses.
Reimplemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, and yarp::os::impl::StoreVocab.
Definition at line 253 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a binary object.
If so, asBlob() and asBlobLength() will return it.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreBlob.
Definition at line 206 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a boolean.
If so, asBool() will return that boolean.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreVocab.
Definition at line 96 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a dictionary.
If so, asDict() will return that dictionary.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreDict.
Definition at line 186 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a 32-bit floating point number.
If so, asFloat32() will return that number.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreFloat32.
Definition at line 146 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a 64-bit floating point number.
If so, asFloat64() will return that number.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreFloat64.
Definition at line 156 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a 16-bit integer.
If so, asInt16() will return that integer.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreInt16.
Definition at line 116 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a 32-bit integer.
If so, asInt32() will return that integer.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreInt32.
Definition at line 126 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a 64-bit integer.
If so, asInt64() will return that integer.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreInt64.
Definition at line 136 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a 8-bit integer.
If so, asInt8() will return that integer.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreInt8.
Definition at line 106 of file Storable.h.
|
inlineoverridevirtual |
Reimplemented from yarp::os::Value.
Definition at line 277 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a list.
If so, asList() will return that list.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreList.
Definition at line 176 of file Storable.h.
|
inlineoverridevirtual |
Checks if the object is invalid.
Reimplemented from yarp::os::Searchable.
Reimplemented in yarp::os::impl::StoreNull.
Definition at line 221 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a string.
If so, asString() will return that string.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreString.
Definition at line 166 of file Storable.h.
|
inlineoverridevirtual |
Checks if value is a vocabulary identifier.
If so, asVocab() will return it.
Reimplemented from yarp::os::Value.
Reimplemented in yarp::os::impl::StoreVocab.
Definition at line 196 of file Storable.h.
bool Storable::operator== | ( | const yarp::os::Value & | alt | ) | const |
Definition at line 145 of file Storable.cpp.
|
overridevirtual |
Read this object from a network connection.
Override this for your particular class.
reader | an interface to the network connection for reading |
Implements yarp::os::Portable.
Definition at line 151 of file Storable.cpp.
|
pure virtual |
Implemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::StoreNull.
|
inlinevirtual |
Return a code describing this item, used in serializing bottles.
Reimplemented in yarp::os::impl::StoreList.
Definition at line 272 of file Storable.h.
|
overridepure virtual |
Return a standard text representation of the content of the object.
The representation is readable by the Bottle and Property classes.
Implements yarp::os::Searchable.
Implemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::StoreNull.
|
inlinevirtual |
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Reimplemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, and yarp::os::impl::StoreVocab.
Definition at line 264 of file Storable.h.
|
overridevirtual |
Write this object to a network connection.
Override this for your particular class. Be aware that depending on the nature of the connections a port has, and what protocol they use, and how efficient the YARP implementation is, this method may be called once, twice, or many times, as the result of a single call to Port::write
writer | an interface to the network connection for writing |
Implements yarp::os::Portable.
Definition at line 160 of file Storable.cpp.
|
pure virtual |
Implemented in yarp::os::impl::StoreDict, yarp::os::impl::StoreList, yarp::os::impl::StoreBlob, yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreFloat64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::StoreNull.