YARP
Yet Another Robot Platform
yarp::os::impl::StoreDict Class Reference

Key/value pairs. More...

#include <yarp/os/impl/Storable.h>

+ Inheritance diagram for yarp::os::impl::StoreDict:

Public Member Functions

 StoreDict ()=default
 
StorablecreateStorable () const override
 Factory method. More...
 
void copy (const Storable &alt) override
 Become a copy of the passed item. More...
 
yarp::os::Propertyinternal ()
 
std::string toString () const override
 Return a standard text representation of the content of the object. More...
 
void fromString (const std::string &src) override
 Initialize from a string representation, assuming that any syntax around this representation such as braces or parentheses has already been consumed. More...
 
std::string toStringNested () const override
 Create string representation, including any syntax that should wrap it such as braces or parentheses. More...
 
void fromStringNested (const std::string &src) override
 Initialize from a string representation. More...
 
std::int32_t getCode () const override
 Get standard type code of value. More...
 
bool readRaw (ConnectionReader &reader) override
 
bool writeRaw (ConnectionWriter &writer) const override
 
bool isDict () const override
 Checks if value is a dictionary. More...
 
yarp::os::PropertyasDict () const override
 Get dictionary (hash table) value. More...
 
yarp::os::Valuefind (const std::string &key) const override
 Gets a value corresponding to a given keyword. More...
 
yarp::os::BottlefindGroup (const std::string &key) const override
 Gets a list corresponding to a given keyword. More...
 
- Public Member Functions inherited from yarp::os::impl::Storable
virtual ~Storable ()
 Destructor. More...
 
virtual StorablecreateStorable () const =0
 Factory method. More...
 
virtual StorablecloneStorable () 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::Valuecreate () const override
 Create a new value of the same type. More...
 
yarp::os::Valueclone () 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::BottleasList () const override
 Get list value. More...
 
bool isDict () const override
 Checks if value is a dictionary. More...
 
yarp::os::PropertyasDict () const override
 Get dictionary (hash table) value. More...
 
bool isVocab32 () const override
 Checks if value is a vocabulary identifier. More...
 
yarp::conf::vocab32_t asVocab32 () 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...
 
SearchableasSearchable () 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::Valuefind (const std::string &key) const override
 Gets a value corresponding to a given keyword. More...
 
yarp::os::BottlefindGroup (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 isVocab32=false)
 Construct an integer Value. More...
 
 Value (yarp::conf::float64_t x)
 Construct a floating point Value. More...
 
 Value (const std::string &str, bool isVocab32=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 Valueoperator= (const Value &alt)
 Assignment operator. More...
 
 ~Value () override
 Destructor. More...
 
virtual bool isBool () const
 Checks if value is a boolean. 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 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 isVocab32 () 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 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 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 yarp::conf::vocab32_t asVocab32 () const
 Get vocabulary identifier as an integer. More...
 
virtual std::string asString () const
 Get string value. More...
 
virtual BottleasList () const
 Get list value. More...
 
virtual PropertyasDict () const
 Get dictionary (hash table) value. More...
 
virtual SearchableasSearchable () 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...
 
Valuefind (const std::string &key) const override
 Gets a value corresponding to a given keyword. More...
 
BottlefindGroup (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 Valuecreate () const
 Create a new value of the same type. More...
 
virtual Valueclone () 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 BottlefindGroup (const std::string &key) const=0
 Gets a list corresponding to a given keyword. More...
 
BottlefindGroup (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
bool read (ConnectionReader &reader) override=0
 Read this object from a network connection. More...
 
bool write (ConnectionWriter &writer) const override=0
 Write this object to a network connection. More...
 
virtual Type getType () const
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual bool read (ConnectionReader &reader)=0
 Read this object from a network connection. More...
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor. More...
 
virtual bool write (ConnectionWriter &writer) const =0
 Write this object to a network connection. 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...
 
Searchableoperator= (const Searchable &rhs)=default
 Copy assignment operator. More...
 
Searchableoperator= (Searchable &&rhs) noexcept=default
 Move assignment operator. 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 Valuefind (const std::string &key) const =0
 Gets a value corresponding to a given keyword. More...
 
virtual BottlefindGroup (const std::string &key) const =0
 Gets a list corresponding to a given keyword. More...
 
BottlefindGroup (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...
 
virtual bool isNull () const
 Checks if the object is invalid. More...
 
virtual std::string toString () const =0
 Return a standard text representation of the content of the object. More...
 

Static Public Attributes

static const std::int32_t code = 256 | 512
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::impl::Storable
static StorablecreateByCode (std::int32_t id)
 
- Static Public Member Functions inherited from yarp::os::Value
static ValuemakeInt8 (std::int8_t x)
 Create a 8-bit integer Value. More...
 
static ValuemakeInt16 (std::int16_t x)
 Create a 16-bit integer Value. More...
 
static ValuemakeInt32 (std::int32_t x)
 Create a 32-bit integer Value. More...
 
static ValuemakeInt64 (std::int64_t x)
 Create a 64-bit integer Value. More...
 
static ValuemakeFloat32 (yarp::conf::float32_t x)
 Create a 32-bit floating point Value. More...
 
static ValuemakeFloat64 (yarp::conf::float64_t x)
 Create a 64-bit floating point Value. More...
 
static ValuemakeString (const std::string &str)
 Create a string Value. More...
 
static ValuemakeVocab32 (yarp::conf::vocab32_t v)
 Create a vocabulary identifier Value. More...
 
static ValuemakeVocab32 (char a, char b=0, char c=0, char d=0)
 Create a vocabulary identifier Value. More...
 
static ValuemakeVocab32 (const std::string &str)
 Create a vocabulary identifier Value If the string is longer than 4 characters, only the first 4 are used. More...
 
static ValuemakeBlob (void *data, int length)
 Create a Value containing binary data. More...
 
static ValuemakeList ()
 Create a list Value. More...
 
static ValuemakeList (const char *txt)
 Create a list Value and initialize it. More...
 
static ValuemakeValue (const std::string &txt)
 Create a Value from a text description. More...
 
static ValuegetNullValue ()
 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...
 

Detailed Description

Key/value pairs.

Definition at line 1101 of file Storable.h.

Constructor & Destructor Documentation

◆ StoreDict()

yarp::os::impl::StoreDict::StoreDict ( )
default

Member Function Documentation

◆ asDict()

yarp::os::Property * yarp::os::impl::StoreDict::asDict ( ) const
inlineoverridevirtual

Get dictionary (hash table) value.

Returns
pointer to dictionary if value is indeed of the right type. Otherwise returns nullptr

Reimplemented from yarp::os::impl::Storable.

Definition at line 1144 of file Storable.h.

◆ copy()

void yarp::os::impl::StoreDict::copy ( const Storable alt)
inlineoverridevirtual

Become a copy of the passed item.

Implements yarp::os::impl::Storable.

Definition at line 1115 of file Storable.h.

◆ createStorable()

Storable * yarp::os::impl::StoreDict::createStorable ( ) const
inlineoverridevirtual

Factory method.

Implements yarp::os::impl::Storable.

Definition at line 1110 of file Storable.h.

◆ find()

yarp::os::Value & yarp::os::impl::StoreDict::find ( const std::string &  key) const
inlineoverridevirtual

Gets a value corresponding to a given keyword.

Parameters
keyThe keyword to look for
Returns
A value corresponding to a given keyword. If there is no such value, then the isNull() method called on the result will be true. Otherwise, the value can be read by calling result.asInt32(), result.asString(), etc. as appropriate.

Reimplemented from yarp::os::impl::Storable.

Definition at line 1149 of file Storable.h.

◆ findGroup()

yarp::os::Bottle & yarp::os::impl::StoreDict::findGroup ( const std::string &  key) const
inlineoverridevirtual

Gets a list corresponding to a given keyword.

Parameters
keyThe keyword to look for
Returns
A list corresponding to a given keyword. If there is no such list, then the isNull() method called on the result will be true. Otherwise, the elements of the list can be read through result.get(index) where result.get(0) is the keyword, and result.get(i) for i>=1 are the "real" elements of the list.

Reimplemented from yarp::os::impl::Storable.

Definition at line 1154 of file Storable.h.

◆ fromString()

void StoreDict::fromString ( const std::string &  src)
overridevirtual

Initialize from a string representation, assuming that any syntax around this representation such as braces or parentheses has already been consumed.

Implements yarp::os::impl::Storable.

Definition at line 632 of file Storable.cpp.

◆ fromStringNested()

void StoreDict::fromStringNested ( const std::string &  src)
overridevirtual

Initialize from a string representation.

This should consume any syntax around that representation such as braces or parentheses.

Reimplemented from yarp::os::impl::Storable.

Definition at line 637 of file Storable.cpp.

◆ getCode()

std::int32_t yarp::os::impl::StoreDict::getCode ( ) const
inlineoverridevirtual

Get standard type code of value.

Returns
the standard type code of the value.

Reimplemented from yarp::os::Value.

Definition at line 1131 of file Storable.h.

◆ internal()

yarp::os::Property & yarp::os::impl::StoreDict::internal ( )
inline

Definition at line 1120 of file Storable.h.

◆ isDict()

bool yarp::os::impl::StoreDict::isDict ( ) const
inlineoverridevirtual

Checks if value is a dictionary.

If so, asDict() will return that dictionary.

Returns
true iff value is a dictionary

Reimplemented from yarp::os::impl::Storable.

Definition at line 1139 of file Storable.h.

◆ readRaw()

bool StoreDict::readRaw ( ConnectionReader reader)
overridevirtual

Implements yarp::os::impl::Storable.

Definition at line 648 of file Storable.cpp.

◆ toString()

std::string StoreDict::toString ( ) const
overridevirtual

Return a standard text representation of the content of the object.

The representation is readable by the Bottle and Property classes.

Returns
A standard text representation of the content of the object.

Implements yarp::os::impl::Storable.

Definition at line 622 of file Storable.cpp.

◆ toStringNested()

std::string StoreDict::toStringNested ( ) const
overridevirtual

Create string representation, including any syntax that should wrap it such as braces or parentheses.

Reimplemented from yarp::os::impl::Storable.

Definition at line 627 of file Storable.cpp.

◆ writeRaw()

bool StoreDict::writeRaw ( ConnectionWriter writer) const
overridevirtual

Implements yarp::os::impl::Storable.

Definition at line 655 of file Storable.cpp.

Member Data Documentation

◆ code

const int StoreDict::code = 256 | 512
static

Definition at line 1130 of file Storable.h.


The documentation for this class was generated from the following files: