A single value (typically within a Bottle). More...
#include <yarp/os/Value.h>
Inheritance diagram for yarp::os::Value:Public Member Functions | |
| 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 | isBool () const |
| Checks if value is a boolean. More... | |
| virtual bool | isInt () const final |
| Checks if value is an integer. More... | |
| virtual bool | isInt8 () const |
| Checks if value is a 8-bit integer. More... | |
| virtual bool | isInt16 () const |
| Checks if value is a 16-bit integer. More... | |
| virtual bool | isInt32 () const |
| Checks if value is a 32-bit integer. More... | |
| virtual bool | isInt64 () const |
| Checks if value is a 64-bit integer. More... | |
| virtual bool | isDouble () const final |
| Checks if value is a floating point number. More... | |
| virtual bool | isFloat32 () const |
| Checks if value is a 32-bit floating point number. More... | |
| virtual bool | isFloat64 () const |
| Checks if value is a 64-bit floating point number. More... | |
| virtual bool | isString () const |
| Checks if value is a string. More... | |
| virtual bool | isList () const |
| Checks if value is a list. More... | |
| virtual bool | isDict () const |
| Checks if value is a dictionary. More... | |
| virtual bool | isVocab () const |
| Checks if value is a vocabulary identifier. More... | |
| virtual bool | isBlob () const |
| Checks if value is a binary object. More... | |
| virtual bool | asBool () const |
| Get boolean value. More... | |
| virtual int | asInt () const final |
| Get integer value. More... | |
| virtual std::int8_t | asInt8 () const |
| Get 8-bit integer value. More... | |
| virtual std::int16_t | asInt16 () const |
| Get 16-bit integer value. More... | |
| virtual std::int32_t | asInt32 () const |
| Get 32-bit integer value. More... | |
| virtual std::int64_t | asInt64 () const |
| Get 64-bit integer value. More... | |
| virtual double | asDouble () const final |
| Get floating point value. More... | |
| virtual yarp::conf::float32_t | asFloat32 () const |
| Get 32-bit floating point value. More... | |
| virtual yarp::conf::float64_t | asFloat64 () const |
| Get 64-bit floating point value. More... | |
| virtual std::int32_t | asVocab () const |
| Get vocabulary identifier as an integer. More... | |
| virtual std::string | asString () const |
| Get string value. More... | |
| virtual Bottle * | asList () const |
| Get list value. More... | |
| virtual Property * | asDict () const |
| Get dictionary (hash table) value. More... | |
| virtual Searchable * | asSearchable () const |
| Get dictionary or list value. More... | |
| virtual const char * | asBlob () const |
| Get binary data value. More... | |
| virtual size_t | asBlobLength () const |
| Get binary data length. 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 Value * | create () const |
| Create a new value of the same type. More... | |
| virtual Value * | clone () const |
| Create a copy of the value. 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 | isLeaf () const |
| 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 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 value (typically within a Bottle).
Values can be integers, strings, doubles (floating-point numbers), lists, vocabulary, or blobs (unformatted binary data). This set is carefully chosen to have good text and binary representations both for network transmission and human viewing/generation. Lists are represented as a nested Bottle object. Value objects are Searchable - but you won't find anything in them unless they are actually a list.
|
explicit |
|
explicit |
|
explicit |
| Value::Value | ( | void * | data, |
| int | length | ||
| ) |
| Value::Value | ( | const Value & | alt | ) |
|
virtual |
Get binary data value.
Reimplemented in yarp::os::impl::StoreBlob, and yarp::os::impl::Storable.
|
virtual |
Get binary data length.
Reimplemented in yarp::os::impl::StoreBlob, and yarp::os::impl::Storable.
|
virtual |
Get boolean value.
Reimplemented in yarp::os::impl::StoreVocab, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::Storable.
|
virtual |
Get dictionary (hash table) value.
Reimplemented in yarp::os::impl::StoreDict, and yarp::os::impl::Storable.
|
inlinefinalvirtual |
|
virtual |
Get 32-bit floating point 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, yarp::os::impl::StoreInt8, and yarp::os::impl::Storable.
|
virtual |
Get 64-bit floating point 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, yarp::os::impl::StoreInt8, and yarp::os::impl::Storable.
|
inlinefinalvirtual |
|
virtual |
Get 16-bit integer value.
Reimplemented in 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::Storable.
|
virtual |
Get 32-bit integer 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, yarp::os::impl::StoreInt8, and yarp::os::impl::Storable.
|
virtual |
Get 64-bit integer 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, yarp::os::impl::StoreInt8, and yarp::os::impl::Storable.
|
virtual |
Get 8-bit integer value.
Reimplemented in 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::Storable.
|
virtual |
Get list value.
Reimplemented in yarp::os::impl::StoreList, and yarp::os::impl::Storable.
|
virtual |
Get dictionary or list value.
Reimplemented in yarp::os::impl::Storable.
|
virtual |
Get string value.
Reimplemented in yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, and yarp::os::impl::Storable.
|
virtual |
Get vocabulary identifier as an integer.
Reimplemented in yarp::os::impl::StoreString, yarp::os::impl::StoreVocab, yarp::os::impl::StoreInt64, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt8, and yarp::os::impl::Storable.
|
overridevirtual |
Check if there exists a property of the given name.
| key | the name to check for |
Implements yarp::os::Searchable.
| virtual bool yarp::os::Searchable::check |
Check if there exists a property of the given name.
| key | the name to check for |
| bool yarp::os::Searchable::check |
Check if there exists a property of the given name.
| key | the name to check for |
| comment | Human-readable explanation |
Definition at line 121 of file Searchable.cpp.
| yarp::os::Value yarp::os::Searchable::check |
Gets a value corresponding to a given keyword.
| key | The keyword to look for |
| fallback | A default value to return if nothing found |
| comment | Optional human-readable explanation |
Definition at line 198 of file Searchable.cpp.
| bool yarp::os::Searchable::check |
Gets a value corresponding to a given keyword.
If a property does not exist, this returns false and does not modify the result pointer. If a property exists but does not have a value, this again returns false and does not modify the result pointer.
| key | The keyword to look for |
| result | A pointer to store the address of the result in |
| comment | Optional human-readable explanation |
Definition at line 184 of file Searchable.cpp.
|
virtual |
Create a copy of the value.
Reimplemented in yarp::os::impl::Storable.
|
virtual |
Create a new value of the same type.
Reimplemented in yarp::os::impl::Storable.
|
overridevirtual |
Gets a value corresponding to a given keyword.
| key | The keyword to look for |
Implements yarp::os::Searchable.
|
overridevirtual |
Gets a list corresponding to a given keyword.
| key | The keyword to look for |
Implements yarp::os::Searchable.
| virtual Bottle& yarp::os::Searchable::findGroup |
Gets a list corresponding to a given keyword.
| key | The keyword to look for |
| yarp::os::Bottle & yarp::os::Searchable::findGroup |
Gets a list corresponding to a given keyword.
| key | The keyword to look for |
| comment | Human-readable explanation |
Definition at line 157 of file Searchable.cpp.
| void Value::fromString | ( | const char * | str | ) |
|
virtual |
Get standard type code of value.
Reimplemented 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.
|
static |
|
virtual |
Checks if value is a binary object.
If so, asBlob() and asBlobLength() will return it.
Reimplemented in yarp::os::impl::StoreBlob, and yarp::os::impl::Storable.
|
virtual |
Checks if value is a boolean.
If so, asBool() will return that boolean.
Reimplemented in yarp::os::impl::StoreVocab, and yarp::os::impl::Storable.
|
virtual |
Checks if value is a dictionary.
If so, asDict() will return that dictionary.
Reimplemented in yarp::os::impl::StoreDict, and yarp::os::impl::Storable.
|
inlinefinalvirtual |
Checks if value is a floating point number.
If so, asDouble() will return that number.
|
virtual |
Checks if value is a 32-bit floating point number.
If so, asFloat32() will return that number.
Reimplemented in yarp::os::impl::StoreFloat32, and yarp::os::impl::Storable.
|
virtual |
Checks if value is a 64-bit floating point number.
If so, asFloat64() will return that number.
Reimplemented in yarp::os::impl::StoreFloat64, and yarp::os::impl::Storable.
|
inlinefinalvirtual |
|
virtual |
Checks if value is a 16-bit integer.
If so, asInt16() will return that integer.
Reimplemented in yarp::os::impl::StoreInt16, and yarp::os::impl::Storable.
|
virtual |
Checks if value is a 32-bit integer.
If so, asInt32() will return that integer.
Reimplemented in yarp::os::impl::StoreInt32, and yarp::os::impl::Storable.
|
virtual |
Checks if value is a 64-bit integer.
If so, asInt64() will return that integer.
Reimplemented in yarp::os::impl::StoreInt64, and yarp::os::impl::Storable.
|
virtual |
Checks if value is a 8-bit integer.
If so, asInt8() will return that integer.
Reimplemented in yarp::os::impl::StoreInt8, and yarp::os::impl::Storable.
|
virtual |
Reimplemented in yarp::os::impl::Storable.
|
virtual |
Checks if value is a list.
If so, asList() will return that list.
Reimplemented in yarp::os::impl::StoreList, and yarp::os::impl::Storable.
|
overridevirtual |
Checks if the object is invalid.
Reimplemented from yarp::os::Searchable.
|
virtual |
Checks if value is a string.
If so, asString() will return that string.
Reimplemented in yarp::os::impl::StoreString, and yarp::os::impl::Storable.
|
virtual |
Checks if value is a vocabulary identifier.
If so, asVocab() will return it.
Reimplemented in yarp::os::impl::StoreVocab, and yarp::os::impl::Storable.
|
static |
|
inlinestatic |
|
static |
|
static |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| bool Value::operator!= | ( | const Value & | alt | ) | const |
| bool Value::operator== | ( | const Value & | alt | ) | const |
|
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.
|
overridevirtual |
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.
|
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.