YARP
Yet Another Robot Platform
SensorRPCData.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 Compiler (0.14.1-yarped)
7//
8// This is an automatically generated file.
9// It could get re-generated if the ALLOW_IDL_GENERATION flag is on.
10
11#include <SensorRPCData.h>
12
13// Constructor with field values
14SensorRPCData::SensorRPCData(const std::vector<SensorMetadata>& ThreeAxisGyroscopes,
15 const std::vector<SensorMetadata>& ThreeAxisLinearAccelerometers,
16 const std::vector<SensorMetadata>& ThreeAxisMagnetometers,
17 const std::vector<SensorMetadata>& OrientationSensors,
18 const std::vector<SensorMetadata>& TemperatureSensors,
19 const std::vector<SensorMetadata>& SixAxisForceTorqueSensors,
20 const std::vector<SensorMetadata>& ContactLoadCellArrays,
21 const std::vector<SensorMetadata>& EncoderArrays,
22 const std::vector<SensorMetadata>& SkinPatches,
23 const std::vector<SensorMetadata>& PositionSensors) :
24 WirePortable(),
35{
36}
37
38// Read structure on a Wire
40{
41 if (!read_ThreeAxisGyroscopes(reader)) {
42 return false;
43 }
44 if (!read_ThreeAxisLinearAccelerometers(reader)) {
45 return false;
46 }
47 if (!read_ThreeAxisMagnetometers(reader)) {
48 return false;
49 }
50 if (!read_OrientationSensors(reader)) {
51 return false;
52 }
53 if (!read_TemperatureSensors(reader)) {
54 return false;
55 }
56 if (!read_SixAxisForceTorqueSensors(reader)) {
57 return false;
58 }
59 if (!read_ContactLoadCellArrays(reader)) {
60 return false;
61 }
62 if (!read_EncoderArrays(reader)) {
63 return false;
64 }
65 if (!read_SkinPatches(reader)) {
66 return false;
67 }
68 if (!read_PositionSensors(reader)) {
69 return false;
70 }
71 if (reader.isError()) {
72 return false;
73 }
74 return true;
75}
76
77// Read structure on a Connection
79{
80 yarp::os::idl::WireReader reader(connection);
81 if (!reader.readListHeader(10)) {
82 return false;
83 }
84 if (!read(reader)) {
85 return false;
86 }
87 return true;
88}
89
90// Write structure on a Wire
92{
93 if (!write_ThreeAxisGyroscopes(writer)) {
94 return false;
95 }
96 if (!write_ThreeAxisLinearAccelerometers(writer)) {
97 return false;
98 }
99 if (!write_ThreeAxisMagnetometers(writer)) {
100 return false;
101 }
102 if (!write_OrientationSensors(writer)) {
103 return false;
104 }
105 if (!write_TemperatureSensors(writer)) {
106 return false;
107 }
108 if (!write_SixAxisForceTorqueSensors(writer)) {
109 return false;
110 }
111 if (!write_ContactLoadCellArrays(writer)) {
112 return false;
113 }
114 if (!write_EncoderArrays(writer)) {
115 return false;
116 }
117 if (!write_SkinPatches(writer)) {
118 return false;
119 }
120 if (!write_PositionSensors(writer)) {
121 return false;
122 }
123 if (writer.isError()) {
124 return false;
125 }
126 return true;
127}
128
129// Write structure on a Connection
131{
132 yarp::os::idl::WireWriter writer(connection);
133 if (!writer.writeListHeader(10)) {
134 return false;
135 }
136 if (!write(writer)) {
137 return false;
138 }
139 return true;
140}
141
142// Convert to a printable string
143std::string SensorRPCData::toString() const
144{
146 if (!yarp::os::Portable::copyPortable(*this, b)) {
147 return {};
148 }
149 return b.toString();
150}
151
152// read ThreeAxisGyroscopes field
153bool SensorRPCData::read_ThreeAxisGyroscopes(yarp::os::idl::WireReader& reader)
154{
155 if (reader.noMore()) {
156 reader.fail();
157 return false;
158 }
159 size_t _csize;
161 reader.readListBegin(_etype, _csize);
162 // WireReader removes BOTTLE_TAG_LIST from the tag
163 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
164 if constexpr (expected_tag != 0) {
165 if (_csize != 0 && _etype.code != expected_tag) {
166 return false;
167 }
168 }
169 ThreeAxisGyroscopes.resize(_csize);
170 for (size_t _i = 0; _i < _csize; ++_i) {
171 if (reader.noMore()) {
172 reader.fail();
173 return false;
174 }
175 if (!reader.readNested(ThreeAxisGyroscopes[_i])) {
176 reader.fail();
177 return false;
178 }
179 }
180 reader.readListEnd();
181 return true;
182}
183
184// write ThreeAxisGyroscopes field
185bool SensorRPCData::write_ThreeAxisGyroscopes(const yarp::os::idl::WireWriter& writer) const
186{
188 return false;
189 }
190 for (const auto& _item : ThreeAxisGyroscopes) {
191 if (!writer.writeNested(_item)) {
192 return false;
193 }
194 }
195 if (!writer.writeListEnd()) {
196 return false;
197 }
198 return true;
199}
200
201// read (nested) ThreeAxisGyroscopes field
202bool SensorRPCData::nested_read_ThreeAxisGyroscopes(yarp::os::idl::WireReader& reader)
203{
204 if (reader.noMore()) {
205 reader.fail();
206 return false;
207 }
208 size_t _csize;
210 reader.readListBegin(_etype, _csize);
211 // WireReader removes BOTTLE_TAG_LIST from the tag
212 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
213 if constexpr (expected_tag != 0) {
214 if (_csize != 0 && _etype.code != expected_tag) {
215 return false;
216 }
217 }
218 ThreeAxisGyroscopes.resize(_csize);
219 for (size_t _i = 0; _i < _csize; ++_i) {
220 if (reader.noMore()) {
221 reader.fail();
222 return false;
223 }
224 if (!reader.readNested(ThreeAxisGyroscopes[_i])) {
225 reader.fail();
226 return false;
227 }
228 }
229 reader.readListEnd();
230 return true;
231}
232
233// write (nested) ThreeAxisGyroscopes field
234bool SensorRPCData::nested_write_ThreeAxisGyroscopes(const yarp::os::idl::WireWriter& writer) const
235{
237 return false;
238 }
239 for (const auto& _item : ThreeAxisGyroscopes) {
240 if (!writer.writeNested(_item)) {
241 return false;
242 }
243 }
244 if (!writer.writeListEnd()) {
245 return false;
246 }
247 return true;
248}
249
250// read ThreeAxisLinearAccelerometers field
251bool SensorRPCData::read_ThreeAxisLinearAccelerometers(yarp::os::idl::WireReader& reader)
252{
253 if (reader.noMore()) {
254 reader.fail();
255 return false;
256 }
257 size_t _csize;
259 reader.readListBegin(_etype, _csize);
260 // WireReader removes BOTTLE_TAG_LIST from the tag
261 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
262 if constexpr (expected_tag != 0) {
263 if (_csize != 0 && _etype.code != expected_tag) {
264 return false;
265 }
266 }
267 ThreeAxisLinearAccelerometers.resize(_csize);
268 for (size_t _i = 0; _i < _csize; ++_i) {
269 if (reader.noMore()) {
270 reader.fail();
271 return false;
272 }
273 if (!reader.readNested(ThreeAxisLinearAccelerometers[_i])) {
274 reader.fail();
275 return false;
276 }
277 }
278 reader.readListEnd();
279 return true;
280}
281
282// write ThreeAxisLinearAccelerometers field
283bool SensorRPCData::write_ThreeAxisLinearAccelerometers(const yarp::os::idl::WireWriter& writer) const
284{
286 return false;
287 }
288 for (const auto& _item : ThreeAxisLinearAccelerometers) {
289 if (!writer.writeNested(_item)) {
290 return false;
291 }
292 }
293 if (!writer.writeListEnd()) {
294 return false;
295 }
296 return true;
297}
298
299// read (nested) ThreeAxisLinearAccelerometers field
300bool SensorRPCData::nested_read_ThreeAxisLinearAccelerometers(yarp::os::idl::WireReader& reader)
301{
302 if (reader.noMore()) {
303 reader.fail();
304 return false;
305 }
306 size_t _csize;
308 reader.readListBegin(_etype, _csize);
309 // WireReader removes BOTTLE_TAG_LIST from the tag
310 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
311 if constexpr (expected_tag != 0) {
312 if (_csize != 0 && _etype.code != expected_tag) {
313 return false;
314 }
315 }
316 ThreeAxisLinearAccelerometers.resize(_csize);
317 for (size_t _i = 0; _i < _csize; ++_i) {
318 if (reader.noMore()) {
319 reader.fail();
320 return false;
321 }
322 if (!reader.readNested(ThreeAxisLinearAccelerometers[_i])) {
323 reader.fail();
324 return false;
325 }
326 }
327 reader.readListEnd();
328 return true;
329}
330
331// write (nested) ThreeAxisLinearAccelerometers field
332bool SensorRPCData::nested_write_ThreeAxisLinearAccelerometers(const yarp::os::idl::WireWriter& writer) const
333{
335 return false;
336 }
337 for (const auto& _item : ThreeAxisLinearAccelerometers) {
338 if (!writer.writeNested(_item)) {
339 return false;
340 }
341 }
342 if (!writer.writeListEnd()) {
343 return false;
344 }
345 return true;
346}
347
348// read ThreeAxisMagnetometers field
349bool SensorRPCData::read_ThreeAxisMagnetometers(yarp::os::idl::WireReader& reader)
350{
351 if (reader.noMore()) {
352 reader.fail();
353 return false;
354 }
355 size_t _csize;
357 reader.readListBegin(_etype, _csize);
358 // WireReader removes BOTTLE_TAG_LIST from the tag
359 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
360 if constexpr (expected_tag != 0) {
361 if (_csize != 0 && _etype.code != expected_tag) {
362 return false;
363 }
364 }
365 ThreeAxisMagnetometers.resize(_csize);
366 for (size_t _i = 0; _i < _csize; ++_i) {
367 if (reader.noMore()) {
368 reader.fail();
369 return false;
370 }
371 if (!reader.readNested(ThreeAxisMagnetometers[_i])) {
372 reader.fail();
373 return false;
374 }
375 }
376 reader.readListEnd();
377 return true;
378}
379
380// write ThreeAxisMagnetometers field
381bool SensorRPCData::write_ThreeAxisMagnetometers(const yarp::os::idl::WireWriter& writer) const
382{
384 return false;
385 }
386 for (const auto& _item : ThreeAxisMagnetometers) {
387 if (!writer.writeNested(_item)) {
388 return false;
389 }
390 }
391 if (!writer.writeListEnd()) {
392 return false;
393 }
394 return true;
395}
396
397// read (nested) ThreeAxisMagnetometers field
398bool SensorRPCData::nested_read_ThreeAxisMagnetometers(yarp::os::idl::WireReader& reader)
399{
400 if (reader.noMore()) {
401 reader.fail();
402 return false;
403 }
404 size_t _csize;
406 reader.readListBegin(_etype, _csize);
407 // WireReader removes BOTTLE_TAG_LIST from the tag
408 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
409 if constexpr (expected_tag != 0) {
410 if (_csize != 0 && _etype.code != expected_tag) {
411 return false;
412 }
413 }
414 ThreeAxisMagnetometers.resize(_csize);
415 for (size_t _i = 0; _i < _csize; ++_i) {
416 if (reader.noMore()) {
417 reader.fail();
418 return false;
419 }
420 if (!reader.readNested(ThreeAxisMagnetometers[_i])) {
421 reader.fail();
422 return false;
423 }
424 }
425 reader.readListEnd();
426 return true;
427}
428
429// write (nested) ThreeAxisMagnetometers field
430bool SensorRPCData::nested_write_ThreeAxisMagnetometers(const yarp::os::idl::WireWriter& writer) const
431{
433 return false;
434 }
435 for (const auto& _item : ThreeAxisMagnetometers) {
436 if (!writer.writeNested(_item)) {
437 return false;
438 }
439 }
440 if (!writer.writeListEnd()) {
441 return false;
442 }
443 return true;
444}
445
446// read OrientationSensors field
447bool SensorRPCData::read_OrientationSensors(yarp::os::idl::WireReader& reader)
448{
449 if (reader.noMore()) {
450 reader.fail();
451 return false;
452 }
453 size_t _csize;
455 reader.readListBegin(_etype, _csize);
456 // WireReader removes BOTTLE_TAG_LIST from the tag
457 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
458 if constexpr (expected_tag != 0) {
459 if (_csize != 0 && _etype.code != expected_tag) {
460 return false;
461 }
462 }
463 OrientationSensors.resize(_csize);
464 for (size_t _i = 0; _i < _csize; ++_i) {
465 if (reader.noMore()) {
466 reader.fail();
467 return false;
468 }
469 if (!reader.readNested(OrientationSensors[_i])) {
470 reader.fail();
471 return false;
472 }
473 }
474 reader.readListEnd();
475 return true;
476}
477
478// write OrientationSensors field
479bool SensorRPCData::write_OrientationSensors(const yarp::os::idl::WireWriter& writer) const
480{
482 return false;
483 }
484 for (const auto& _item : OrientationSensors) {
485 if (!writer.writeNested(_item)) {
486 return false;
487 }
488 }
489 if (!writer.writeListEnd()) {
490 return false;
491 }
492 return true;
493}
494
495// read (nested) OrientationSensors field
496bool SensorRPCData::nested_read_OrientationSensors(yarp::os::idl::WireReader& reader)
497{
498 if (reader.noMore()) {
499 reader.fail();
500 return false;
501 }
502 size_t _csize;
504 reader.readListBegin(_etype, _csize);
505 // WireReader removes BOTTLE_TAG_LIST from the tag
506 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
507 if constexpr (expected_tag != 0) {
508 if (_csize != 0 && _etype.code != expected_tag) {
509 return false;
510 }
511 }
512 OrientationSensors.resize(_csize);
513 for (size_t _i = 0; _i < _csize; ++_i) {
514 if (reader.noMore()) {
515 reader.fail();
516 return false;
517 }
518 if (!reader.readNested(OrientationSensors[_i])) {
519 reader.fail();
520 return false;
521 }
522 }
523 reader.readListEnd();
524 return true;
525}
526
527// write (nested) OrientationSensors field
528bool SensorRPCData::nested_write_OrientationSensors(const yarp::os::idl::WireWriter& writer) const
529{
531 return false;
532 }
533 for (const auto& _item : OrientationSensors) {
534 if (!writer.writeNested(_item)) {
535 return false;
536 }
537 }
538 if (!writer.writeListEnd()) {
539 return false;
540 }
541 return true;
542}
543
544// read TemperatureSensors field
545bool SensorRPCData::read_TemperatureSensors(yarp::os::idl::WireReader& reader)
546{
547 if (reader.noMore()) {
548 reader.fail();
549 return false;
550 }
551 size_t _csize;
553 reader.readListBegin(_etype, _csize);
554 // WireReader removes BOTTLE_TAG_LIST from the tag
555 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
556 if constexpr (expected_tag != 0) {
557 if (_csize != 0 && _etype.code != expected_tag) {
558 return false;
559 }
560 }
561 TemperatureSensors.resize(_csize);
562 for (size_t _i = 0; _i < _csize; ++_i) {
563 if (reader.noMore()) {
564 reader.fail();
565 return false;
566 }
567 if (!reader.readNested(TemperatureSensors[_i])) {
568 reader.fail();
569 return false;
570 }
571 }
572 reader.readListEnd();
573 return true;
574}
575
576// write TemperatureSensors field
577bool SensorRPCData::write_TemperatureSensors(const yarp::os::idl::WireWriter& writer) const
578{
580 return false;
581 }
582 for (const auto& _item : TemperatureSensors) {
583 if (!writer.writeNested(_item)) {
584 return false;
585 }
586 }
587 if (!writer.writeListEnd()) {
588 return false;
589 }
590 return true;
591}
592
593// read (nested) TemperatureSensors field
594bool SensorRPCData::nested_read_TemperatureSensors(yarp::os::idl::WireReader& reader)
595{
596 if (reader.noMore()) {
597 reader.fail();
598 return false;
599 }
600 size_t _csize;
602 reader.readListBegin(_etype, _csize);
603 // WireReader removes BOTTLE_TAG_LIST from the tag
604 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
605 if constexpr (expected_tag != 0) {
606 if (_csize != 0 && _etype.code != expected_tag) {
607 return false;
608 }
609 }
610 TemperatureSensors.resize(_csize);
611 for (size_t _i = 0; _i < _csize; ++_i) {
612 if (reader.noMore()) {
613 reader.fail();
614 return false;
615 }
616 if (!reader.readNested(TemperatureSensors[_i])) {
617 reader.fail();
618 return false;
619 }
620 }
621 reader.readListEnd();
622 return true;
623}
624
625// write (nested) TemperatureSensors field
626bool SensorRPCData::nested_write_TemperatureSensors(const yarp::os::idl::WireWriter& writer) const
627{
629 return false;
630 }
631 for (const auto& _item : TemperatureSensors) {
632 if (!writer.writeNested(_item)) {
633 return false;
634 }
635 }
636 if (!writer.writeListEnd()) {
637 return false;
638 }
639 return true;
640}
641
642// read SixAxisForceTorqueSensors field
643bool SensorRPCData::read_SixAxisForceTorqueSensors(yarp::os::idl::WireReader& reader)
644{
645 if (reader.noMore()) {
646 reader.fail();
647 return false;
648 }
649 size_t _csize;
651 reader.readListBegin(_etype, _csize);
652 // WireReader removes BOTTLE_TAG_LIST from the tag
653 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
654 if constexpr (expected_tag != 0) {
655 if (_csize != 0 && _etype.code != expected_tag) {
656 return false;
657 }
658 }
659 SixAxisForceTorqueSensors.resize(_csize);
660 for (size_t _i = 0; _i < _csize; ++_i) {
661 if (reader.noMore()) {
662 reader.fail();
663 return false;
664 }
665 if (!reader.readNested(SixAxisForceTorqueSensors[_i])) {
666 reader.fail();
667 return false;
668 }
669 }
670 reader.readListEnd();
671 return true;
672}
673
674// write SixAxisForceTorqueSensors field
675bool SensorRPCData::write_SixAxisForceTorqueSensors(const yarp::os::idl::WireWriter& writer) const
676{
678 return false;
679 }
680 for (const auto& _item : SixAxisForceTorqueSensors) {
681 if (!writer.writeNested(_item)) {
682 return false;
683 }
684 }
685 if (!writer.writeListEnd()) {
686 return false;
687 }
688 return true;
689}
690
691// read (nested) SixAxisForceTorqueSensors field
692bool SensorRPCData::nested_read_SixAxisForceTorqueSensors(yarp::os::idl::WireReader& reader)
693{
694 if (reader.noMore()) {
695 reader.fail();
696 return false;
697 }
698 size_t _csize;
700 reader.readListBegin(_etype, _csize);
701 // WireReader removes BOTTLE_TAG_LIST from the tag
702 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
703 if constexpr (expected_tag != 0) {
704 if (_csize != 0 && _etype.code != expected_tag) {
705 return false;
706 }
707 }
708 SixAxisForceTorqueSensors.resize(_csize);
709 for (size_t _i = 0; _i < _csize; ++_i) {
710 if (reader.noMore()) {
711 reader.fail();
712 return false;
713 }
714 if (!reader.readNested(SixAxisForceTorqueSensors[_i])) {
715 reader.fail();
716 return false;
717 }
718 }
719 reader.readListEnd();
720 return true;
721}
722
723// write (nested) SixAxisForceTorqueSensors field
724bool SensorRPCData::nested_write_SixAxisForceTorqueSensors(const yarp::os::idl::WireWriter& writer) const
725{
727 return false;
728 }
729 for (const auto& _item : SixAxisForceTorqueSensors) {
730 if (!writer.writeNested(_item)) {
731 return false;
732 }
733 }
734 if (!writer.writeListEnd()) {
735 return false;
736 }
737 return true;
738}
739
740// read ContactLoadCellArrays field
741bool SensorRPCData::read_ContactLoadCellArrays(yarp::os::idl::WireReader& reader)
742{
743 if (reader.noMore()) {
744 reader.fail();
745 return false;
746 }
747 size_t _csize;
749 reader.readListBegin(_etype, _csize);
750 // WireReader removes BOTTLE_TAG_LIST from the tag
751 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
752 if constexpr (expected_tag != 0) {
753 if (_csize != 0 && _etype.code != expected_tag) {
754 return false;
755 }
756 }
757 ContactLoadCellArrays.resize(_csize);
758 for (size_t _i = 0; _i < _csize; ++_i) {
759 if (reader.noMore()) {
760 reader.fail();
761 return false;
762 }
763 if (!reader.readNested(ContactLoadCellArrays[_i])) {
764 reader.fail();
765 return false;
766 }
767 }
768 reader.readListEnd();
769 return true;
770}
771
772// write ContactLoadCellArrays field
773bool SensorRPCData::write_ContactLoadCellArrays(const yarp::os::idl::WireWriter& writer) const
774{
776 return false;
777 }
778 for (const auto& _item : ContactLoadCellArrays) {
779 if (!writer.writeNested(_item)) {
780 return false;
781 }
782 }
783 if (!writer.writeListEnd()) {
784 return false;
785 }
786 return true;
787}
788
789// read (nested) ContactLoadCellArrays field
790bool SensorRPCData::nested_read_ContactLoadCellArrays(yarp::os::idl::WireReader& reader)
791{
792 if (reader.noMore()) {
793 reader.fail();
794 return false;
795 }
796 size_t _csize;
798 reader.readListBegin(_etype, _csize);
799 // WireReader removes BOTTLE_TAG_LIST from the tag
800 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
801 if constexpr (expected_tag != 0) {
802 if (_csize != 0 && _etype.code != expected_tag) {
803 return false;
804 }
805 }
806 ContactLoadCellArrays.resize(_csize);
807 for (size_t _i = 0; _i < _csize; ++_i) {
808 if (reader.noMore()) {
809 reader.fail();
810 return false;
811 }
812 if (!reader.readNested(ContactLoadCellArrays[_i])) {
813 reader.fail();
814 return false;
815 }
816 }
817 reader.readListEnd();
818 return true;
819}
820
821// write (nested) ContactLoadCellArrays field
822bool SensorRPCData::nested_write_ContactLoadCellArrays(const yarp::os::idl::WireWriter& writer) const
823{
825 return false;
826 }
827 for (const auto& _item : ContactLoadCellArrays) {
828 if (!writer.writeNested(_item)) {
829 return false;
830 }
831 }
832 if (!writer.writeListEnd()) {
833 return false;
834 }
835 return true;
836}
837
838// read EncoderArrays field
839bool SensorRPCData::read_EncoderArrays(yarp::os::idl::WireReader& reader)
840{
841 if (reader.noMore()) {
842 reader.fail();
843 return false;
844 }
845 size_t _csize;
847 reader.readListBegin(_etype, _csize);
848 // WireReader removes BOTTLE_TAG_LIST from the tag
849 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
850 if constexpr (expected_tag != 0) {
851 if (_csize != 0 && _etype.code != expected_tag) {
852 return false;
853 }
854 }
855 EncoderArrays.resize(_csize);
856 for (size_t _i = 0; _i < _csize; ++_i) {
857 if (reader.noMore()) {
858 reader.fail();
859 return false;
860 }
861 if (!reader.readNested(EncoderArrays[_i])) {
862 reader.fail();
863 return false;
864 }
865 }
866 reader.readListEnd();
867 return true;
868}
869
870// write EncoderArrays field
871bool SensorRPCData::write_EncoderArrays(const yarp::os::idl::WireWriter& writer) const
872{
873 if (!writer.writeListBegin(BOTTLE_TAG_LIST, EncoderArrays.size())) {
874 return false;
875 }
876 for (const auto& _item : EncoderArrays) {
877 if (!writer.writeNested(_item)) {
878 return false;
879 }
880 }
881 if (!writer.writeListEnd()) {
882 return false;
883 }
884 return true;
885}
886
887// read (nested) EncoderArrays field
888bool SensorRPCData::nested_read_EncoderArrays(yarp::os::idl::WireReader& reader)
889{
890 if (reader.noMore()) {
891 reader.fail();
892 return false;
893 }
894 size_t _csize;
896 reader.readListBegin(_etype, _csize);
897 // WireReader removes BOTTLE_TAG_LIST from the tag
898 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
899 if constexpr (expected_tag != 0) {
900 if (_csize != 0 && _etype.code != expected_tag) {
901 return false;
902 }
903 }
904 EncoderArrays.resize(_csize);
905 for (size_t _i = 0; _i < _csize; ++_i) {
906 if (reader.noMore()) {
907 reader.fail();
908 return false;
909 }
910 if (!reader.readNested(EncoderArrays[_i])) {
911 reader.fail();
912 return false;
913 }
914 }
915 reader.readListEnd();
916 return true;
917}
918
919// write (nested) EncoderArrays field
920bool SensorRPCData::nested_write_EncoderArrays(const yarp::os::idl::WireWriter& writer) const
921{
922 if (!writer.writeListBegin(BOTTLE_TAG_LIST, EncoderArrays.size())) {
923 return false;
924 }
925 for (const auto& _item : EncoderArrays) {
926 if (!writer.writeNested(_item)) {
927 return false;
928 }
929 }
930 if (!writer.writeListEnd()) {
931 return false;
932 }
933 return true;
934}
935
936// read SkinPatches field
937bool SensorRPCData::read_SkinPatches(yarp::os::idl::WireReader& reader)
938{
939 if (reader.noMore()) {
940 reader.fail();
941 return false;
942 }
943 size_t _csize;
945 reader.readListBegin(_etype, _csize);
946 // WireReader removes BOTTLE_TAG_LIST from the tag
947 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
948 if constexpr (expected_tag != 0) {
949 if (_csize != 0 && _etype.code != expected_tag) {
950 return false;
951 }
952 }
953 SkinPatches.resize(_csize);
954 for (size_t _i = 0; _i < _csize; ++_i) {
955 if (reader.noMore()) {
956 reader.fail();
957 return false;
958 }
959 if (!reader.readNested(SkinPatches[_i])) {
960 reader.fail();
961 return false;
962 }
963 }
964 reader.readListEnd();
965 return true;
966}
967
968// write SkinPatches field
969bool SensorRPCData::write_SkinPatches(const yarp::os::idl::WireWriter& writer) const
970{
971 if (!writer.writeListBegin(BOTTLE_TAG_LIST, SkinPatches.size())) {
972 return false;
973 }
974 for (const auto& _item : SkinPatches) {
975 if (!writer.writeNested(_item)) {
976 return false;
977 }
978 }
979 if (!writer.writeListEnd()) {
980 return false;
981 }
982 return true;
983}
984
985// read (nested) SkinPatches field
986bool SensorRPCData::nested_read_SkinPatches(yarp::os::idl::WireReader& reader)
987{
988 if (reader.noMore()) {
989 reader.fail();
990 return false;
991 }
992 size_t _csize;
994 reader.readListBegin(_etype, _csize);
995 // WireReader removes BOTTLE_TAG_LIST from the tag
996 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
997 if constexpr (expected_tag != 0) {
998 if (_csize != 0 && _etype.code != expected_tag) {
999 return false;
1000 }
1001 }
1002 SkinPatches.resize(_csize);
1003 for (size_t _i = 0; _i < _csize; ++_i) {
1004 if (reader.noMore()) {
1005 reader.fail();
1006 return false;
1007 }
1008 if (!reader.readNested(SkinPatches[_i])) {
1009 reader.fail();
1010 return false;
1011 }
1012 }
1013 reader.readListEnd();
1014 return true;
1015}
1016
1017// write (nested) SkinPatches field
1018bool SensorRPCData::nested_write_SkinPatches(const yarp::os::idl::WireWriter& writer) const
1019{
1020 if (!writer.writeListBegin(BOTTLE_TAG_LIST, SkinPatches.size())) {
1021 return false;
1022 }
1023 for (const auto& _item : SkinPatches) {
1024 if (!writer.writeNested(_item)) {
1025 return false;
1026 }
1027 }
1028 if (!writer.writeListEnd()) {
1029 return false;
1030 }
1031 return true;
1032}
1033
1034// read PositionSensors field
1035bool SensorRPCData::read_PositionSensors(yarp::os::idl::WireReader& reader)
1036{
1037 if (reader.noMore()) {
1038 reader.fail();
1039 return false;
1040 }
1041 size_t _csize;
1043 reader.readListBegin(_etype, _csize);
1044 // WireReader removes BOTTLE_TAG_LIST from the tag
1045 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
1046 if constexpr (expected_tag != 0) {
1047 if (_csize != 0 && _etype.code != expected_tag) {
1048 return false;
1049 }
1050 }
1051 PositionSensors.resize(_csize);
1052 for (size_t _i = 0; _i < _csize; ++_i) {
1053 if (reader.noMore()) {
1054 reader.fail();
1055 return false;
1056 }
1057 if (!reader.readNested(PositionSensors[_i])) {
1058 reader.fail();
1059 return false;
1060 }
1061 }
1062 reader.readListEnd();
1063 return true;
1064}
1065
1066// write PositionSensors field
1067bool SensorRPCData::write_PositionSensors(const yarp::os::idl::WireWriter& writer) const
1068{
1069 if (!writer.writeListBegin(BOTTLE_TAG_LIST, PositionSensors.size())) {
1070 return false;
1071 }
1072 for (const auto& _item : PositionSensors) {
1073 if (!writer.writeNested(_item)) {
1074 return false;
1075 }
1076 }
1077 if (!writer.writeListEnd()) {
1078 return false;
1079 }
1080 return true;
1081}
1082
1083// read (nested) PositionSensors field
1084bool SensorRPCData::nested_read_PositionSensors(yarp::os::idl::WireReader& reader)
1085{
1086 if (reader.noMore()) {
1087 reader.fail();
1088 return false;
1089 }
1090 size_t _csize;
1092 reader.readListBegin(_etype, _csize);
1093 // WireReader removes BOTTLE_TAG_LIST from the tag
1094 constexpr int expected_tag = ((BOTTLE_TAG_LIST) & (~BOTTLE_TAG_LIST));
1095 if constexpr (expected_tag != 0) {
1096 if (_csize != 0 && _etype.code != expected_tag) {
1097 return false;
1098 }
1099 }
1100 PositionSensors.resize(_csize);
1101 for (size_t _i = 0; _i < _csize; ++_i) {
1102 if (reader.noMore()) {
1103 reader.fail();
1104 return false;
1105 }
1106 if (!reader.readNested(PositionSensors[_i])) {
1107 reader.fail();
1108 return false;
1109 }
1110 }
1111 reader.readListEnd();
1112 return true;
1113}
1114
1115// write (nested) PositionSensors field
1116bool SensorRPCData::nested_write_PositionSensors(const yarp::os::idl::WireWriter& writer) const
1117{
1118 if (!writer.writeListBegin(BOTTLE_TAG_LIST, PositionSensors.size())) {
1119 return false;
1120 }
1121 for (const auto& _item : PositionSensors) {
1122 if (!writer.writeNested(_item)) {
1123 return false;
1124 }
1125 }
1126 if (!writer.writeListEnd()) {
1127 return false;
1128 }
1129 return true;
1130}
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
@ ThreeAxisLinearAccelerometers
std::vector< SensorMetadata > SkinPatches
Definition: SensorRPCData.h:31
bool read(yarp::os::idl::WireReader &reader) override
std::vector< SensorMetadata > ContactLoadCellArrays
Definition: SensorRPCData.h:29
std::string toString() const
bool write(const yarp::os::idl::WireWriter &writer) const override
std::vector< SensorMetadata > EncoderArrays
Definition: SensorRPCData.h:30
std::vector< SensorMetadata > PositionSensors
Definition: SensorRPCData.h:32
std::vector< SensorMetadata > ThreeAxisGyroscopes
Definition: SensorRPCData.h:23
std::vector< SensorMetadata > ThreeAxisLinearAccelerometers
Definition: SensorRPCData.h:24
std::vector< SensorMetadata > ThreeAxisMagnetometers
Definition: SensorRPCData.h:25
std::vector< SensorMetadata > OrientationSensors
Definition: SensorRPCData.h:26
SensorRPCData()=default
std::vector< SensorMetadata > SixAxisForceTorqueSensors
Definition: SensorRPCData.h:28
std::vector< SensorMetadata > TemperatureSensors
Definition: SensorRPCData.h:27
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:64
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Definition: Bottle.cpp:211
An interface for reading from a network connection.
An interface for writing to a network connection.
static bool copyPortable(const PortWriter &writer, PortReader &reader)
Copy one portable to another, via writing and reading.
Definition: Portable.cpp:16
IDL-friendly connection reader.
Definition: WireReader.h:27
bool readNested(WirePortable &obj)
Definition: WireReader.cpp:82
void readListBegin(yarp::os::idl::WireState &nstate, size_t &len)
Definition: WireReader.cpp:598
IDL-friendly state.
Definition: WireState.h:17
IDL-friendly connection writer.
Definition: WireWriter.h:28
bool writeListHeader(int len) const
Definition: WireWriter.cpp:231
bool writeNested(const WirePortable &obj) const
Definition: WireWriter.cpp:60
bool writeListBegin(int tag, size_t len) const
Definition: WireWriter.cpp:251