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;
#define BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_STRING
RandScalar * implementation(void *t)
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.
static Bottle & getNullBottle()
A special Bottle with no content.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
static std::string describeBottleCode(int code)
Convert a numeric bottle code to a string.
Value pop()
Removes a Value v from the end of the list and returns this value.
Bottle & operator=(const Bottle &rhs)
Copy assignment operator.
void fromString(const std::string &text)
Initializes bottle from a string.
virtual ~Bottle()
Destructor.
void append(const Bottle &alt)
Append the content of the given bottle to the current list.
int getSpecialization()
Get numeric bottle code for this bottle.
Property & addDict()
Places an empty key/value object 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.
virtual Bottle & findGroup(const std::string &key) const=0
Gets a list 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.
size_type size() const
Gets the number of elements in the bottle.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
void addFloat32(yarp::conf::float32_t x)
Places a 32-bit floating point number 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.
void setReadOnly(bool readOnly)
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void copy(const Bottle &alt, size_type first=0, size_type len=npos)
Copy all or part of another Bottle.
Bottle tail() const
Get all but the first element of a bottle.
bool operator==(const Bottle &alt) const
Equality test.
void onCommencement() const override
This is called when the port is about to begin writing operations.
virtual bool check(const std::string &key) const=0
Check if there exists a property of the given name.
void clear()
Empties the bottle of any objects it contains.
void addInt16(std::int16_t x)
Places a 16-bit integer 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.
void addInt64(std::int64_t x)
Places a 64-bit integer in the bottle, at the end of the list.
bool operator!=(const Bottle &alt) const
Inequality test.
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
bool isNull() const override
Checks if the object is invalid.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
void hasChanged()
Declare that the content of the Bottle has been changed.
const char * toBinary(size_t *size=nullptr)
Returns binary representation of bottle.
void fromBinary(const char *buf, size_t len)
Initializes bottle from a binary representation.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
An interface for reading from a network connection.
An interface for writing to a network connection.
A dummy connection to test yarp::os::Portable implementations.
ConnectionWriter & getWriter()
Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was las...
void setTextMode(bool textmode)
Set the textMode of the dummy connection.
ConnectionReader & getReader()
Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was las...
static std::string toString(int x)
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
virtual bool read(ConnectionReader &reader)=0
Read this object from a network connection.
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
virtual bool write(ConnectionWriter &writer) const =0
Write this object to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
A class for storing options and configuration information.
A base class for nested structures that can be searched.
A single value (typically within a Bottle).
virtual bool isList() const
Checks if value is a list.
virtual Bottle * asList() const
Get list value.
std::string toString() const override
Return a standard text representation of the content of the object.
bool isNull() const override
Checks if the object is invalid.
A flexible data format for holding a bunch of numbers and strings.
A single item in a Bottle.
#define yCAssert(component, x)
#define YARP_OS_LOG_COMPONENT(name, name_string)