45 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
59 if (!helper_proto.read(connection)) {
69 if(!
yarp().canWrite()) {
70 yError(
" Missing server method ILLMMsgs::getRemoteProtocolVersion");
75 return helper.helper_proto;}
86 if (remproto.protocol_version != locproto.protocol_version)
88 yCError(SERVICE_LOG_COMPONENT) <<
"Invalid communication protocol.";
89 yCError(SERVICE_LOG_COMPONENT) <<
"Local Protocol Version: " << locproto.toString();
90 yCError(SERVICE_LOG_COMPONENT) <<
"Remote Protocol Version: " << remproto.toString();
165 static constexpr const char*
s_tag{
"setPrompt"};
169 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue ILLMMsgs::setPrompt(const std::string& prompt)"};
223 static constexpr const char*
s_tag{
"readPrompt"};
227 static constexpr const char*
s_prototype{
"return_readPrompt ILLMMsgs::readPrompt()"};
286 static constexpr const char*
s_tag{
"ask"};
290 static constexpr const char*
s_prototype{
"return_ask ILLMMsgs::ask(const std::string& question)"};
344 static constexpr const char*
s_tag{
"getConversation"};
348 static constexpr const char*
s_prototype{
"return_getConversation ILLMMsgs::getConversation()"};
402 static constexpr const char*
s_tag{
"deleteConversation"};
406 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue ILLMMsgs::deleteConversation()"};
460 static constexpr const char*
s_tag{
"refreshConversation"};
464 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue ILLMMsgs::refreshConversation()"};
495 return write(writer);
510 if (!writeTag(writer)) {
513 if (!writeArgs(writer)) {
537 if (!readTag(reader)) {
540 if (!readArgs(reader)) {
579 return write(writer);
591 if (!writer.
write(return_helper)) {
604 if (!reader.
read(return_helper)) {
633 return write(writer);
648 if (!writeTag(writer)) {
651 if (!writeArgs(writer)) {
672 if (!readTag(reader)) {
675 if (!readArgs(reader)) {
706 return write(writer);
721 if (!writer.
write(return_helper)) {
737 if (!reader.
read(return_helper)) {
776 return write(writer);
791 if (!writeTag(writer)) {
794 if (!writeArgs(writer)) {
818 if (!readTag(reader)) {
821 if (!readArgs(reader)) {
860 return write(writer);
875 if (!writer.
write(return_helper)) {
891 if (!reader.
read(return_helper)) {
920 return write(writer);
935 if (!writeTag(writer)) {
938 if (!writeArgs(writer)) {
959 if (!readTag(reader)) {
962 if (!readArgs(reader)) {
993 return write(writer);
1008 if (!writer.
write(return_helper)) {
1024 if (!reader.
read(return_helper)) {
1053 return write(writer);
1063 return read(reader);
1068 if (!writeTag(writer)) {
1071 if (!writeArgs(writer)) {
1092 if (!readTag(reader)) {
1095 if (!readArgs(reader)) {
1126 return write(writer);
1132 return read(reader);
1138 if (!writer.
write(return_helper)) {
1151 if (!reader.
read(return_helper)) {
1180 return write(writer);
1190 return read(reader);
1195 if (!writeTag(writer)) {
1198 if (!writeArgs(writer)) {
1219 if (!readTag(reader)) {
1222 if (!readArgs(reader)) {
1253 return write(writer);
1259 return read(reader);
1265 if (!writer.
write(return_helper)) {
1278 if (!reader.
read(return_helper)) {
1293 yarp().setOwner(*
this);
1298 if (!
yarp().canWrite()) {
1302 bool ok =
yarp().write(helper, helper);
1308 if (!
yarp().canWrite()) {
1312 bool ok =
yarp().write(helper, helper);
1318 if (!
yarp().canWrite()) {
1322 bool ok =
yarp().write(helper, helper);
1323 return ok ? helper.reply.return_helper :
return_ask{};
1328 if (!
yarp().canWrite()) {
1332 bool ok =
yarp().write(helper, helper);
1338 if (!
yarp().canWrite()) {
1342 bool ok =
yarp().write(helper, helper);
1348 if (!
yarp().canWrite()) {
1352 bool ok =
yarp().write(helper, helper);
1359 bool showAll = (functionName ==
"--all");
1360 std::vector<std::string> helpString;
1362 helpString.emplace_back(
"*** Available commands:");
1369 helpString.emplace_back(
"help");
1389 if (functionName ==
"help") {
1390 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
1391 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
1392 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");
1393 helpString.emplace_back(
"@return list of strings (one string per line)");
1396 if (helpString.empty()) {
1397 helpString.emplace_back(
"Command not found");
1405 constexpr size_t max_tag_len = 1;
1415 std::string tag = reader.
readTag(1);
1416 bool direct = (tag ==
"__direct__");
1420 while (tag_len <= max_tag_len && !reader.
isError()) {
1421 if(tag ==
"getRemoteProtocolVersion") {
1428 auto proto = getLocalProtocolVersion();
1434 if (!writer.
write(proto)) {
1531 if (tag ==
"help") {
1532 std::string functionName;
1534 functionName =
"--all";
1536 auto help_strings = help(functionName);
1542 if (!writer.
writeTag(
"many", 1, 0)) {
1548 for (
const auto& help_string : help_strings) {
1564 std::string next_tag = reader.
readTag(1);
1565 if (next_tag.empty()) {
1568 tag.append(
"_").append(next_tag);
1569 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
yarp::dev::ReturnValue 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.
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
yarp::dev::ReturnValue(*)() funcptr_t
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
ILLMMsgs_getRemoteProtocolVersion_helper()=default
yarp::os::ApplicationNetworkProtocolVersion helper_proto
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 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.
yarp::dev::ReturnValue return_helper
~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
yarp::dev::ReturnValue(*)() funcptr_t
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
yarp::dev::ReturnValue 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.
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.
yarp::dev::ReturnValue(*)(const std::string &) funcptr_t
ILLMMsgs_setPrompt_helper()=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
virtual yarp::dev::ReturnValue refreshConversation()
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual yarp::dev::ReturnValue deleteConversation()
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 checkProtocolVersion()
virtual return_ask ask(const std::string &question)
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual yarp::dev::ReturnValue setPrompt(const std::string &prompt)
virtual return_readPrompt readPrompt()
virtual return_getConversation getConversation()
short int protocol_version
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.
bool write(PortWriter &writer)
Write a message to the associated port or reader.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
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 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
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
The main, catch-all namespace for YARP.
#define YARP_VERSION_PATCH
#define YARP_VERSION_MAJOR
#define YARP_VERSION_MINOR