72 static constexpr const char*
s_tag{
"interactRPC"};
76 static constexpr const char*
s_prototype{
"return_interact IChatBotMsgs::interactRPC(const std::string& messageIn)"};
77 static constexpr const char*
s_help{
""};
135 static constexpr const char*
s_tag{
"setLanguageRPC"};
139 static constexpr const char*
s_prototype{
"bool IChatBotMsgs::setLanguageRPC(const std::string& language)"};
193 static constexpr const char*
s_tag{
"getLanguageRPC"};
197 static constexpr const char*
s_prototype{
"return_getLanguage IChatBotMsgs::getLanguageRPC()"};
251 static constexpr const char*
s_tag{
"getStatusRPC"};
255 static constexpr const char*
s_prototype{
"return_getStatus IChatBotMsgs::getStatusRPC()"};
309 static constexpr const char*
s_tag{
"resetBotRPC"};
313 static constexpr const char*
s_prototype{
"bool IChatBotMsgs::resetBotRPC()"};
344 return write(writer);
359 if (!writeTag(writer)) {
362 if (!writeArgs(writer)) {
386 if (!readTag(reader)) {
389 if (!readArgs(reader)) {
428 return write(writer);
443 if (!writer.
write(return_helper)) {
459 if (!reader.
read(return_helper)) {
498 return write(writer);
513 if (!writeTag(writer)) {
516 if (!writeArgs(writer)) {
540 if (!readTag(reader)) {
543 if (!readArgs(reader)) {
582 return write(writer);
613 if (!reader.
readBool(return_helper)) {
642 return write(writer);
657 if (!writeTag(writer)) {
660 if (!writeArgs(writer)) {
681 if (!readTag(reader)) {
684 if (!readArgs(reader)) {
715 return write(writer);
730 if (!writer.
write(return_helper)) {
746 if (!reader.
read(return_helper)) {
775 return write(writer);
790 if (!writeTag(writer)) {
793 if (!writeArgs(writer)) {
814 if (!readTag(reader)) {
817 if (!readArgs(reader)) {
848 return write(writer);
863 if (!writer.
write(return_helper)) {
879 if (!reader.
read(return_helper)) {
908 return write(writer);
923 if (!writeTag(writer)) {
926 if (!writeArgs(writer)) {
947 if (!readTag(reader)) {
950 if (!readArgs(reader)) {
981 return write(writer);
1012 if (!reader.
readBool(return_helper)) {
1027 yarp().setOwner(*
this);
1032 if (!
yarp().canWrite()) {
1036 bool ok =
yarp().write(helper, helper);
1042 if (!
yarp().canWrite()) {
1046 bool ok =
yarp().write(helper, helper);
1047 return ok ? helper.reply.return_helper :
bool{};
1052 if (!
yarp().canWrite()) {
1056 bool ok =
yarp().write(helper, helper);
1062 if (!
yarp().canWrite()) {
1066 bool ok =
yarp().write(helper, helper);
1072 if (!
yarp().canWrite()) {
1076 bool ok =
yarp().write(helper, helper);
1077 return ok ? helper.reply.return_helper :
bool{};
1083 bool showAll = (functionName ==
"--all");
1084 std::vector<std::string> helpString;
1086 helpString.emplace_back(
"*** Available commands:");
1092 helpString.emplace_back(
"help");
1109 if (functionName ==
"help") {
1110 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
1111 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
1112 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");
1113 helpString.emplace_back(
"@return list of strings (one string per line)");
1116 if (helpString.empty()) {
1117 helpString.emplace_back(
"Command not found");
1125 constexpr size_t max_tag_len = 1;
1135 std::string tag = reader.
readTag(1);
1136 bool direct = (tag ==
"__direct__");
1140 while (tag_len <= max_tag_len && !reader.
isError()) {
1216 if (tag ==
"help") {
1217 std::string functionName;
1219 functionName =
"--all";
1221 auto help_strings = help(functionName);
1227 if (!writer.
writeTag(
"many", 1, 0)) {
1233 for (
const auto& help_string : help_strings) {
1249 std::string next_tag = reader.
readTag(1);
1250 if (next_tag.empty()) {
1253 tag.append(
"_").append(next_tag);
1254 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
~Command() override=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
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 read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
return_getLanguage return_helper
~Reply() override=default
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
void call(IChatBotMsgs *ptr)
static constexpr const char * s_prototype
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
IChatBotMsgs_getLanguageRPC_helper()=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_getLanguage(*)() funcptr_t
static constexpr size_t s_tag_len
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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 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.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getStatus return_helper
~Reply() override=default
static constexpr const char * s_help
return_getStatus(*)() funcptr_t
static constexpr const char * s_tag
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
IChatBotMsgs_getStatusRPC_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(IChatBotMsgs *ptr)
static constexpr const char * s_prototype
static constexpr size_t s_tag_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
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.
~Command() override=default
bool readArgs(yarp::os::idl::WireReader &reader)
bool readTag(yarp::os::idl::WireReader &reader)
return_interact return_helper
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.
static constexpr size_t s_reply_len
IChatBotMsgs_interactRPC_helper()=default
static constexpr const char * s_prototype
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_help
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_cmd_len
static constexpr size_t s_tag_len
return_interact(*)(const std::string &) funcptr_t
void call(IChatBotMsgs *ptr)
bool readTag(yarp::os::idl::WireReader &reader)
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.
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
~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.
IChatBotMsgs_resetBotRPC_helper()=default
static constexpr const char * s_tag
static constexpr const char * s_help
static constexpr const char * s_prototype
void call(IChatBotMsgs *ptr)
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.
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
bool readArgs(yarp::os::idl::WireReader &reader)
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.
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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 read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_prototype
static constexpr size_t s_reply_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool(*)(const std::string &) funcptr_t
static constexpr const char * s_tag
static constexpr size_t s_cmd_len
IChatBotMsgs_setLanguageRPC_helper()=default
void call(IChatBotMsgs *ptr)
static constexpr const char * s_help
static constexpr size_t s_tag_len
virtual bool resetBotRPC()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual bool setLanguageRPC(const std::string &language)
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual return_getStatus getStatusRPC()
virtual return_interact interactRPC(const std::string &messageIn)
virtual return_getLanguage getLanguageRPC()
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.