|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
80 if (proxy ==
nullptr) {
81 if (
isLeaf() && (alt.proxy !=
nullptr)) {
88 if (alt.proxy !=
nullptr) {
96 if (proxy !=
nullptr) {
111 if (proxy !=
nullptr) {
120 return proxy->isBool();
126 return proxy->isInt8();
132 return proxy->isInt16();
138 return proxy->isInt32();
144 return proxy->isInt64();
150 return proxy->isFloat32();
156 return proxy->isFloat64();
162 return proxy->isString();
168 return proxy->isList();
174 return proxy->isDict();
180 return proxy->isVocab();
186 return proxy->isBlob();
192 return proxy->asBool();
198 return proxy->asInt8();
204 return proxy->asInt16();
210 return proxy->asInt32();
216 return proxy->asInt64();
222 return proxy->asFloat32();
228 return proxy->asFloat64();
234 return proxy->asVocab();
240 return proxy->asString();
246 return proxy->asList();
252 return proxy->asDict();
258 if (proxy->isDict()) {
259 return proxy->asDict();
261 return proxy->asList();
267 return proxy->asBlob();
273 return proxy->asBlobLength();
278 if (proxy !=
nullptr) {
283 if ((x & 0xffff) != x) {
304 Storable* s = Storable::createByCode(x);
306 if (proxy ==
nullptr) {
314 if (proxy ==
nullptr) {
321 return proxy->write(connection);
327 return proxy->check(key);
333 return proxy->find(key);
339 return proxy->findGroup(key);
345 return (*proxy) == alt;
351 return !((*this) == alt);
362 return proxy->toString();
368 return proxy->create();
374 return proxy->clone();
380 return proxy->getCode();
386 return proxy->isNull();
444 std::string s((
char*)data, length);
468 if (bot.
size() > 1) {
477 return BottleImpl::getNull();
481 void Value::setProxy(
Storable* proxy)
483 if (this->proxy !=
nullptr) {
485 this->proxy =
nullptr;
491 void Value::ok()
const
493 const Value* op =
this;
494 if (proxy ==
nullptr) {
virtual Searchable * asSearchable() const
Get dictionary or list value.
virtual bool check(const std::string &key) const=0
Check if there exists a property of the given name.
A simple collection of objects that can be described and transmitted in a portable way.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
static Value * makeString(const std::string &str)
Create a string Value.
static Value & getNullValue()
Return an invalid, "null" Value.
This is a base class for objects that can be both read from and be written to the YARP network.
A base class for nested structures that can be searched.
virtual Property * asDict() const
Get dictionary (hash table) value.
size_type size() const
Gets the number of elements in the bottle.
static Value * makeList()
Create a list Value.
static Value * makeFloat32(yarp::conf::float32_t x)
Create a 32-bit floating point Value.
virtual const char * asBlob() const
Get binary data value.
static Value * makeInt8(std::int8_t x)
Create a 8-bit integer Value.
static Value * makeFloat64(yarp::conf::float64_t x)
Create a 64-bit floating point Value.
static Value * makeInt32(std::int32_t x)
Create a 32-bit integer Value.
virtual bool isFloat32() const
Checks if value is a 32-bit floating point number.
virtual Value * clone() const
Create a copy of the value.
void fromString(const std::string &text)
Initializes bottle from a string.
virtual yarp::conf::float32_t asFloat32() const
Get 32-bit floating point value.
virtual bool isDict() const
Checks if value is a dictionary.
A single item in a Bottle.
bool write(ConnectionWriter &connection) const override
Write this object to a network connection.
static Value * makeVocab(std::int32_t v)
Create a vocabulary identifier Value.
bool read(ConnectionReader &connection) override
Read this object from a network connection.
virtual bool isError() const =0
virtual bool isString() const
Checks if value is a string.
virtual ~Value()
Destructor.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
virtual bool isBlob() const
Checks if value is a binary object.
An interface for writing to a network connection.
virtual bool isBool() const
Checks if value is a boolean.
virtual bool isFloat64() const
Checks if value is a 64-bit floating point number.
virtual bool asBool() const
Get boolean value.
virtual bool isError() const =0
virtual std::string asString() const
Get string value.
bool operator==(const Value &alt) const
Equality test.
virtual bool isLeaf() const
virtual bool isInt16() const
Checks if value is a 16-bit integer.
A 32-bit floating point number item.
bool operator!=(const Value &alt) const
Inequality test.
bool isNull() const override
Checks if the object is invalid.
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
static Value * makeInt16(std::int16_t x)
Create a 16-bit integer Value.
A 64-bit floating point number item.
virtual std::int16_t asInt16() const
Get 16-bit integer value.
const Value & operator=(const Value &alt)
Assignment operator.
virtual std::int8_t asInt8() const
Get 8-bit integer value.
virtual bool isList() const
Checks if value is a list.
static Value * makeInt64(std::int64_t x)
Create a 64-bit integer Value.
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
An interface for reading from a network connection.
static Value * makeValue(const std::string &txt)
Create a Value from a text description.
virtual Bottle & findGroup(const std::string &key) const=0
Gets a list corresponding to a given keyword.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
An interface to the operating system, including Port based communication.
virtual std::int32_t getCode() const
Get standard type code of value.
void fromString(const char *str)
Set value to correspond to a textual representation.
Value()
Construct a list Value.
virtual Bottle * asList() const
Get list value.
std::string toString() const override
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).
static Value * makeBlob(void *data, int length)
Create a Value containing binary data.
virtual size_t asBlobLength() const
Get binary data length.
The components from which ports and connections are built.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual std::int64_t asInt64() const
Get 64-bit integer value.
virtual bool readRaw(ConnectionReader &connection)=0
virtual bool isInt64() const
Checks if value is a 64-bit integer.
virtual bool isVocab() const
Checks if value is a vocabulary identifier.
A class for storing options and configuration information.
virtual Value * create() const
Create a new value of the same type.
virtual bool isInt8() const
Checks if value is a 8-bit integer.
virtual bool isInt32() const
Checks if value is a 32-bit integer.