74 static constexpr const char*
s_tag{
"setPrompt"};
78 static constexpr const char*
s_prototype{
"bool ILLMMsgs::setPrompt(const std::string& prompt)"};
79 static constexpr const char*
s_help{
""};
132 static constexpr const char*
s_tag{
"readPrompt"};
136 static constexpr const char*
s_prototype{
"return_readPrompt ILLMMsgs::readPrompt()"};
195 static constexpr const char*
s_tag{
"ask"};
199 static constexpr const char*
s_prototype{
"return_ask ILLMMsgs::ask(const std::string& question)"};
253 static constexpr const char*
s_tag{
"getConversation"};
257 static constexpr const char*
s_prototype{
"return_getConversation ILLMMsgs::getConversation()"};
311 static constexpr const char*
s_tag{
"deleteConversation"};
315 static constexpr const char*
s_prototype{
"bool ILLMMsgs::deleteConversation()"};
369 static constexpr const char*
s_tag{
"refreshConversation"};
373 static constexpr const char*
s_prototype{
"bool ILLMMsgs::refreshConversation()"};
404 return write(writer);
419 if (!writeTag(writer)) {
422 if (!writeArgs(writer)) {
446 if (!readTag(reader)) {
449 if (!readArgs(reader)) {
488 return write(writer);
519 if (!reader.
readBool(return_helper)) {
548 return write(writer);
563 if (!writeTag(writer)) {
566 if (!writeArgs(writer)) {
587 if (!readTag(reader)) {
590 if (!readArgs(reader)) {
621 return write(writer);
636 if (!writer.
write(return_helper)) {
652 if (!reader.
read(return_helper)) {
691 return write(writer);
706 if (!writeTag(writer)) {
709 if (!writeArgs(writer)) {
733 if (!readTag(reader)) {
736 if (!readArgs(reader)) {
775 return write(writer);
790 if (!writer.
write(return_helper)) {
806 if (!reader.
read(return_helper)) {
835 return write(writer);
850 if (!writeTag(writer)) {
853 if (!writeArgs(writer)) {
874 if (!readTag(reader)) {
877 if (!readArgs(reader)) {
908 return write(writer);
923 if (!writer.
write(return_helper)) {
939 if (!reader.
read(return_helper)) {
968 return write(writer);
983 if (!writeTag(writer)) {
986 if (!writeArgs(writer)) {
1007 if (!readTag(reader)) {
1010 if (!readArgs(reader)) {
1041 return write(writer);
1047 return read(reader);
1072 if (!reader.
readBool(return_helper)) {
1101 return write(writer);
1111 return read(reader);
1116 if (!writeTag(writer)) {
1119 if (!writeArgs(writer)) {
1140 if (!readTag(reader)) {
1143 if (!readArgs(reader)) {
1174 return write(writer);
1180 return read(reader);
1205 if (!reader.
readBool(return_helper)) {
1220 yarp().setOwner(*
this);
1225 if (!
yarp().canWrite()) {
1229 bool ok =
yarp().write(helper, helper);
1230 return ok ? helper.reply.return_helper :
bool{};
1235 if (!
yarp().canWrite()) {
1239 bool ok =
yarp().write(helper, helper);
1245 if (!
yarp().canWrite()) {
1249 bool ok =
yarp().write(helper, helper);
1250 return ok ? helper.reply.return_helper :
return_ask{};
1255 if (!
yarp().canWrite()) {
1259 bool ok =
yarp().write(helper, helper);
1265 if (!
yarp().canWrite()) {
1269 bool ok =
yarp().write(helper, helper);
1270 return ok ? helper.reply.return_helper :
bool{};
1275 if (!
yarp().canWrite()) {
1279 bool ok =
yarp().write(helper, helper);
1280 return ok ? helper.reply.return_helper :
bool{};
1286 bool showAll = (functionName ==
"--all");
1287 std::vector<std::string> helpString;
1289 helpString.emplace_back(
"*** Available commands:");
1296 helpString.emplace_back(
"help");
1316 if (functionName ==
"help") {
1317 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
1318 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
1319 helpString.emplace_back(
"@param functionName name of command for which to get a detailed description. If none or '--all' is provided, print list of available commands");
1320 helpString.emplace_back(
"@return list of strings (one string per line)");
1323 if (helpString.empty()) {
1324 helpString.emplace_back(
"Command not found");
1332 constexpr size_t max_tag_len = 1;
1342 std::string tag = reader.
readTag(1);
1343 bool direct = (tag ==
"__direct__");
1347 while (tag_len <= max_tag_len && !reader.
isError()) {
1438 if (tag ==
"help") {
1439 std::string functionName;
1441 functionName =
"--all";
1443 auto help_strings = help(functionName);
1449 if (!writer.
writeTag(
"many", 1, 0)) {
1455 for (
const auto& help_string : help_strings) {
1471 std::string next_tag = reader.
readTag(1);
1472 if (next_tag.empty()) {
1475 tag.append(
"_").append(next_tag);
1476 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readTag(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Command() override=default
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_cmd_len
ILLMMsgs_ask_helper()=default
static constexpr const char * s_help
static constexpr size_t s_reply_len
return_ask(*)(const std::string &) funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_tag
static constexpr size_t s_tag_len
static constexpr const char * s_prototype
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
~Command() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Reply() override=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_tag_len
static constexpr size_t s_cmd_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_help
ILLMMsgs_deleteConversation_helper()=default
static constexpr size_t s_reply_len
static constexpr const char * s_tag
static constexpr const char * s_prototype
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
return_getConversation return_helper
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
static constexpr size_t s_tag_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
ILLMMsgs_getConversation_helper()=default
static constexpr const char * s_help
static constexpr const char * s_prototype
return_getConversation(*)() funcptr_t
static constexpr size_t s_cmd_len
static constexpr size_t s_reply_len
static constexpr const char * s_tag
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
~Command() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_readPrompt return_helper
~Reply() override=default
static constexpr size_t s_tag_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_reply_len
return_readPrompt(*)() funcptr_t
static constexpr const char * s_prototype
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_cmd_len
static constexpr const char * s_tag
static constexpr const char * s_help
ILLMMsgs_readPrompt_helper()=default
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_cmd_len
ILLMMsgs_refreshConversation_helper()=default
static constexpr size_t s_reply_len
static constexpr size_t s_tag_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_tag
static constexpr const char * s_prototype
static constexpr const char * s_help
~Command() override=default
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool readArgs(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_prototype
static constexpr size_t s_tag_len
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
ILLMMsgs_setPrompt_helper()=default
bool(*)(const std::string &) funcptr_t
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_help
static constexpr const char * s_tag
virtual std::vector< std::string > help(const std::string &functionName="--all")
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual bool setPrompt(const std::string &prompt)
virtual return_ask ask(const std::string &question)
virtual bool refreshConversation()
virtual return_readPrompt readPrompt()
virtual bool deleteConversation()
virtual return_getConversation getConversation()
An interface for reading from a network connection.
An interface for writing 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 "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
IDL-friendly connection reader.
bool readString(std::string &str, bool *is_vocab=nullptr)
std::string readTag(size_t len=static_cast< size_t >(-1))
bool read(WirePortable &obj)
IDL-friendly connection writer.
bool writeBool(bool x, bool skip_tag=false) const
bool write(const WirePortable &obj) const
bool writeListHeader(int len) const
bool writeTag(const char *tag, int split, int len) const
bool writeString(const std::string &str, bool skip_tag=false) const
bool writeListEnd() const
bool writeListBegin(int tag, size_t len) const
The main, catch-all namespace for YARP.