YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::os::Value Class Reference

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.
 
 Value (std::int32_t x, bool isVocab32=false)
 Construct an integer Value.
 
 Value (yarp::conf::float64_t x)
 Construct a floating point Value.
 
 Value (const std::string &str, bool isVocab32=false)
 Construct a string Value.
 
 Value (void *data, int length)
 Construct a binary data Value.
 
 Value (const Value &alt)
 Copy constructor.
 
const Valueoperator= (const Value &alt)
 Assignment operator.
 
 ~Value () override
 Destructor.
 
virtual bool isBool () const
 Checks if value is a boolean.
 
virtual bool isInt8 () const
 Checks if value is a 8-bit integer.
 
virtual bool isInt16 () const
 Checks if value is a 16-bit integer.
 
virtual bool isInt32 () const
 Checks if value is a 32-bit integer.
 
virtual bool isInt64 () const
 Checks if value is a 64-bit integer.
 
virtual bool isFloat32 () const
 Checks if value is a 32-bit floating point number.
 
virtual bool isFloat64 () const
 Checks if value is a 64-bit floating point number.
 
virtual bool isString () const
 Checks if value is a string.
 
virtual bool isList () const
 Checks if value is a list.
 
virtual bool isDict () const
 Checks if value is a dictionary.
 
virtual bool isVocab32 () const
 Checks if value is a vocabulary identifier.
 
virtual bool isBlob () const
 Checks if value is a binary object.
 
virtual bool asBool () const
 Get boolean value.
 
virtual std::int8_t asInt8 () const
 Get 8-bit integer value.
 
virtual std::int16_t asInt16 () const
 Get 16-bit integer value.
 
virtual std::int32_t asInt32 () const
 Get 32-bit integer value.
 
virtual std::int64_t asInt64 () const
 Get 64-bit integer value.
 
virtual yarp::conf::float32_t asFloat32 () const
 Get 32-bit floating point value.
 
virtual yarp::conf::float64_t asFloat64 () const
 Get 64-bit floating point value.
 
virtual yarp::conf::vocab32_t asVocab32 () const
 Get vocabulary identifier as an integer.
 
virtual std::string asString () const
 Get string value.
 
virtual BottleasList () const
 Get list value.
 
virtual PropertyasDict () const
 Get dictionary (hash table) value.
 
virtual SearchableasSearchable () const
 Get dictionary or list value.
 
virtual const charasBlob () const
 Get binary data value.
 
virtual size_t asBlobLength () const
 Get binary data length.
 
bool read (ConnectionReader &connection) override
 Read this object from a network connection.
 
bool write (ConnectionWriter &connection) const override
 Write this object to a network connection.
 
bool check (const std::string &key) const override
 Check if there exists a property of the given name.
 
Valuefind (const std::string &key) const override
 Gets a value corresponding to a given keyword.
 
BottlefindGroup (const std::string &key) const override
 Gets a list corresponding to a given keyword.
 
bool operator== (const Value &alt) const
 Equality test.
 
bool operator!= (const Value &alt) const
 Inequality test.
 
void fromString (const char *str)
 Set value to correspond to a textual representation.
 
std::string toString () const override
 Return a standard text representation of the content of the object.
 
virtual Valuecreate () const
 Create a new value of the same type.
 
virtual Valueclone () const
 Create a copy of the value.
 
virtual std::int32_t getCode () const
 Get standard type code of value.
 
bool isNull () const override
 Checks if the object is invalid.
 
virtual bool isLeaf () const
 
virtual bool check (const std::string &key) const=0
 Check if there exists a property of the given name.
 
virtual bool check (const std::string &key, const std::string &comment) const
 Check if there exists a property of the given name.
 
virtual bool check (const std::string &key, Value *&result, const std::string &comment="") const
 Gets a value corresponding to a given keyword.
 
virtual Value check (const std::string &key, const Value &fallback, const std::string &comment="") const
 Gets a value corresponding to a given keyword.
 
virtual BottlefindGroup (const std::string &key) const=0
 Gets a list corresponding to a given keyword.
 
BottlefindGroup (const std::string &key, const std::string &comment) const
 Gets a list corresponding to a given keyword.
 
- Public Member Functions inherited from yarp::os::Portable
virtual Type getType () const
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor.
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor.
 
virtual void onCompletion () const
 This is called when the port has finished all writing operations.
 
virtual void onCommencement () const
 This is called when the port is about to begin writing operations.
 
virtual yarp::os::Type getWriteType () const
 
- Public Member Functions inherited from yarp::os::Searchable
 Searchable ()
 Default constructor.
 
 Searchable (const Searchable &rhs)=default
 Copy constructor.
 
 Searchable (Searchable &&rhs) noexcept=default
 Move constructor.
 
virtual ~Searchable ()
 Destructor.
 
Searchableoperator= (const Searchable &rhs)=default
 Copy assignment operator.
 
Searchableoperator= (Searchable &&rhs) noexcept=default
 Move assignment operator.
 
BottlefindGroup (const std::string &key, const std::string &comment) const
 Gets a list corresponding to a given keyword.
 

Static Public Member Functions

static ValuemakeInt8 (std::int8_t x)
 Create a 8-bit integer Value.
 
static ValuemakeInt16 (std::int16_t x)
 Create a 16-bit integer Value.
 
static ValuemakeInt32 (std::int32_t x)
 Create a 32-bit integer Value.
 
static ValuemakeInt64 (std::int64_t x)
 Create a 64-bit integer Value.
 
static ValuemakeFloat32 (yarp::conf::float32_t x)
 Create a 32-bit floating point Value.
 
static ValuemakeFloat64 (yarp::conf::float64_t x)
 Create a 64-bit floating point Value.
 
static ValuemakeString (const std::string &str)
 Create a string Value.
 
static ValuemakeVocab32 (yarp::conf::vocab32_t v)
 Create a vocabulary identifier Value.
 
static ValuemakeVocab32 (char a, char b=0, char c=0, char d=0)
 Create a vocabulary identifier Value.
 
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.
 
static ValuemakeBlob (void *data, int length)
 Create a Value containing binary data.
 
static ValuemakeList ()
 Create a list Value.
 
static ValuemakeList (const char *txt)
 Create a list Value and initialize it.
 
static ValuemakeValue (const std::string &txt)
 Create a Value from a text description.
 
static ValuegetNullValue ()
 Return an invalid, "null" Value.
 
- 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.
 

Detailed Description

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.

Examples
dev/motortest/motortest.cpp, framerate/main.cpp, os/browse_bottle/browse_bottle.cpp, and os/database/database.cpp.

Definition at line 42 of file Value.h.

Constructor & Destructor Documentation

◆ Value() [1/6]

Value::Value ( )
explicit

Construct a list Value.

Definition at line 18 of file Value.cpp.

◆ Value() [2/6]

Value::Value ( std::int32_t  x,
bool  isVocab32 = false 
)
explicit

Construct an integer Value.

Parameters
xthe integer
isVocab32set this to true if the integer should be interpreted as a vocabulary identifier

Definition at line 25 of file Value.cpp.

◆ Value() [3/6]

Value::Value ( yarp::conf::float64_t  x)
explicit

Construct a floating point Value.

Parameters
xthe number

Definition at line 37 of file Value.cpp.

◆ Value() [4/6]

Value::Value ( const std::string &  str,
bool  isVocab32 = false 
)
explicit

Construct a string Value.

Parameters
strthe string
isVocab32set this to true if the string should be interpreted as a vocabulary identifier

Definition at line 45 of file Value.cpp.

◆ Value() [5/6]

Value::Value ( void data,
int  length 
)

Construct a binary data Value.

Parameters
datathe data to copy
lengththe size of the data in bytes

Definition at line 57 of file Value.cpp.

◆ Value() [6/6]

Value::Value ( const Value alt)

Copy constructor.

Parameters
altthe value to copy

Definition at line 65 of file Value.cpp.

◆ ~Value()

Value::~Value ( )
override

Destructor.

Definition at line 106 of file Value.cpp.

Member Function Documentation

◆ asBlob()

const char * Value::asBlob ( ) const
virtual

Get binary data value.

Returns
pointer to binary data if value is indeed binary data. Otherwise returns nullptr

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreBlob.

Definition at line 261 of file Value.cpp.

◆ asBlobLength()

size_t Value::asBlobLength ( ) const
virtual

Get binary data length.

Returns
length of binary data if value is indeed binary data. Otherwise returns 0

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreBlob.

Definition at line 267 of file Value.cpp.

◆ asBool()

bool Value::asBool ( ) const
virtual

Get boolean value.

Returns
boolean value if value is indeed a boolean. If it is another type, the appropriate cast value is returned. Otherwise returns false.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, and yarp::os::impl::StoreVocab32.

Definition at line 186 of file Value.cpp.

◆ asDict()

Property * Value::asDict ( ) const
virtual

Get dictionary (hash table) value.

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

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreDict.

Definition at line 246 of file Value.cpp.

◆ asFloat32()

yarp::conf::float32_t Value::asFloat32 ( ) const
virtual

Get 32-bit floating point value.

Returns
floating point value if value is indeed a 32-bit floating point. If it is another numeric type, the appropriate cast value is returned. Otherwise returns 0.
Warning
This method performs casts if the Value is not a Float32 value, therefore it might lead to unexpected behaviours if the type is not properly checked.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreFloat64, and yarp::os::impl::StoreVocab32.

Definition at line 216 of file Value.cpp.

◆ asFloat64()

yarp::conf::float64_t Value::asFloat64 ( ) const
virtual

Get 64-bit floating point value.

Returns
floating point value if value is indeed a 64-bit floating point. If it is another numeric type, the appropriate cast value is returned. Otherwise returns 0.
Warning
This method performs casts if the Value is not a Float32 value, therefore it might lead to unexpected behaviours if the type is not properly checked.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreFloat64, and yarp::os::impl::StoreVocab32.

Definition at line 222 of file Value.cpp.

◆ asInt16()

std::int16_t Value::asInt16 ( ) const
virtual

Get 16-bit integer value.

Returns
16-bit integer value if value is indeed an integer. If it is another numeric type, the appropriate cast value is returned. Otherwise returns 0.
Warning
This method performs casts if the Value is not a Float32 value, therefore it might lead to unexpected behaviours if the type is not properly checked.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreFloat32, and yarp::os::impl::StoreFloat64.

Definition at line 198 of file Value.cpp.

◆ asInt32()

std::int32_t Value::asInt32 ( ) const
virtual

Get 32-bit integer value.

Returns
32-bit integer value if value is indeed an integer. If it is another numeric type, the appropriate cast value is returned. Otherwise returns 0.
Warning
This method performs casts if the Value is not a Float32 value, therefore it might lead to unexpected behaviours if the type is not properly checked.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreFloat64, and yarp::os::impl::StoreVocab32.

Examples
property/main.cpp.

Definition at line 204 of file Value.cpp.

◆ asInt64()

std::int64_t Value::asInt64 ( ) const
virtual

Get 64-bit integer value.

Returns
64-bit integer value if value is indeed an integer. If it is another numeric type, the appropriate cast value is returned. Otherwise returns 0.
Warning
This method performs casts if the Value is not a Float32 value, therefore it might lead to unexpected behaviours if the type is not properly checked.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreFloat32, yarp::os::impl::StoreFloat64, and yarp::os::impl::StoreVocab32.

Definition at line 210 of file Value.cpp.

◆ asInt8()

std::int8_t Value::asInt8 ( ) const
virtual

Get 8-bit integer value.

Returns
8-bit integer value if value is indeed an integer. If it is another numeric type, the appropriate cast value is returned. Otherwise returns 0.
Warning
This method performs casts if the Value is not a Float32 value, therefore it might lead to unexpected behaviours if the type is not properly checked.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreFloat32, and yarp::os::impl::StoreFloat64.

Definition at line 192 of file Value.cpp.

◆ asList()

Bottle * Value::asList ( ) const
virtual

Get list value.

Returns
pointer to list if value is indeed a list. Otherwise returns nullptr

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreList.

Definition at line 240 of file Value.cpp.

◆ asSearchable()

Searchable * Value::asSearchable ( ) const
virtual

Get dictionary or list value.

Returns
pointer to dictionary or list value if present. Otherwise returns nullptr

Reimplemented in yarp::os::impl::Storable.

Definition at line 252 of file Value.cpp.

◆ asString()

std::string Value::asString ( ) const
virtual

Get string value.

Returns
string value if value is indeed a string. Otherwise returns empty string.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreVocab32, and yarp::os::impl::StoreString.

Examples
framerate/main.cpp.

Definition at line 234 of file Value.cpp.

◆ asVocab32()

yarp::conf::vocab32_t Value::asVocab32 ( ) const
virtual

Get vocabulary identifier as an integer.

Returns
integer value of vocabulary identifier.

Reimplemented in yarp::os::impl::Storable, yarp::os::impl::StoreInt8, yarp::os::impl::StoreInt16, yarp::os::impl::StoreInt32, yarp::os::impl::StoreInt64, yarp::os::impl::StoreVocab32, and yarp::os::impl::StoreString.

Definition at line 228 of file Value.cpp.

◆ check() [1/5]

bool Value::check ( const std::string &  key) const
overridevirtual

Check if there exists a property of the given name.

Parameters
keythe name to check for
Returns
true iff a property of the given name exists, even if it doesn't have a value associated with it

Implements yarp::os::Searchable.

Definition at line 321 of file Value.cpp.

◆ check() [2/5]

virtual bool yarp::os::Searchable::check ( const std::string &  key) const
virtual

Check if there exists a property of the given name.

Parameters
keythe name to check for
Returns
true iff a property of the given name exists, even if it doesn't have a value associated with it

Implements yarp::os::Searchable.

◆ check() [3/5]

bool yarp::os::Searchable::check ( const std::string &  key,
const std::string &  comment 
) const
virtual

Check if there exists a property of the given name.

Parameters
keythe name to check for
commentHuman-readable explanation
Returns
true iff a property of the given name exists, even if it doesn't have a value associated with it

Reimplemented from yarp::os::Searchable.

Definition at line 79 of file Searchable.cpp.

◆ check() [4/5]

yarp::os::Value yarp::os::Searchable::check ( const std::string &  key,
const Value fallback,
const std::string &  comment = "" 
) const
virtual

Gets a value corresponding to a given keyword.

Parameters
keyThe keyword to look for
fallbackA default value to return if nothing found
commentOptional human-readable explanation
Returns
A value corresponding to a given keyword, or the default if nothing is found. See the find() method for interpreting the value found.

Reimplemented from yarp::os::Searchable.

Definition at line 156 of file Searchable.cpp.

◆ check() [5/5]

bool yarp::os::Searchable::check ( const std::string &  key,
Value *&  result,
const std::string &  comment = "" 
) const
virtual

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.

p.fromString("(width 10) (height 15) (help)");
p.check("help") // this is true
p.check("width") // this is true
p.check("foo") // this is false
Value *v;
p.check("help", v) // this is false, there is no value associated
p.check("width", v) // this is true, and v->asInt32() is 10
A mini-server for performing network communication in the background.
A class for storing options and configuration information.
Definition Property.h:33
A single value (typically within a Bottle).
Definition Value.h:43
Parameters
keyThe keyword to look for
resultA pointer to store the address of the result in
commentOptional human-readable explanation
Returns
True if there is a value corresponding to a given keyword, false otherwise. See the find() method for interpreting the value found.

Reimplemented from yarp::os::Searchable.

Definition at line 142 of file Searchable.cpp.

◆ clone()

Value * Value::clone ( ) const
virtual

Create a copy of the value.

Returns
the new value, which will equal this.

Reimplemented in yarp::os::impl::Storable.

Definition at line 368 of file Value.cpp.

◆ create()

Value * Value::create ( ) const
virtual

Create a new value of the same type.

Returns
the new value.

Reimplemented in yarp::os::impl::Storable.

Definition at line 362 of file Value.cpp.

◆ find()

Value & Value::find ( const std::string &  key) const
overridevirtual

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.

Implements yarp::os::Searchable.

Definition at line 327 of file Value.cpp.

◆ findGroup() [1/3]

Bottle & Value::findGroup ( const std::string &  key) const
overridevirtual

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.

Implements yarp::os::Searchable.

Definition at line 333 of file Value.cpp.

◆ findGroup() [2/3]

virtual Bottle & yarp::os::Searchable::findGroup ( const std::string &  key) const
virtual

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.

Implements yarp::os::Searchable.

◆ findGroup() [3/3]

yarp::os::Bottle & yarp::os::Searchable::findGroup ( const std::string &  key,
const std::string &  comment 
) const

Gets a list corresponding to a given keyword.

Parameters
keyThe keyword to look for
commentHuman-readable explanation
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.

Definition at line 115 of file Searchable.cpp.

◆ fromString()

void Value::fromString ( const char str)

Set value to correspond to a textual representation.

For example if str="10" then the value will be an integer, if str="(1 2 3)" the value will be a list.

Parameters
strthe textual representation.

Definition at line 351 of file Value.cpp.

◆ getCode()

◆ getNullValue()

Value & Value::getNullValue ( )
static

Return an invalid, "null" Value.

Returns
an invalid "null" Value

Definition at line 466 of file Value.cpp.

◆ isBlob()

bool Value::isBlob ( ) const
virtual

Checks if value is a binary object.

If so, asBlob() and asBlobLength() will return it.

Returns
true iff value is a binary object.

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreBlob.

Definition at line 180 of file Value.cpp.

◆ isBool()

bool Value::isBool ( ) const
virtual

Checks if value is a boolean.

If so, asBool() will return that boolean.

Returns
true iff value is a boolean

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreVocab32.

Definition at line 114 of file Value.cpp.

◆ isDict()

bool Value::isDict ( ) const
virtual

Checks if value is a dictionary.

If so, asDict() will return that dictionary.

Returns
true iff value is a dictionary

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreDict.

Definition at line 168 of file Value.cpp.

◆ isFloat32()

bool Value::isFloat32 ( ) const
virtual

Checks if value is a 32-bit floating point number.

If so, asFloat32() will return that number.

Returns
true iff value is a 32-bit floating point number

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreFloat32.

Definition at line 144 of file Value.cpp.

◆ isFloat64()

bool Value::isFloat64 ( ) const
virtual

Checks if value is a 64-bit floating point number.

If so, asFloat64() will return that number.

Returns
true iff value is a 64-bit floating point number

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreFloat64.

Definition at line 150 of file Value.cpp.

◆ isInt16()

bool Value::isInt16 ( ) const
virtual

Checks if value is a 16-bit integer.

If so, asInt16() will return that integer.

Returns
true iff value is a 16-bit integer

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreInt16.

Definition at line 126 of file Value.cpp.

◆ isInt32()

bool Value::isInt32 ( ) const
virtual

Checks if value is a 32-bit integer.

If so, asInt32() will return that integer.

Returns
true iff value is a 32-bit integer

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreInt32.

Definition at line 132 of file Value.cpp.

◆ isInt64()

bool Value::isInt64 ( ) const
virtual

Checks if value is a 64-bit integer.

If so, asInt64() will return that integer.

Returns
true iff value is a 64-bit integer

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreInt64.

Definition at line 138 of file Value.cpp.

◆ isInt8()

bool Value::isInt8 ( ) const
virtual

Checks if value is a 8-bit integer.

If so, asInt8() will return that integer.

Returns
true iff value is a 8-bit integer

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreInt8.

Definition at line 120 of file Value.cpp.

◆ isLeaf()

bool Value::isLeaf ( ) const
virtual

Reimplemented in yarp::os::impl::Storable.

Definition at line 386 of file Value.cpp.

◆ isList()

bool Value::isList ( ) const
virtual

Checks if value is a list.

If so, asList() will return that list.

Returns
true iff value is a list

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreList.

Definition at line 162 of file Value.cpp.

◆ isNull()

bool Value::isNull ( ) const
overridevirtual

Checks if the object is invalid.

Returns
True if the object is invalid or "null".

Reimplemented from yarp::os::Searchable.

Definition at line 380 of file Value.cpp.

◆ isString()

bool Value::isString ( ) const
virtual

Checks if value is a string.

If so, asString() will return that string.

Returns
true iff value is a string

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreString.

Definition at line 156 of file Value.cpp.

◆ isVocab32()

bool Value::isVocab32 ( ) const
virtual

Checks if value is a vocabulary identifier.

If so, asVocab32() will return it.

Returns
true iff value is a vocabulary identifier

Reimplemented in yarp::os::impl::Storable, and yarp::os::impl::StoreVocab32.

Definition at line 174 of file Value.cpp.

◆ makeBlob()

Value * Value::makeBlob ( void data,
int  length 
)
static

Create a Value containing binary data.

Parameters
datathe data (will be copied)
lengththe size of the data in bytes
Returns
a Value containing binary data

Definition at line 433 of file Value.cpp.

◆ makeFloat32()

Value * Value::makeFloat32 ( yarp::conf::float32_t  x)
static

Create a 32-bit floating point Value.

Parameters
xthe value to take on
Returns
a 32-bit floating point Value

Definition at line 411 of file Value.cpp.

◆ makeFloat64()

Value * Value::makeFloat64 ( yarp::conf::float64_t  x)
static

Create a 64-bit floating point Value.

Parameters
xthe value to take on
Returns
a 64-bit floating point Value

Definition at line 416 of file Value.cpp.

◆ makeInt16()

Value * Value::makeInt16 ( std::int16_t  x)
static

Create a 16-bit integer Value.

Parameters
xthe value to take on
Returns
a 16-bit integer Value

Definition at line 396 of file Value.cpp.

◆ makeInt32()

Value * Value::makeInt32 ( std::int32_t  x)
static

Create a 32-bit integer Value.

Parameters
xthe value to take on
Returns
a 32-bit integer Value

Definition at line 401 of file Value.cpp.

◆ makeInt64()

Value * Value::makeInt64 ( std::int64_t  x)
static

Create a 64-bit integer Value.

Parameters
xthe value to take on
Returns
a 64-bit integer Value

Definition at line 406 of file Value.cpp.

◆ makeInt8()

Value * Value::makeInt8 ( std::int8_t  x)
static

Create a 8-bit integer Value.

Parameters
xthe value to take on
Returns
a 8-bit integer Value

Definition at line 391 of file Value.cpp.

◆ makeList() [1/2]

Value * Value::makeList ( )
static

Create a list Value.

Returns
a list Value

Definition at line 440 of file Value.cpp.

◆ makeList() [2/2]

Value * Value::makeList ( const char txt)
static

Create a list Value and initialize it.

Parameters
txtthe list in text form, e.g. "1 2.0 (4 5) xyz"
Returns
a list Value

Definition at line 446 of file Value.cpp.

◆ makeString()

Value * Value::makeString ( const std::string &  str)
static

Create a string Value.

Parameters
strthe value to take on
Returns
a string Value

Definition at line 421 of file Value.cpp.

◆ makeValue()

Value * Value::makeValue ( const std::string &  txt)
static

Create a Value from a text description.

Parameters
txtthe description. E.g. "10" will create an integer, "(5 6 7)" will create a list.
Returns
the Value to which the text description corresponds

Definition at line 456 of file Value.cpp.

◆ makeVocab32() [1/3]

static Value * yarp::os::Value::makeVocab32 ( char  a,
char  b = 0,
char  c = 0,
char  d = 0 
)
inlinestatic

Create a vocabulary identifier Value.

Parameters
afirst character of the vocab
bsecond character of the vocab
cthird character of the vocab
dfourth character of the vocab
Returns
a vocabulary identifier Value

Definition at line 428 of file Value.h.

◆ makeVocab32() [2/3]

static Value * yarp::os::Value::makeVocab32 ( const std::string &  str)
inlinestatic

Create a vocabulary identifier Value If the string is longer than 4 characters, only the first 4 are used.

Parameters
strthe value to take on
Returns
a vocabulary identifier Value

Definition at line 439 of file Value.h.

◆ makeVocab32() [3/3]

Value * Value::makeVocab32 ( yarp::conf::vocab32_t  v)
static

Create a vocabulary identifier Value.

Parameters
vthe value to take on
Returns
a vocabulary identifier Value

Definition at line 427 of file Value.cpp.

◆ operator!=()

bool Value::operator!= ( const Value alt) const

Inequality test.

Parameters
altthe value to compare against
Returns
true iff the values are not equal

Definition at line 346 of file Value.cpp.

◆ operator=()

const Value & Value::operator= ( const Value alt)

Assignment operator.

Parameters
altthe value to copy
Returns
this object itself

Definition at line 74 of file Value.cpp.

◆ operator==()

bool Value::operator== ( const Value alt) const

Equality test.

Parameters
altthe value to compare against
Returns
true iff the values are equal

Definition at line 339 of file Value.cpp.

◆ read()

bool Value::read ( ConnectionReader reader)
overridevirtual

Read this object from a network connection.

Override this for your particular class.

Parameters
readeran interface to the network connection for reading
Returns
true iff the object is successfully read

Implements yarp::os::Portable.

Definition at line 273 of file Value.cpp.

◆ toString()

std::string Value::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::Searchable.

Definition at line 356 of file Value.cpp.

◆ write()

bool Value::write ( ConnectionWriter writer) const
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

Parameters
writeran interface to the network connection for writing
Returns
true iff the object is successfully written

Implements yarp::os::Portable.

Definition at line 309 of file Value.cpp.


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