44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method TestReturnValue::getRemoteProtocolVersion");
74 return helper.helper_proto;}
85 if (remproto.protocol_version != locproto.protocol_version)
87 yCError(SERVICE_LOG_COMPONENT) <<
"Invalid communication protocol.";
88 yCError(SERVICE_LOG_COMPONENT) <<
"Local Protocol Version: " << locproto.toString();
89 yCError(SERVICE_LOG_COMPONENT) <<
"Remote Protocol Version: " << remproto.toString();
164 static constexpr const char*
s_tag{
"setValueRPC"};
168 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue TestReturnValue::setValueRPC(const std::int32_t value)"};
222 static constexpr const char*
s_tag{
"getValueRPC"};
226 static constexpr const char*
s_prototype{
"return_getValue TestReturnValue::getValueRPC()"};
280 static constexpr const char*
s_tag{
"getTwoValuesRPC"};
284 static constexpr const char*
s_prototype{
"return_getTwoValues TestReturnValue::getTwoValuesRPC()"};
338 static constexpr const char*
s_tag{
"getBoolRPC"};
342 static constexpr const char*
s_prototype{
"bool TestReturnValue::getBoolRPC()"};
373 return write(writer);
388 if (!writeTag(writer)) {
391 if (!writeArgs(writer)) {
415 if (!readTag(reader)) {
418 if (!readArgs(reader)) {
457 return write(writer);
469 if (!writer.
write(return_helper)) {
482 if (!reader.
read(return_helper)) {
511 return write(writer);
526 if (!writeTag(writer)) {
529 if (!writeArgs(writer)) {
550 if (!readTag(reader)) {
553 if (!readArgs(reader)) {
584 return write(writer);
599 if (!writer.
write(return_helper)) {
615 if (!reader.
read(return_helper)) {
644 return write(writer);
659 if (!writeTag(writer)) {
662 if (!writeArgs(writer)) {
683 if (!readTag(reader)) {
686 if (!readArgs(reader)) {
717 return write(writer);
732 if (!writer.
write(return_helper)) {
748 if (!reader.
read(return_helper)) {
777 return write(writer);
792 if (!writeTag(writer)) {
795 if (!writeArgs(writer)) {
816 if (!readTag(reader)) {
819 if (!readArgs(reader)) {
850 return write(writer);
881 if (!reader.
readBool(return_helper)) {
896 yarp().setOwner(*
this);
901 if (!
yarp().canWrite()) {
905 bool ok =
yarp().write(helper, helper);
911 if (!
yarp().canWrite()) {
915 bool ok =
yarp().write(helper, helper);
921 return helper.reply.return_helper;
926 if (!
yarp().canWrite()) {
930 bool ok =
yarp().write(helper, helper);
937 return helper.reply.return_helper;
942 if (!
yarp().canWrite()) {
946 bool ok =
yarp().write(helper, helper);
947 return ok ? helper.reply.return_helper :
bool{};
953 bool showAll = (functionName ==
"--all");
954 std::vector<std::string> helpString;
956 helpString.emplace_back(
"*** Available commands:");
961 helpString.emplace_back(
"help");
975 if (functionName ==
"help") {
976 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
977 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
978 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");
979 helpString.emplace_back(
"@return list of strings (one string per line)");
982 if (helpString.empty()) {
983 helpString.emplace_back(
"Command not found");
991 constexpr size_t max_tag_len = 1;
1001 std::string tag = reader.
readTag(1);
1002 bool direct = (tag ==
"__direct__");
1006 while (tag_len <= max_tag_len && !reader.
isError()) {
1007 if(tag ==
"getRemoteProtocolVersion") {
1014 auto proto = getLocalProtocolVersion();
1020 if (!writer.
write(proto)) {
1087 if (tag ==
"help") {
1088 std::string functionName;
1090 functionName =
"--all";
1092 auto help_strings = help(functionName);
1098 if (!writer.
writeTag(
"many", 1, 0)) {
1104 for (
const auto& help_string : help_strings) {
1120 std::string next_tag = reader.
readTag(1);
1121 if (next_tag.empty()) {
1124 tag.append(
"_").append(next_tag);
1125 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 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.
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 const char * s_help
TestReturnValue_getBoolRPC_helper()=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_tag_len
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 size_t s_reply_len
static constexpr const char * s_prototype
void call(TestReturnValue *ptr)
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.
TestReturnValue_getRemoteProtocolVersion_helper()=default
yarp::os::ApplicationNetworkProtocolVersion helper_proto
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.
~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 readArgs(yarp::os::idl::WireReader &reader)
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
return_getTwoValues return_helper
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.
void call(TestReturnValue *ptr)
return_getTwoValues(*)() funcptr_t
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
static constexpr const char * s_help
static constexpr size_t s_tag_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
TestReturnValue_getTwoValuesRPC_helper()=default
static constexpr const char * s_prototype
static constexpr const char * s_tag
~Command() override=default
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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.
bool readTag(yarp::os::idl::WireReader &reader)
return_getValue return_helper
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
return_getValue(*)() funcptr_t
static constexpr const char * s_prototype
static constexpr size_t s_reply_len
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
TestReturnValue_getValueRPC_helper()=default
void call(TestReturnValue *ptr)
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
static constexpr const char * s_help
bool readArgs(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Command() override=default
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)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
yarp::dev::ReturnValue return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to 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_tag_len
static constexpr const char * s_prototype
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::ReturnValue(*)(const std::int32_t) funcptr_t
void call(TestReturnValue *ptr)
static constexpr size_t s_cmd_len
TestReturnValue_setValueRPC_helper()=default
static constexpr size_t s_reply_len
static constexpr const char * s_help
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
virtual return_getTwoValues getTwoValuesRPC()
virtual bool checkProtocolVersion()
virtual return_getValue getValueRPC()
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual yarp::dev::ReturnValue setValueRPC(const std::int32_t value)
virtual bool getBoolRPC()
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::ReturnValue ret
yarp::dev::ReturnValue ret
@ return_value_error_nws_nwc_communication_error
Method is not (yet) implemented.
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)
bool readI32(std::int32_t &x)
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 writeI32(std::int32_t x, bool skip_tag=false) 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