43 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
57 if (!helper_proto.read(connection)) {
67 if(!
yarp().canWrite()) {
68 yError(
" Missing server method yarpdataplayer_IDL::getRemoteProtocolVersion");
73 return helper.helper_proto;}
84 if (remproto.protocol_version != locproto.protocol_version)
86 yCError(SERVICE_LOG_COMPONENT) <<
"Invalid communication protocol.";
87 yCError(SERVICE_LOG_COMPONENT) <<
"Local Protocol Version: " << locproto.toString();
88 yCError(SERVICE_LOG_COMPONENT) <<
"Remote Protocol Version: " << remproto.toString();
158 static constexpr const char*
s_tag{
"step"};
162 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::step()"};
164 "Steps the player once. The player will be stepped\n"
165 "until all parts have sent data\n"
166 "@return true/false on success/failure"
225 static constexpr const char*
s_tag{
"setFrame"};
229 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::setFrame(const std::int32_t frameNum)"};
231 "Sets the frame number to the user desired frame.\n"
232 "@param frameNum specifies the frame number the user\n"
233 " would like to skip to\n"
234 "@return true/false on success/failure"
293 static constexpr const char*
s_tag{
"getFrame"};
297 static constexpr const char*
s_prototype{
"std::int32_t yarpdataplayer_IDL::getFrame(const std::string& name)"};
299 "Gets the frame number the user is requesting\n"
300 "@param name specifies the name of the data to modify\n"
301 " would like to skip to\n"
302 "@return i32 returns the current frame index"
361 static constexpr const char*
s_tag{
"load"};
365 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::load(const std::string& path)"};
367 "Loads a dataset from a path\n"
368 "@return true/false on success/failure"
422 static constexpr const char*
s_tag{
"getSliderPercentage"};
426 static constexpr const char*
s_prototype{
"std::int32_t yarpdataplayer_IDL::getSliderPercentage()"};
428 "Get slider percentage\n"
429 "@return i32 percentage"
483 static constexpr const char*
s_tag{
"getStatus"};
487 static constexpr const char*
s_prototype{
"std::string yarpdataplayer_IDL::getStatus()"};
489 "Get the status of playing\n"
490 "@return the status (playing, paused, stopped)"
544 static constexpr const char*
s_tag{
"play"};
548 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::play()"};
550 "Plays the dataSets\n"
551 "@return true/false on success/failure"
605 static constexpr const char*
s_tag{
"pause"};
609 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::pause()"};
611 "Pauses the dataSets\n"
612 "@return true/false on success/failure"
666 static constexpr const char*
s_tag{
"stop"};
670 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::stop()"};
672 "Stops the dataSets\n"
673 "@return true/false on success/failure"
727 static constexpr const char*
s_tag{
"quit"};
731 static constexpr const char*
s_prototype{
"bool yarpdataplayer_IDL::quit()"};
734 "@return true/false on success/failure"
755 return write(writer);
770 if (!writeTag(writer)) {
773 if (!writeArgs(writer)) {
794 if (!readTag(reader)) {
797 if (!readArgs(reader)) {
828 return write(writer);
859 if (!reader.
readBool(return_helper)) {
898 return write(writer);
913 if (!writeTag(writer)) {
916 if (!writeArgs(writer)) {
940 if (!readTag(reader)) {
943 if (!readArgs(reader)) {
968 if (!reader.
readI32(frameNum)) {
982 return write(writer);
1013 if (!reader.
readBool(return_helper)) {
1052 return write(writer);
1062 return read(reader);
1067 if (!writeTag(writer)) {
1070 if (!writeArgs(writer)) {
1094 if (!readTag(reader)) {
1097 if (!readArgs(reader)) {
1136 return write(writer);
1142 return read(reader);
1151 if (!writer.
writeI32(return_helper)) {
1167 if (!reader.
readI32(return_helper)) {
1206 return write(writer);
1216 return read(reader);
1221 if (!writeTag(writer)) {
1224 if (!writeArgs(writer)) {
1248 if (!readTag(reader)) {
1251 if (!readArgs(reader)) {
1290 return write(writer);
1296 return read(reader);
1321 if (!reader.
readBool(return_helper)) {
1350 return write(writer);
1360 return read(reader);
1365 if (!writeTag(writer)) {
1368 if (!writeArgs(writer)) {
1389 if (!readTag(reader)) {
1392 if (!readArgs(reader)) {
1423 return write(writer);
1429 return read(reader);
1438 if (!writer.
writeI32(return_helper)) {
1454 if (!reader.
readI32(return_helper)) {
1483 return write(writer);
1493 return read(reader);
1498 if (!writeTag(writer)) {
1501 if (!writeArgs(writer)) {
1522 if (!readTag(reader)) {
1525 if (!readArgs(reader)) {
1556 return write(writer);
1562 return read(reader);
1616 return write(writer);
1626 return read(reader);
1631 if (!writeTag(writer)) {
1634 if (!writeArgs(writer)) {
1655 if (!readTag(reader)) {
1658 if (!readArgs(reader)) {
1689 return write(writer);
1695 return read(reader);
1720 if (!reader.
readBool(return_helper)) {
1749 return write(writer);
1759 return read(reader);
1764 if (!writeTag(writer)) {
1767 if (!writeArgs(writer)) {
1788 if (!readTag(reader)) {
1791 if (!readArgs(reader)) {
1822 return write(writer);
1828 return read(reader);
1853 if (!reader.
readBool(return_helper)) {
1882 return write(writer);
1892 return read(reader);
1897 if (!writeTag(writer)) {
1900 if (!writeArgs(writer)) {
1921 if (!readTag(reader)) {
1924 if (!readArgs(reader)) {
1955 return write(writer);
1961 return read(reader);
1986 if (!reader.
readBool(return_helper)) {
2015 return write(writer);
2025 return read(reader);
2030 if (!writeTag(writer)) {
2033 if (!writeArgs(writer)) {
2054 if (!readTag(reader)) {
2057 if (!readArgs(reader)) {
2088 return write(writer);
2094 return read(reader);
2119 if (!reader.
readBool(return_helper)) {
2134 yarp().setOwner(*
this);
2139 if (!
yarp().canWrite()) {
2143 bool ok =
yarp().write(helper, helper);
2144 return ok ? helper.reply.return_helper :
bool{};
2149 if (!
yarp().canWrite()) {
2153 bool ok =
yarp().write(helper, helper);
2154 return ok ? helper.reply.return_helper :
bool{};
2159 if (!
yarp().canWrite()) {
2163 bool ok =
yarp().write(helper, helper);
2164 return ok ? helper.reply.return_helper : std::int32_t{};
2169 if (!
yarp().canWrite()) {
2173 bool ok =
yarp().write(helper, helper);
2174 return ok ? helper.reply.return_helper :
bool{};
2179 if (!
yarp().canWrite()) {
2183 bool ok =
yarp().write(helper, helper);
2184 return ok ? helper.reply.return_helper : std::int32_t{};
2189 if (!
yarp().canWrite()) {
2193 bool ok =
yarp().write(helper, helper);
2194 return ok ? helper.reply.return_helper : std::string{};
2199 if (!
yarp().canWrite()) {
2203 bool ok =
yarp().write(helper, helper);
2204 return ok ? helper.reply.return_helper :
bool{};
2209 if (!
yarp().canWrite()) {
2213 bool ok =
yarp().write(helper, helper);
2214 return ok ? helper.reply.return_helper :
bool{};
2219 if (!
yarp().canWrite()) {
2223 bool ok =
yarp().write(helper, helper);
2224 return ok ? helper.reply.return_helper :
bool{};
2229 if (!
yarp().canWrite()) {
2233 bool ok =
yarp().write(helper, helper);
2234 return ok ? helper.reply.return_helper :
bool{};
2240 bool showAll = (functionName ==
"--all");
2241 std::vector<std::string> helpString;
2243 helpString.emplace_back(
"*** Available commands:");
2254 helpString.emplace_back(
"help");
2296 if (functionName ==
"help") {
2297 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
2298 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
2299 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");
2300 helpString.emplace_back(
"@return list of strings (one string per line)");
2303 if (helpString.empty()) {
2304 helpString.emplace_back(
"Command not found");
2312 constexpr size_t max_tag_len = 1;
2322 std::string tag = reader.
readTag(1);
2323 bool direct = (tag ==
"__direct__");
2327 while (tag_len <= max_tag_len && !reader.
isError()) {
2328 if(tag ==
"getRemoteProtocolVersion") {
2335 auto proto = getLocalProtocolVersion();
2341 if (!writer.
write(proto)) {
2498 if (tag ==
"help") {
2499 std::string functionName;
2501 functionName =
"--all";
2503 auto help_strings = help(functionName);
2509 if (!writer.
writeTag(
"many", 1, 0)) {
2515 for (
const auto& help_string : help_strings) {
2531 std::string next_tag = reader.
readTag(1);
2532 if (next_tag.empty()) {
2535 tag.append(
"_").append(next_tag);
2536 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