|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
31 const Bottle::size_type Bottle::npos =
static_cast<Bottle::size_type
>(-1);
97 for (
const auto& val : values) {
115 rhs.implementation->parent = &rhs;
227 if (
size !=
nullptr) {
294 if (getMonitor() !=
nullptr) {
297 report.isFound = !val.
isNull();
299 reportToMonitor(report);
309 if (getMonitor() !=
nullptr) {
312 report.isGroup =
true;
314 report.isFound =
true;
317 reportToMonitor(report);
319 std::string context = getMonitorContext();
322 bb.
asList()->setMonitor(getMonitor(),
380 return !((*this) == alt);
386 for (
size_t i = 0; i < alt.
size(); i++) {
409 std::string unitName =
"mixed";
430 unitName =
"unknown";
433 std::string result = unitName;
435 result =
"list of " + unitName;
437 result =
"dict of " + unitName;
A dummy connection to test yarp::os::Portable implementations.
bool isNull() const override
Checks if the object is invalid.
A simple collection of objects that can be described and transmitted in a portable way.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
This is a base class for objects that can be both read from and be written to the YARP network.
void clear()
Empties the bottle of any objects it contains.
void fromBinary(const char *buf, size_t len)
Initializes bottle from a binary representation.
virtual bool read(ConnectionReader &reader)=0
Read this object from a network connection.
A base class for nested structures that can be searched.
size_type size() const
Gets the number of elements in the bottle.
Value pop()
Removes a Value v from the end of the list and returns this value.
Bottle & operator=(const Bottle &rhs)
Copy assignment operator.
A flexible data format for holding a bunch of numbers and strings.
#define BOTTLE_TAG_STRING
void fromString(const std::string &text)
Initializes bottle from a string.
static std::string describeBottleCode(int code)
Convert a numeric bottle code to a string.
bool operator!=(const Bottle &alt) const
Inequality test.
A single item in a Bottle.
ConnectionReader & getReader(ConnectionWriter *replyWriter=nullptr)
Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was las...
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void addInt8(std::int8_t x)
Places a 8-bit integer in the bottle, at the end of the list.
void addInt64(std::int64_t x)
Places a 64-bit integer in the bottle, at the end of the list.
Property & addDict()
Places an empty key/value object in the bottle, at the end of the list.
void setReadOnly(bool readOnly)
void addFloat32(yarp::conf::float32_t x)
Places a 32-bit floating point number in the bottle, at the end of the list.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void addInt16(std::int16_t x)
Places a 16-bit integer in the bottle, at the end of the list.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
An interface for writing to a network connection.
ConnectionWriter & getWriter()
Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was las...
bool isNull() const override
Checks if the object is invalid.
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
void hasChanged()
Declare that the content of the Bottle has been changed.
virtual bool write(ConnectionWriter &writer) const =0
Write this object to a network connection.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
void addVocab(int x)
Places a vocabulary item in the bottle, at the end of the list.
virtual Bottle & findGroup(const std::string &key) const=0
Gets a list corresponding to a given keyword.
static Bottle & getNullBottle()
A special Bottle with no content.
virtual bool isList() const
Checks if value is a list.
#define yCAssert(component, x)
bool isNull() const override
Checks if the object is invalid.
An interface for reading from a network connection.
Bottle tail() const
Get all but the first element of a bottle.
bool operator==(const Bottle &alt) const
Equality test.
static std::string toString(int x)
#define BOTTLE_TAG_FLOAT64
void setTextMode(bool textmode)
Set the textMode of the dummy connection.
void copy(const Bottle &alt, size_type first=0, size_type len=npos)
Copy all or part of another Bottle.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
virtual Bottle * asList() const
Get list value.
RandScalar * implementation(void *t)
void onCommencement() const override
This is called when the port is about to begin writing operations.
virtual ~Bottle()
Destructor.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
std::string toString() const override
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).
#define YARP_OS_LOG_COMPONENT(name, name_string)
int getSpecialization()
Get numeric bottle code for this bottle.
virtual bool check(const std::string &key) const=0
Check if there exists a property of the given name.
A class for storing options and configuration information.
void append(const Bottle &alt)
Append the content of the given bottle to the current list.
const char * toBinary(size_t *size=nullptr)
Returns binary representation of bottle.