44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method yarpdataplayer_IDL::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();
159 static constexpr const char*
s_tag{
"step"};
163 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::step()"};
165 "Steps the player once. The player will be stepped\n"
166 "until all parts have sent data\n"
167 "@return true/false on success/failure"
226 static constexpr const char*
s_tag{
"setFrame"};
230 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::setFrame(const std::int32_t frameNum)"};
232 "Sets the frame number to the user desired frame.\n"
233 "@param frameNum specifies the frame number the user\n"
234 " would like to skip to\n"
235 "@return true/false on success/failure"
294 static constexpr const char*
s_tag{
"getFrame"};
298 static constexpr const char*
s_prototype{
"std::int32_t yarpdataplayer_IDL::getFrame(const std::string& name)"};
300 "Gets the frame number the user is requesting\n"
301 "@param name specifies the name of the data to modify\n"
302 " would like to skip to\n"
303 "@return i32 returns the current frame index"
362 static constexpr const char*
s_tag{
"load"};
366 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::load(const std::string& path)"};
368 "Loads a dataset from a path\n"
369 "@return true/false on success/failure"
423 static constexpr const char*
s_tag{
"getSliderPercentage"};
427 static constexpr const char*
s_prototype{
"std::int32_t yarpdataplayer_IDL::getSliderPercentage()"};
429 "Get slider percentage\n"
430 "@return i32 percentage"
484 static constexpr const char*
s_tag{
"getStatus"};
488 static constexpr const char*
s_prototype{
"std::string yarpdataplayer_IDL::getStatus()"};
490 "Get the status of playing\n"
491 "@return the status (playing, paused, stopped)"
545 static constexpr const char*
s_tag{
"play"};
549 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::play()"};
551 "Plays the dataSets\n"
552 "@return true/false on success/failure"
606 static constexpr const char*
s_tag{
"pause"};
610 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::pause()"};
612 "Pauses the dataSets\n"
613 "@return true/false on success/failure"
667 static constexpr const char*
s_tag{
"stop"};
671 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::stop()"};
673 "Stops the dataSets\n"
674 "@return true/false on success/failure"
728 static constexpr const char*
s_tag{
"quit"};
732 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::quit()"};
735 "@return true/false on success/failure"
756 return write(writer);
771 if (!writeTag(writer)) {
774 if (!writeArgs(writer)) {
795 if (!readTag(reader)) {
798 if (!readArgs(reader)) {
829 return write(writer);
860 if (!reader.
readBool(return_helper)) {
899 return write(writer);
914 if (!writeTag(writer)) {
917 if (!writeArgs(writer)) {
941 if (!readTag(reader)) {
944 if (!readArgs(reader)) {
969 if (!reader.
readI32(frameNum)) {
983 return write(writer);
1014 if (!reader.
readBool(return_helper)) {
1053 return write(writer);
1063 return read(reader);
1068 if (!writeTag(writer)) {
1071 if (!writeArgs(writer)) {
1095 if (!readTag(reader)) {
1098 if (!readArgs(reader)) {
1137 return write(writer);
1143 return read(reader);
1152 if (!writer.
writeI32(return_helper)) {
1168 if (!reader.
readI32(return_helper)) {
1207 return write(writer);
1217 return read(reader);
1222 if (!writeTag(writer)) {
1225 if (!writeArgs(writer)) {
1249 if (!readTag(reader)) {
1252 if (!readArgs(reader)) {
1291 return write(writer);
1297 return read(reader);
1322 if (!reader.
readBool(return_helper)) {
1351 return write(writer);
1361 return read(reader);
1366 if (!writeTag(writer)) {
1369 if (!writeArgs(writer)) {
1390 if (!readTag(reader)) {
1393 if (!readArgs(reader)) {
1424 return write(writer);
1430 return read(reader);
1439 if (!writer.
writeI32(return_helper)) {
1455 if (!reader.
readI32(return_helper)) {
1484 return write(writer);
1494 return read(reader);
1499 if (!writeTag(writer)) {
1502 if (!writeArgs(writer)) {
1523 if (!readTag(reader)) {
1526 if (!readArgs(reader)) {
1557 return write(writer);
1563 return read(reader);
1617 return write(writer);
1627 return read(reader);
1632 if (!writeTag(writer)) {
1635 if (!writeArgs(writer)) {
1656 if (!readTag(reader)) {
1659 if (!readArgs(reader)) {
1690 return write(writer);
1696 return read(reader);
1721 if (!reader.
readBool(return_helper)) {
1750 return write(writer);
1760 return read(reader);
1765 if (!writeTag(writer)) {
1768 if (!writeArgs(writer)) {
1789 if (!readTag(reader)) {
1792 if (!readArgs(reader)) {
1823 return write(writer);
1829 return read(reader);
1854 if (!reader.
readBool(return_helper)) {
1883 return write(writer);
1893 return read(reader);
1898 if (!writeTag(writer)) {
1901 if (!writeArgs(writer)) {
1922 if (!readTag(reader)) {
1925 if (!readArgs(reader)) {
1956 return write(writer);
1962 return read(reader);
1987 if (!reader.
readBool(return_helper)) {
2016 return write(writer);
2026 return read(reader);
2031 if (!writeTag(writer)) {
2034 if (!writeArgs(writer)) {
2055 if (!readTag(reader)) {
2058 if (!readArgs(reader)) {
2089 return write(writer);
2095 return read(reader);
2120 if (!reader.
readBool(return_helper)) {
2135 yarp().setOwner(*
this);
2140 if (!
yarp().canWrite()) {
2144 bool ok =
yarp().write(helper, helper);
2145 return ok ? helper.reply.return_helper :
bool{};
2150 if (!
yarp().canWrite()) {
2154 bool ok =
yarp().write(helper, helper);
2155 return ok ? helper.reply.return_helper :
bool{};
2160 if (!
yarp().canWrite()) {
2164 bool ok =
yarp().write(helper, helper);
2165 return ok ? helper.reply.return_helper : std::int32_t{};
2170 if (!
yarp().canWrite()) {
2174 bool ok =
yarp().write(helper, helper);
2175 return ok ? helper.reply.return_helper :
bool{};
2180 if (!
yarp().canWrite()) {
2184 bool ok =
yarp().write(helper, helper);
2185 return ok ? helper.reply.return_helper : std::int32_t{};
2190 if (!
yarp().canWrite()) {
2194 bool ok =
yarp().write(helper, helper);
2195 return ok ? helper.reply.return_helper : std::string{};
2200 if (!
yarp().canWrite()) {
2204 bool ok =
yarp().write(helper, helper);
2205 return ok ? helper.reply.return_helper :
bool{};
2210 if (!
yarp().canWrite()) {
2214 bool ok =
yarp().write(helper, helper);
2215 return ok ? helper.reply.return_helper :
bool{};
2220 if (!
yarp().canWrite()) {
2224 bool ok =
yarp().write(helper, helper);
2225 return ok ? helper.reply.return_helper :
bool{};
2230 if (!
yarp().canWrite()) {
2234 bool ok =
yarp().write(helper, helper);
2235 return ok ? helper.reply.return_helper :
bool{};
2241 bool showAll = (functionName ==
"--all");
2242 std::vector<std::string> helpString;
2244 helpString.emplace_back(
"*** Available commands:");
2255 helpString.emplace_back(
"help");
2297 if (functionName ==
"help") {
2298 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
2299 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
2300 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");
2301 helpString.emplace_back(
"@return list of strings (one string per line)");
2304 if (helpString.empty()) {
2305 helpString.emplace_back(
"Command not found");
2313 constexpr size_t max_tag_len = 1;
2323 std::string tag = reader.
readTag(1);
2324 bool direct = (tag ==
"__direct__");
2328 while (tag_len <= max_tag_len && !reader.
isError()) {
2329 if(tag ==
"getRemoteProtocolVersion") {
2336 auto proto = getLocalProtocolVersion();
2342 if (!writer.
write(proto)) {
2499 if (tag ==
"help") {
2500 std::string functionName;
2502 functionName =
"--all";
2504 auto help_strings = help(functionName);
2510 if (!writer.
writeTag(
"many", 1, 0)) {
2516 for (
const auto& help_string : help_strings) {
2532 std::string next_tag = reader.
readTag(1);
2533 if (next_tag.empty()) {
2536 tag.append(
"_").append(next_tag);
2537 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
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))
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
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
bool readArgs(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Command() override=default
std::int32_t 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 const char * s_help
static constexpr size_t s_cmd_len
std::int32_t(*)(const std::string &) funcptr_t
void call(yarpdataplayer_IDL *ptr)
static constexpr const char * s_tag
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarpdataplayer_IDL_getFrame_helper()=default
static constexpr size_t s_reply_len
static constexpr const char * s_prototype
yarp::os::ApplicationNetworkProtocolVersion helper_proto
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarpdataplayer_IDL_getRemoteProtocolVersion_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~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.
bool readArgs(yarp::os::idl::WireReader &reader)
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
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
std::int32_t return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
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 const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(yarpdataplayer_IDL *ptr)
std::int32_t(*)() funcptr_t
static constexpr size_t s_reply_len
yarpdataplayer_IDL_getSliderPercentage_helper()=default
static constexpr const char * s_prototype
static constexpr size_t s_tag_len
~Command() override=default
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 writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
std::string return_helper
~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 size_t s_tag_len
static constexpr const char * s_prototype
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_reply_len
yarpdataplayer_IDL_getStatus_helper()=default
static constexpr size_t s_cmd_len
static constexpr const char * s_help
std::string(*)() funcptr_t
void call(yarpdataplayer_IDL *ptr)
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 readTag(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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.
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 const char * s_help
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_reply_len
yarpdataplayer_IDL_load_helper()=default
bool(*)(const std::string &) funcptr_t
static constexpr const char * s_prototype
void call(yarpdataplayer_IDL *ptr)
static constexpr size_t s_tag_len
static constexpr size_t s_cmd_len
static constexpr const char * s_tag
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.
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 readArgs(yarp::os::idl::WireReader &reader)
~Command() override=default
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
~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_tag
static constexpr const char * s_help
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_reply_len
static constexpr const char * s_prototype
yarpdataplayer_IDL_pause_helper()=default
void call(yarpdataplayer_IDL *ptr)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_cmd_len
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 read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Command() override=default
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readArgs(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.
~Reply() override=default
static constexpr const char * s_prototype
void call(yarpdataplayer_IDL *ptr)
static constexpr size_t s_cmd_len
static constexpr size_t s_tag_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_help
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_tag
yarpdataplayer_IDL_play_helper()=default
static constexpr size_t s_reply_len
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readTag(yarp::os::idl::WireReader &reader)
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 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.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Reply() override=default
yarpdataplayer_IDL_quit_helper()=default
static constexpr size_t s_reply_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_help
static constexpr size_t s_cmd_len
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 const char * s_tag
void call(yarpdataplayer_IDL *ptr)
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 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.
bool readTag(yarp::os::idl::WireReader &reader)
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.
bool(*)(const std::int32_t) funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_help
static constexpr const char * s_prototype
static constexpr size_t s_cmd_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_reply_len
void call(yarpdataplayer_IDL *ptr)
static constexpr const char * s_tag
static constexpr size_t s_tag_len
yarpdataplayer_IDL_setFrame_helper()=default
~Command() override=default
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 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 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_cmd_len
static constexpr const char * s_tag
void call(yarpdataplayer_IDL *ptr)
static constexpr const char * s_help
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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
yarpdataplayer_IDL_step_helper()=default
static constexpr size_t s_reply_len
bool writeArgs(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 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 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 const char * s_tag
static constexpr const char * s_prototype
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(yarpdataplayer_IDL *ptr)
yarpdataplayer_IDL_stop_helper()=default
static constexpr size_t s_tag_len
static constexpr size_t s_reply_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_help
yarpdataplayer_IDL Interface.
virtual bool play()
Plays the dataSets.
virtual bool quit()
Quit the module.
virtual bool setFrame(const std::int32_t frameNum)
Sets the frame number to the user desired frame.
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual bool step()
Steps the player once.
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual bool load(const std::string &path)
Loads a dataset from a path.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual std::int32_t getFrame(const std::string &name)
Gets the frame number the user is requesting.
virtual bool checkProtocolVersion()
virtual bool pause()
Pauses the dataSets.
virtual bool stop()
Stops the dataSets.
virtual std::string getStatus()
Get the status of playing.
virtual std::int32_t getSliderPercentage()
Get slider percentage.
#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