YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IRobotDescriptionMsgs.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6// Autogenerated by Thrift (based on compiler 0.14.1-yarped)
7// yarpidl_thrift version 2.0 - 11/11/2026
8// Protocol version: protocol_version=0, yarp_major=4, yarp_minor=0, yarp_patch=2
9// This is an automatically generated file.
10// It could get re-generated if the ALLOW_IDL_GENERATION flag is on.
11
12#include <yarp/conf/version.h>
15#include <yarp/os/LogStream.h>
16
18
19#include <algorithm>
20
21namespace
22{
23 YARP_LOG_COMPONENT(SERVICE_LOG_COMPONENT, "IRobotDescriptionMsgs")
24}
25
26//IRobotDescriptionMsgs_getRemoteProtocolVersion_helper declaration
37
39{
40 yarp::os::idl::WireWriter writer(connection);
41 if (!writer.writeListHeader(1)) {
42 return false;
43 }
44 if (!writer.writeString("getRemoteProtocolVersion")) {
45 return false;
46 }
47 return true;
48}
49
50bool IRobotDescriptionMsgs_getRemoteProtocolVersion_helper ::read(yarp::os::ConnectionReader & connection)
51 {
52 yarp::os::idl::WireReader reader(connection);
53 if (!reader.readListHeader()) {
54 reader.fail();
55 return false;
56 }
57
58 if (!helper_proto.read(connection)) {
59 reader.fail();
60 return false;
61 }
62 return true;
63}
64
65//ProtocolVersion, client side
67 {
68 if(!yarp().canWrite()) {
69 yError(" Missing server method IRobotDescriptionMsgs::getRemoteProtocolVersion");
70 }
72 bool ok = yarp().write(helper, helper);
73 if (ok) {
74 return helper.helper_proto;}
75 else {
77 return failureproto;}
78}
79
80//ProtocolVersion, client side
82 {
83 auto locproto = this->getLocalProtocolVersion();
84 auto remproto = this->getRemoteProtocolVersion();
85 if (remproto.protocol_version != locproto.protocol_version)
86 {
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();
90 return false;
91 }
92 return true;
93}
94
95//ProtocolVersion, server side
97{
99 //myproto.protocol_version using default value = 0
100 //to change this value add the following line to the .thrift file:
101 //const i16 protocol_version = <your_number_here>
102 myproto.protocol_version = 0;
106 return myproto;
107}
108
109// getAllDevicesRPC helper class declaration
111 public yarp::os::Portable
112{
113public:
115 bool write(yarp::os::ConnectionWriter& connection) const override;
116 bool read(yarp::os::ConnectionReader& connection) override;
117
118 class Command :
120 {
121 public:
122 Command() = default;
123 ~Command() override = default;
124
125 bool write(yarp::os::ConnectionWriter& connection) const override;
126 bool read(yarp::os::ConnectionReader& connection) override;
127
128 bool write(const yarp::os::idl::WireWriter& writer) const override;
129 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
130 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
131
132 bool read(yarp::os::idl::WireReader& reader) override;
135 };
136
137 class Reply :
139 {
140 public:
141 Reply() = default;
142 ~Reply() override = default;
143
144 bool write(yarp::os::ConnectionWriter& connection) const override;
145 bool read(yarp::os::ConnectionReader& connection) override;
146
147 bool write(const yarp::os::idl::WireWriter& writer) const override;
148 bool read(yarp::os::idl::WireReader& reader) override;
149
151 };
152
154 void call(IRobotDescriptionMsgs* ptr);
155
158
159 static constexpr const char* s_tag{"getAllDevicesRPC"};
160 static constexpr size_t s_tag_len{1};
161 static constexpr size_t s_cmd_len{1};
162 static constexpr size_t s_reply_len{2};
163 static constexpr const char* s_prototype{"return_getAllDevices IRobotDescriptionMsgs::getAllDevicesRPC()"};
164 static constexpr const char* s_help{""};
165};
166
167// getAllDevicesByTypeRPC helper class declaration
169 public yarp::os::Portable
170{
171public:
173 explicit IRobotDescriptionMsgs_getAllDevicesByTypeRPC_helper(const std::string& type);
174 bool write(yarp::os::ConnectionWriter& connection) const override;
175 bool read(yarp::os::ConnectionReader& connection) override;
176
177 class Command :
179 {
180 public:
181 Command() = default;
182 explicit Command(const std::string& type);
183
184 ~Command() override = default;
185
186 bool write(yarp::os::ConnectionWriter& connection) const override;
187 bool read(yarp::os::ConnectionReader& connection) override;
188
189 bool write(const yarp::os::idl::WireWriter& writer) const override;
190 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
191 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
192
193 bool read(yarp::os::idl::WireReader& reader) override;
196
197 std::string type{};
198 };
199
200 class Reply :
202 {
203 public:
204 Reply() = default;
205 ~Reply() override = default;
206
207 bool write(yarp::os::ConnectionWriter& connection) const override;
208 bool read(yarp::os::ConnectionReader& connection) override;
209
210 bool write(const yarp::os::idl::WireWriter& writer) const override;
211 bool read(yarp::os::idl::WireReader& reader) override;
212
214 };
215
216 using funcptr_t = return_getAllDevicesByType (*)(const std::string&);
217 void call(IRobotDescriptionMsgs* ptr);
218
221
222 static constexpr const char* s_tag{"getAllDevicesByTypeRPC"};
223 static constexpr size_t s_tag_len{1};
224 static constexpr size_t s_cmd_len{2};
225 static constexpr size_t s_reply_len{2};
226 static constexpr const char* s_prototype{"return_getAllDevicesByType IRobotDescriptionMsgs::getAllDevicesByTypeRPC(const std::string& type)"};
227 static constexpr const char* s_help{""};
228};
229
230// registerDeviceRPC helper class declaration
232 public yarp::os::Portable
233{
234public:
237 bool write(yarp::os::ConnectionWriter& connection) const override;
238 bool read(yarp::os::ConnectionReader& connection) override;
239
240 class Command :
242 {
243 public:
244 Command() = default;
246
247 ~Command() override = default;
248
249 bool write(yarp::os::ConnectionWriter& connection) const override;
250 bool read(yarp::os::ConnectionReader& connection) override;
251
252 bool write(const yarp::os::idl::WireWriter& writer) const override;
253 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
254 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
255
256 bool read(yarp::os::idl::WireReader& reader) override;
259
261 };
262
263 class Reply :
265 {
266 public:
267 Reply() = default;
268 ~Reply() override = default;
269
270 bool write(yarp::os::ConnectionWriter& connection) const override;
271 bool read(yarp::os::ConnectionReader& connection) override;
272
273 bool write(const yarp::os::idl::WireWriter& writer) const override;
274 bool read(yarp::os::idl::WireReader& reader) override;
275
277 };
278
280 void call(IRobotDescriptionMsgs* ptr);
281
284
285 static constexpr const char* s_tag{"registerDeviceRPC"};
286 static constexpr size_t s_tag_len{1};
287 static constexpr size_t s_cmd_len{2};
288 static constexpr size_t s_reply_len{1};
289 static constexpr const char* s_prototype{"yarp::dev::ReturnValue IRobotDescriptionMsgs::registerDeviceRPC(const yarp::dev::DeviceDescription& dev)"};
290 static constexpr const char* s_help{""};
291};
292
293// unregisterDeviceRPC helper class declaration
295 public yarp::os::Portable
296{
297public:
299 explicit IRobotDescriptionMsgs_unregisterDeviceRPC_helper(const std::string& dev);
300 bool write(yarp::os::ConnectionWriter& connection) const override;
301 bool read(yarp::os::ConnectionReader& connection) override;
302
303 class Command :
305 {
306 public:
307 Command() = default;
308 explicit Command(const std::string& dev);
309
310 ~Command() override = default;
311
312 bool write(yarp::os::ConnectionWriter& connection) const override;
313 bool read(yarp::os::ConnectionReader& connection) override;
314
315 bool write(const yarp::os::idl::WireWriter& writer) const override;
316 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
317 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
318
319 bool read(yarp::os::idl::WireReader& reader) override;
322
323 std::string dev{};
324 };
325
326 class Reply :
328 {
329 public:
330 Reply() = default;
331 ~Reply() override = default;
332
333 bool write(yarp::os::ConnectionWriter& connection) const override;
334 bool read(yarp::os::ConnectionReader& connection) override;
335
336 bool write(const yarp::os::idl::WireWriter& writer) const override;
337 bool read(yarp::os::idl::WireReader& reader) override;
338
340 };
341
342 using funcptr_t = yarp::dev::ReturnValue (*)(const std::string&);
343 void call(IRobotDescriptionMsgs* ptr);
344
347
348 static constexpr const char* s_tag{"unregisterDeviceRPC"};
349 static constexpr size_t s_tag_len{1};
350 static constexpr size_t s_cmd_len{2};
351 static constexpr size_t s_reply_len{1};
352 static constexpr const char* s_prototype{"yarp::dev::ReturnValue IRobotDescriptionMsgs::unregisterDeviceRPC(const std::string& dev)"};
353 static constexpr const char* s_help{""};
354};
355
356// unregisterAllRPC helper class declaration
358 public yarp::os::Portable
359{
360public:
362 bool write(yarp::os::ConnectionWriter& connection) const override;
363 bool read(yarp::os::ConnectionReader& connection) override;
364
365 class Command :
367 {
368 public:
369 Command() = default;
370 ~Command() override = default;
371
372 bool write(yarp::os::ConnectionWriter& connection) const override;
373 bool read(yarp::os::ConnectionReader& connection) override;
374
375 bool write(const yarp::os::idl::WireWriter& writer) const override;
376 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
377 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
378
379 bool read(yarp::os::idl::WireReader& reader) override;
382 };
383
384 class Reply :
386 {
387 public:
388 Reply() = default;
389 ~Reply() override = default;
390
391 bool write(yarp::os::ConnectionWriter& connection) const override;
392 bool read(yarp::os::ConnectionReader& connection) override;
393
394 bool write(const yarp::os::idl::WireWriter& writer) const override;
395 bool read(yarp::os::idl::WireReader& reader) override;
396
398 };
399
401 void call(IRobotDescriptionMsgs* ptr);
402
405
406 static constexpr const char* s_tag{"unregisterAllRPC"};
407 static constexpr size_t s_tag_len{1};
408 static constexpr size_t s_cmd_len{1};
409 static constexpr size_t s_reply_len{1};
410 static constexpr const char* s_prototype{"yarp::dev::ReturnValue IRobotDescriptionMsgs::unregisterAllRPC()"};
411 static constexpr const char* s_help{""};
412};
413
414// getAllDevicesRPC helper class implementation
416{
417 return cmd.write(connection);
418}
419
424
426{
427 yarp::os::idl::WireWriter writer(connection);
428 if (!writer.writeListHeader(s_cmd_len)) {
429 return false;
430 }
431 return write(writer);
432}
433
435{
436 yarp::os::idl::WireReader reader(connection);
437 if (!reader.readListHeader()) {
438 reader.fail();
439 return false;
440 }
441 return read(reader);
442}
443
445{
446 if (!writeTag(writer)) {
447 return false;
448 }
449 if (!writeArgs(writer)) {
450 return false;
451 }
452 return true;
453}
454
456{
457 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
458 return false;
459 }
460 return true;
461}
462
464{
465 return true;
466}
467
469{
470 if (!readTag(reader)) {
471 return false;
472 }
473 if (!readArgs(reader)) {
474 return false;
475 }
476 return true;
477}
478
480{
481 std::string tag = reader.readTag(s_tag_len);
482 if (reader.isError()) {
483 return false;
484 }
485 if (tag != s_tag) {
486 reader.fail();
487 return false;
488 }
489 return true;
490}
491
493{
494 if (!reader.noMore()) {
495 reader.fail();
496 return false;
497 }
498 return true;
499}
500
502{
503 yarp::os::idl::WireWriter writer(connection);
504 return write(writer);
505}
506
512
514{
515 if (!writer.isNull()) {
516 if (!writer.writeListHeader(s_reply_len)) {
517 return false;
518 }
519 if (!writer.write(return_helper)) {
520 return false;
521 }
522 }
523 return true;
524}
525
527{
528 if (!reader.readListReturn()) {
529 return false;
530 }
531 if (reader.noMore()) {
532 reader.fail();
533 return false;
534 }
535 if (!reader.read(return_helper)) {
536 reader.fail();
537 return false;
538 }
539 return true;
540}
541
546
547// getAllDevicesByTypeRPC helper class implementation
552
557
562
564 type{type}
565{
566}
567
569{
570 yarp::os::idl::WireWriter writer(connection);
571 if (!writer.writeListHeader(s_cmd_len)) {
572 return false;
573 }
574 return write(writer);
575}
576
578{
579 yarp::os::idl::WireReader reader(connection);
580 if (!reader.readListHeader()) {
581 reader.fail();
582 return false;
583 }
584 return read(reader);
585}
586
588{
589 if (!writeTag(writer)) {
590 return false;
591 }
592 if (!writeArgs(writer)) {
593 return false;
594 }
595 return true;
596}
597
599{
600 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
601 return false;
602 }
603 return true;
604}
605
607{
608 if (!writer.writeString(type)) {
609 return false;
610 }
611 return true;
612}
613
615{
616 if (!readTag(reader)) {
617 return false;
618 }
619 if (!readArgs(reader)) {
620 return false;
621 }
622 return true;
623}
624
626{
627 std::string tag = reader.readTag(s_tag_len);
628 if (reader.isError()) {
629 return false;
630 }
631 if (tag != s_tag) {
632 reader.fail();
633 return false;
634 }
635 return true;
636}
637
639{
640 if (reader.noMore()) {
641 reader.fail();
642 return false;
643 }
644 if (!reader.readString(type)) {
645 reader.fail();
646 return false;
647 }
648 if (!reader.noMore()) {
649 reader.fail();
650 return false;
651 }
652 return true;
653}
654
660
666
668{
669 if (!writer.isNull()) {
670 if (!writer.writeListHeader(s_reply_len)) {
671 return false;
672 }
673 if (!writer.write(return_helper)) {
674 return false;
675 }
676 }
677 return true;
678}
679
681{
682 if (!reader.readListReturn()) {
683 return false;
684 }
685 if (reader.noMore()) {
686 reader.fail();
687 return false;
688 }
689 if (!reader.read(return_helper)) {
690 reader.fail();
691 return false;
692 }
693 return true;
694}
695
700
701// registerDeviceRPC helper class implementation
706
708{
709 return cmd.write(connection);
710}
711
716
721
723{
724 yarp::os::idl::WireWriter writer(connection);
725 if (!writer.writeListHeader(s_cmd_len)) {
726 return false;
727 }
728 return write(writer);
729}
730
732{
733 yarp::os::idl::WireReader reader(connection);
734 if (!reader.readListHeader()) {
735 reader.fail();
736 return false;
737 }
738 return read(reader);
739}
740
742{
743 if (!writeTag(writer)) {
744 return false;
745 }
746 if (!writeArgs(writer)) {
747 return false;
748 }
749 return true;
750}
751
753{
754 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
755 return false;
756 }
757 return true;
758}
759
761{
762 if (!writer.writeNested(dev)) {
763 return false;
764 }
765 return true;
766}
767
769{
770 if (!readTag(reader)) {
771 return false;
772 }
773 if (!readArgs(reader)) {
774 return false;
775 }
776 return true;
777}
778
780{
781 std::string tag = reader.readTag(s_tag_len);
782 if (reader.isError()) {
783 return false;
784 }
785 if (tag != s_tag) {
786 reader.fail();
787 return false;
788 }
789 return true;
790}
791
793{
794 if (reader.noMore()) {
795 reader.fail();
796 return false;
797 }
798 if (!reader.readNested(dev)) {
799 reader.fail();
800 return false;
801 }
802 if (!reader.noMore()) {
803 reader.fail();
804 return false;
805 }
806 return true;
807}
808
810{
811 yarp::os::idl::WireWriter writer(connection);
812 return write(writer);
813}
814
820
822{
823 if (!writer.isNull()) {
824 if (!writer.write(return_helper)) {
825 return false;
826 }
827 }
828 return true;
829}
830
832{
833 if (reader.noMore()) {
834 reader.fail();
835 return false;
836 }
837 if (!reader.read(return_helper)) {
838 reader.fail();
839 return false;
840 }
841 return true;
842}
843
848
849// unregisterDeviceRPC helper class implementation
854
856{
857 return cmd.write(connection);
858}
859
864
866 dev{dev}
867{
868}
869
871{
872 yarp::os::idl::WireWriter writer(connection);
873 if (!writer.writeListHeader(s_cmd_len)) {
874 return false;
875 }
876 return write(writer);
877}
878
880{
881 yarp::os::idl::WireReader reader(connection);
882 if (!reader.readListHeader()) {
883 reader.fail();
884 return false;
885 }
886 return read(reader);
887}
888
890{
891 if (!writeTag(writer)) {
892 return false;
893 }
894 if (!writeArgs(writer)) {
895 return false;
896 }
897 return true;
898}
899
901{
902 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
903 return false;
904 }
905 return true;
906}
907
909{
910 if (!writer.writeString(dev)) {
911 return false;
912 }
913 return true;
914}
915
917{
918 if (!readTag(reader)) {
919 return false;
920 }
921 if (!readArgs(reader)) {
922 return false;
923 }
924 return true;
925}
926
928{
929 std::string tag = reader.readTag(s_tag_len);
930 if (reader.isError()) {
931 return false;
932 }
933 if (tag != s_tag) {
934 reader.fail();
935 return false;
936 }
937 return true;
938}
939
941{
942 if (reader.noMore()) {
943 reader.fail();
944 return false;
945 }
946 if (!reader.readString(dev)) {
947 reader.fail();
948 return false;
949 }
950 if (!reader.noMore()) {
951 reader.fail();
952 return false;
953 }
954 return true;
955}
956
958{
959 yarp::os::idl::WireWriter writer(connection);
960 return write(writer);
961}
962
968
970{
971 if (!writer.isNull()) {
972 if (!writer.write(return_helper)) {
973 return false;
974 }
975 }
976 return true;
977}
978
980{
981 if (reader.noMore()) {
982 reader.fail();
983 return false;
984 }
985 if (!reader.read(return_helper)) {
986 reader.fail();
987 return false;
988 }
989 return true;
990}
991
996
997// unregisterAllRPC helper class implementation
999{
1000 return cmd.write(connection);
1001}
1002
1007
1009{
1010 yarp::os::idl::WireWriter writer(connection);
1011 if (!writer.writeListHeader(s_cmd_len)) {
1012 return false;
1013 }
1014 return write(writer);
1015}
1016
1018{
1019 yarp::os::idl::WireReader reader(connection);
1020 if (!reader.readListHeader()) {
1021 reader.fail();
1022 return false;
1023 }
1024 return read(reader);
1025}
1026
1028{
1029 if (!writeTag(writer)) {
1030 return false;
1031 }
1032 if (!writeArgs(writer)) {
1033 return false;
1034 }
1035 return true;
1036}
1037
1039{
1040 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1041 return false;
1042 }
1043 return true;
1044}
1045
1047{
1048 return true;
1049}
1050
1052{
1053 if (!readTag(reader)) {
1054 return false;
1055 }
1056 if (!readArgs(reader)) {
1057 return false;
1058 }
1059 return true;
1060}
1061
1063{
1064 std::string tag = reader.readTag(s_tag_len);
1065 if (reader.isError()) {
1066 return false;
1067 }
1068 if (tag != s_tag) {
1069 reader.fail();
1070 return false;
1071 }
1072 return true;
1073}
1074
1076{
1077 if (!reader.noMore()) {
1078 reader.fail();
1079 return false;
1080 }
1081 return true;
1082}
1083
1085{
1086 yarp::os::idl::WireWriter writer(connection);
1087 return write(writer);
1088}
1089
1091{
1092 yarp::os::idl::WireReader reader(connection);
1093 return read(reader);
1094}
1095
1097{
1098 if (!writer.isNull()) {
1099 if (!writer.write(return_helper)) {
1100 return false;
1101 }
1102 }
1103 return true;
1104}
1105
1107{
1108 if (reader.noMore()) {
1109 reader.fail();
1110 return false;
1111 }
1112 if (!reader.read(return_helper)) {
1113 reader.fail();
1114 return false;
1115 }
1116 return true;
1117}
1118
1123
1124// Constructor
1126{
1127 yarp().setOwner(*this);
1128}
1129
1131{
1132 if (!yarp().canWrite()) {
1134 }
1136 bool ok = yarp().write(helper, helper);
1137 if (!ok) {
1138 return_getAllDevices failed_reply{};
1140 return failed_reply;
1141 }
1142 return helper.reply.return_helper;
1143}
1144
1146{
1147 if (!yarp().canWrite()) {
1149 }
1151 bool ok = yarp().write(helper, helper);
1152 if (!ok) {
1153 return_getAllDevicesByType failed_reply{};
1155 return failed_reply;
1156 }
1157 return helper.reply.return_helper;
1158}
1159
1169
1171{
1172 if (!yarp().canWrite()) {
1174 }
1176 bool ok = yarp().write(helper, helper);
1178}
1179
1181{
1182 if (!yarp().canWrite()) {
1184 }
1186 bool ok = yarp().write(helper, helper);
1188}
1189
1190// help method
1191std::vector<std::string> IRobotDescriptionMsgs::help(const std::string& functionName)
1192{
1193 bool showAll = (functionName == "--all");
1194 std::vector<std::string> helpString;
1195 if (showAll) {
1196 helpString.emplace_back("*** Available commands:");
1202 helpString.emplace_back("help");
1203 } else {
1206 }
1209 }
1212 }
1215 }
1218 }
1219 if (functionName == "help") {
1220 helpString.emplace_back("std::vector<std::string> help(const std::string& functionName = \"--all\")");
1221 helpString.emplace_back("Return list of available commands, or help message for a specific function");
1222 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");
1223 helpString.emplace_back("@return list of strings (one string per line)");
1224 }
1225 }
1226 if (helpString.empty()) {
1227 helpString.emplace_back("Command not found");
1228 }
1229 return helpString;
1230}
1231
1232// read from ConnectionReader
1234{
1235 constexpr size_t max_tag_len = 1;
1236 size_t tag_len = 1;
1237
1238 yarp::os::idl::WireReader reader(connection);
1239 reader.expectAccept();
1240 if (!reader.readListHeader()) {
1241 reader.fail();
1242 return false;
1243 }
1244
1245 std::string tag = reader.readTag(1);
1246 bool direct = (tag == "__direct__");
1247 if (direct) {
1248 tag = reader.readTag(1);
1249 }
1250 while (tag_len <= max_tag_len && !reader.isError()) {
1251 if(tag == "getRemoteProtocolVersion") {
1252 if (!reader.noMore()) {
1253 yError("Reader invalid protocol?! %s:%d - %s", __FILE__, __LINE__, __YFUNCTION__);
1254 reader.fail();
1255 return false;
1256 }
1257
1258 auto proto = getLocalProtocolVersion();
1259
1260 yarp::os::idl::WireWriter writer(reader);
1261 if (!writer.writeListHeader(1)) {
1262 yWarning("Writer invalid protocol?! %s:%d - %s", __FILE__, __LINE__, __YFUNCTION__);
1263 return false;}
1264 if (!writer.write(proto)) {
1265 yWarning("Writer invalid protocol?! %s:%d - %s", __FILE__, __LINE__, __YFUNCTION__);
1266 return false;
1267 }
1268 reader.accept();
1269 return true;
1270 }
1273 if (!helper.cmd.readArgs(reader)) {
1274 return false;
1275 }
1276
1277 helper.call(this);
1278
1279 yarp::os::idl::WireWriter writer(reader);
1280 if (!helper.reply.write(writer)) {
1281 return false;
1282 }
1283 reader.accept();
1284 return true;
1285 }
1288 if (!helper.cmd.readArgs(reader)) {
1289 return false;
1290 }
1291
1292 helper.call(this);
1293
1294 yarp::os::idl::WireWriter writer(reader);
1295 if (!helper.reply.write(writer)) {
1296 return false;
1297 }
1298 reader.accept();
1299 return true;
1300 }
1303 if (!helper.cmd.readArgs(reader)) {
1304 return false;
1305 }
1306
1307 helper.call(this);
1308
1309 yarp::os::idl::WireWriter writer(reader);
1310 if (!helper.reply.write(writer)) {
1311 return false;
1312 }
1313 reader.accept();
1314 return true;
1315 }
1318 if (!helper.cmd.readArgs(reader)) {
1319 return false;
1320 }
1321
1322 helper.call(this);
1323
1324 yarp::os::idl::WireWriter writer(reader);
1325 if (!helper.reply.write(writer)) {
1326 return false;
1327 }
1328 reader.accept();
1329 return true;
1330 }
1333 if (!helper.cmd.readArgs(reader)) {
1334 return false;
1335 }
1336
1337 helper.call(this);
1338
1339 yarp::os::idl::WireWriter writer(reader);
1340 if (!helper.reply.write(writer)) {
1341 return false;
1342 }
1343 reader.accept();
1344 return true;
1345 }
1346 if (tag == "help") {
1347 std::string functionName;
1348 if (!reader.readString(functionName)) {
1349 functionName = "--all";
1350 }
1351 auto help_strings = help(functionName);
1352 yarp::os::idl::WireWriter writer(reader);
1353 if (!writer.isNull()) {
1354 if (!writer.writeListHeader(2)) {
1355 return false;
1356 }
1357 if (!writer.writeTag("many", 1, 0)) {
1358 return false;
1359 }
1360 if (!writer.writeListBegin(0, help_strings.size())) {
1361 return false;
1362 }
1363 for (const auto& help_string : help_strings) {
1364 if (!writer.writeString(help_string)) {
1365 return false;
1366 }
1367 }
1368 if (!writer.writeListEnd()) {
1369 return false;
1370 }
1371 }
1372 reader.accept();
1373 return true;
1374 }
1375 if (reader.noMore()) {
1376 reader.fail();
1377 return false;
1378 }
1379 std::string next_tag = reader.readTag(1);
1380 if (next_tag.empty()) {
1381 break;
1382 }
1383 tag.append("_").append(next_tag);
1384 tag_len = std::count(tag.begin(), tag.end(), '_') + 1;
1385 }
1386 return false;
1387}
#define yError(...)
Definition Log.h:361
#define __YFUNCTION__
Definition Log.h:24
#define yWarning(...)
Definition Log.h:340
bool writeTag(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 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.
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.
return_getAllDevicesByType(*)(const std::string &) funcptr_t
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 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 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.
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 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 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.
yarp::dev::ReturnValue(*)(const yarp::dev::DeviceDescription &) funcptr_t
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 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 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 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 writeTag(const yarp::os::idl::WireWriter &writer) const
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.
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 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.
yarp::dev::ReturnValue(*)(const std::string &) funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual yarp::dev::ReturnValue unregisterAllRPC()
virtual return_getAllDevices getAllDevicesRPC()
virtual return_getAllDevicesByType getAllDevicesByTypeRPC(const std::string &type)
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual yarp::dev::ReturnValue registerDeviceRPC(const yarp::dev::DeviceDescription &dev)
virtual yarp::dev::ReturnValue unregisterDeviceRPC(const std::string &dev)
yarp::dev::ReturnValue ret
@ return_value_error_nws_nwc_communication_error
Method is not (yet) implemented.
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.
Definition Portable.h:25
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
Definition Wire.h:28
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
IDL-friendly connection reader.
Definition WireReader.h:27
bool readNested(WirePortable &obj)
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.
Definition WireWriter.h:28
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 writeNested(const WirePortable &obj) const
bool writeListBegin(int tag, size_t len) const
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
The main, catch-all namespace for YARP.
Definition dirs.h:16
#define YARP_VERSION_PATCH
Definition version.h:12
#define YARP_VERSION_MAJOR
Definition version.h:10
#define YARP_VERSION_MINOR
Definition version.h:11