|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #ifndef YARP_OS_VALUE_H
11 #define YARP_OS_VALUE_H
25 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 #endif // DOXYGEN_SHOULD_SKIP_THIS
63 explicit Value(std::int32_t x,
bool isVocab =
false);
77 explicit Value(
const std::string& str,
bool isVocab =
false);
84 Value(
void* data,
int length);
108 virtual bool isBool()
const;
116 inline virtual
bool isInt() const final
126 virtual bool isInt8()
const;
133 virtual bool isInt16()
const;
140 virtual bool isInt32()
const;
147 virtual bool isInt64()
const;
156 inline virtual
bool isDouble() const final
166 virtual bool isFloat32()
const;
173 virtual bool isFloat64()
const;
179 virtual bool isString()
const;
185 virtual bool isList()
const;
192 virtual bool isDict()
const;
199 virtual bool isVocab()
const;
206 virtual bool isBlob()
const;
214 virtual bool asBool()
const;
224 inline virtual
int asInt() const final
226 return static_cast<int>(asInt32());
238 virtual std::int8_t asInt8()
const;
249 virtual std::int16_t asInt16()
const;
260 virtual std::int32_t asInt32()
const;
271 virtual std::int64_t asInt64()
const;
281 inline virtual
double asDouble() const final
283 return static_cast<double>(asFloat64());
312 virtual std::int32_t asVocab()
const;
319 virtual std::string asString()
const;
326 virtual Bottle* asList()
const;
347 virtual const char* asBlob()
const;
354 virtual size_t asBlobLength()
const;
363 bool check(
const std::string& key)
const override;
366 Value& find(
const std::string& key)
const override;
369 Bottle& findGroup(
const std::string& key)
const override;
376 bool operator==(
const Value& alt)
const;
383 bool operator!=(
const Value& alt)
const;
391 void fromString(
const char* str);
393 std::string
toString()
const override;
399 virtual Value* create()
const;
405 virtual Value* clone()
const;
411 virtual std::int32_t getCode()
const;
413 bool isNull()
const override;
415 virtual bool isLeaf()
const;
426 return makeInt32(
static_cast<std::int32_t
>(x));
434 static Value* makeInt8(std::int8_t x);
441 static Value* makeInt16(std::int16_t x);
448 static Value* makeInt32(std::int32_t x);
455 static Value* makeInt64(std::int64_t x);
464 inline static
Value* makeDouble(
double x)
488 static Value* makeString(
const std::string& str);
502 static Value* makeVocab(
const std::string& str);
510 static Value* makeBlob(
void* data,
int length);
516 static Value* makeList();
523 static Value* makeList(
const char* txt);
531 static Value* makeValue(
const std::string& txt);
538 static Value& getNullValue();
540 #ifndef DOXYGEN_SHOULD_SKIP_THIS
546 #endif // DOXYGEN_SHOULD_SKIP_THIS
552 #endif // YARP_OS_VALUE_H
A simple collection of objects that can be described and transmitted in a portable way.
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.
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
A single item in a Bottle.
static Value * makeVocab(std::int32_t v)
Create a vocabulary identifier Value.
An interface for writing to a network connection.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
#define YARP_DEPRECATED_INTERNAL_MSG(X)
An interface for reading from a network connection.
std::string toString(const T &value)
convert an arbitrary type to string.
The main, catch-all namespace for YARP.
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
A single value (typically within a Bottle).
A class for storing options and configuration information.