|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
26 examples.addString(txt);
27 explains.addString((explain!=
nullptr)?explain:
"");
28 details.add(Value::makeList(txt));
29 std::string more = std::string(
" ") + ((explain !=
nullptr) ? explain :
"");
30 details.addString(more.c_str());
35 addUsage(bot.
toString().c_str(),explain);
42 if (examples.size()>=1) {
43 reply.
add(Value::makeVocab(
"many"));
51 reply.
addString(
"no documentation available");
56 reply.
addString(
"command not recognized");
64 if (!cmd.
read(connection)) {
return false; }
66 respond(cmd,response);
67 if (response.
size()>=1) {
69 if (writer!=
nullptr) {
71 for (
size_t i=1; i<response.
size(); i++) {
82 response.
write(*writer);
89 if (writer!=
nullptr) {
92 response.
write(*writer);
103 addUsage(
"[help]",
"list usage");
104 addUsage(
"[help] [more]",
"list usage with some comments");
A simple collection of objects that can be described and transmitted in a portable way.
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
void clear()
Empties the bottle of any objects it contains.
size_type size() const
Gets the number of elements in the bottle.
virtual bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
Respond to a message.
void addUsage(const char *txt, const char *explain=nullptr)
Add information about a message that the respond() method understands.
An interface for the device drivers.
void makeUsage()
Regenerate usage information.
Value & get(size_type index) const
Reads a Value v from a certain part 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.
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
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 bool isList() const
Checks if value is a list.
bool read(yarp::os::ConnectionReader &connection) override
Handler for reading messages from the network, and passing them on to the respond() method.
An interface for reading from a network connection.
virtual bool isTextMode() const =0
Check if the connection is text mode.
An interface to the operating system, including Port based communication.
DeviceResponder()
Constructor.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
virtual Bottle * asList() const
Get list value.
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).
The components from which ports and connections are built.
void append(const Bottle &alt)
Append the content of the given bottle to the current list.