YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Storable.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-FileCopyrightText: 2006, 2008 Arjan Gijsberts
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef YARP_OS_IMPL_STORABLE_H
9#define YARP_OS_IMPL_STORABLE_H
10
11
12#include <yarp/os/Log.h>
14#include <yarp/os/Value.h>
15#include <yarp/os/Vocab.h>
16#include <yarp/os/Vocab64.h>
17
18
19#define UNIT_MASK \
20 (BOTTLE_TAG_INT8 | \
21 BOTTLE_TAG_INT16 | \
22 BOTTLE_TAG_INT32 | \
23 BOTTLE_TAG_INT64 | \
24 BOTTLE_TAG_FLOAT32 | \
25 BOTTLE_TAG_FLOAT64 | \
26 BOTTLE_TAG_VOCAB32 | \
27 BOTTLE_TAG_VOCAB64 | \
28 BOTTLE_TAG_STRING | \
29 BOTTLE_TAG_BLOB)
30
31#define GROUP_MASK \
32 (BOTTLE_TAG_LIST)
33
35
36namespace yarp::os::impl {
37
43{
44public:
48 virtual ~Storable();
49
53 virtual Storable* createStorable() const = 0;
54
58 virtual Storable* cloneStorable() const
59 {
60 Storable* item = createStorable();
61 yCAssert(STORABLE, item != nullptr);
62 item->copy(*this);
63 return item;
64 }
65
69 virtual void copy(const Storable& alt) = 0;
70
71 bool operator==(const yarp::os::Value& alt) const;
72
73 yarp::os::Value* create() const override
74 {
75 return createStorable();
76 }
77
78 yarp::os::Value* clone() const override
79 {
80 return cloneStorable();
81 }
82
83 static Storable* createByCode(std::int32_t id);
84
85
86 bool read(ConnectionReader& connection) override;
87 bool write(ConnectionWriter& connection) const override;
88
89 virtual bool readRaw(ConnectionReader& connection) = 0;
90 virtual bool writeRaw(ConnectionWriter& connection) const = 0;
91
92 bool isBool() const override
93 {
94 return false;
95 }
96
97 bool asBool() const override
98 {
99 return false;
100 }
101
102 bool isInt8() const override
103 {
104 return false;
105 }
106
107 std::int8_t asInt8() const override
108 {
109 return 0;
110 }
111
112 bool isInt16() const override
113 {
114 return false;
115 }
116
117 std::int16_t asInt16() const override
118 {
119 return 0;
120 }
121
122 bool isInt32() const override
123 {
124 return false;
125 }
126
127 std::int32_t asInt32() const override
128 {
129 return 0;
130 }
131
132 bool isInt64() const override
133 {
134 return false;
135 }
136
137 std::int64_t asInt64() const override
138 {
139 return 0;
140 }
141
142 bool isFloat32() const override
143 {
144 return false;
145 }
146
148 {
149 return 0.0f;
150 }
151
152 bool isFloat64() const override
153 {
154 return false;
155 }
156
158 {
159 return 0.0;
160 }
161
162 bool isString() const override
163 {
164 return false;
165 }
166
167 std::string asString() const override
168 {
169 return {};
170 }
171
172 bool isList() const override
173 {
174 return false;
175 }
176
177 yarp::os::Bottle* asList() const override
178 {
179 return nullptr;
180 }
181
182 bool isVocab32() const override
183 {
184 return false;
185 }
186
187 bool isVocab64() const override
188 {
189 return false;
190 }
191
193 {
194 return 0;
195 }
196
198 {
199 return 0;
200 }
201
202 bool isBlob() const override
203 {
204 return false;
205 }
206
207 const char* asBlob() const override
208 {
209 return static_cast<const char*>(nullptr);
210 }
211
212 size_t asBlobLength() const override
213 {
214 return 0;
215 }
216
217 bool isNull() const override
218 {
219 return false;
220 }
221
223 bool check(const std::string& key) const override;
224
225 yarp::os::Value& find(const std::string& key) const override;
226 yarp::os::Bottle& findGroup(const std::string& key) const override;
227
228
234 virtual void fromString(const std::string& src) = 0;
235
241 virtual void fromStringNested(const std::string& src)
242 {
243 fromString(src);
244 }
245
246 std::string toString() const override = 0;
247
252 virtual std::string toStringNested() const
253 {
254 return toString();
255 }
256
260 virtual std::int32_t subCode() const
261 {
262 return 0;
263 }
264
265 bool isLeaf() const override
266 {
267 return true;
268 }
269};
270
271
276 public Storable
277{
278public:
279 StoreNull() = default;
280
281 Storable* createStorable() const override
282 {
283 return new StoreNull();
284 }
285
286 void copy(const Storable& alt) override
287 {
289 }
290
291 std::string toString() const override
292 {
293 return {};
294 }
295
296 void fromString(const std::string& src) override
297 {
298 YARP_UNUSED(src);
299 }
300
301 std::int32_t getCode() const override
302 {
303 return -1;
304 }
305
306 bool readRaw(ConnectionReader& connection) override
307 {
308 YARP_UNUSED(connection);
309 return false;
310 }
311
312 bool writeRaw(ConnectionWriter& connection) const override
313 {
314 YARP_UNUSED(connection);
315 return false;
316 }
317
318 bool isNull() const override
319 {
320 return true;
321 }
322};
323
324
329 public Storable
330{
331private:
332 std::int8_t x{0};
333
334public:
335 StoreInt8() = default;
336
337 StoreInt8(std::int8_t x) :
338 x(x)
339 {
340 }
341
342 Storable* createStorable() const override
343 {
344 return new StoreInt8();
345 }
346
347 void copy(const Storable& alt) override
348 {
349 x = alt.asInt8();
350 }
351
352 std::string toString() const override;
353 void fromString(const std::string& src) override;
354
355 static const std::int32_t code;
356 std::int32_t getCode() const override
357 {
358 return code;
359 }
360
361 bool readRaw(ConnectionReader& reader) override;
362 bool writeRaw(ConnectionWriter& writer) const override;
363
364 bool isInt8() const override
365 {
366 return true;
367 }
368
369 bool asBool() const override
370 {
371 return x != 0;
372 }
373
374 std::int8_t asInt8() const override
375 {
376 return x;
377 }
378
379 std::int16_t asInt16() const override
380 {
381 return x;
382 }
383
384 std::int32_t asInt32() const override
385 {
386 return x;
387 }
388
389 std::int64_t asInt64() const override
390 {
391 return x;
392 }
393
395 {
396 return x;
397 }
398
400 {
401 return x;
402 }
403
405 {
406 return x;
407 }
408};
409
410
415 public Storable
416{
417private:
418 std::int16_t x{0};
419
420public:
421 StoreInt16() = default;
422
423 StoreInt16(std::int16_t x) :
424 x(x)
425 {
426 }
427
428 Storable* createStorable() const override
429 {
430 return new StoreInt16();
431 }
432
433 void copy(const Storable& alt) override
434 {
435 x = alt.asInt16();
436 }
437
438 std::string toString() const override;
439 void fromString(const std::string& src) override;
440
441 static const std::int32_t code;
442 std::int32_t getCode() const override
443 {
444 return code;
445 }
446
447 bool readRaw(ConnectionReader& reader) override;
448 bool writeRaw(ConnectionWriter& writer) const override;
449
450 bool isInt16() const override
451 {
452 return true;
453 }
454
455 bool asBool() const override
456 {
457 return x != 0;
458 }
459
460 std::int8_t asInt8() const override
461 {
462 return static_cast<std::int8_t>(x);
463 }
464
465 std::int16_t asInt16() const override
466 {
467 return x;
468 }
469
470 std::int32_t asInt32() const override
471 {
472 return x;
473 }
474
475 std::int64_t asInt64() const override
476 {
477 return x;
478 }
479
481 {
482 return x;
483 }
484
486 {
487 return x;
488 }
489
491 {
492 return x;
493 }
494};
495
496
501 public Storable
502{
503private:
504 std::int32_t x{0};
505
506public:
507 StoreInt32() = default;
508
509 StoreInt32(std::int32_t x) :
510 x(x)
511 {
512 }
513
514 Storable* createStorable() const override
515 {
516 return new StoreInt32();
517 }
518
519 void copy(const Storable& alt) override
520 {
521 x = alt.asInt32();
522 }
523
524 std::string toString() const override;
525 void fromString(const std::string& src) override;
526
527 static const std::int32_t code;
528 std::int32_t getCode() const override
529 {
530 return code;
531 }
532
533 bool readRaw(ConnectionReader& reader) override;
534 bool writeRaw(ConnectionWriter& writer) const override;
535
536 std::int8_t asInt8() const override
537 {
538 return static_cast<std::int8_t>(x);
539 }
540
541 bool asBool() const override
542 {
543 return x != 0;
544 }
545
546 std::int16_t asInt16() const override
547 {
548 return static_cast<std::int16_t>(x);
549 }
550
551 bool isInt32() const override
552 {
553 return true;
554 }
555
556 std::int32_t asInt32() const override
557 {
558 return x;
559 }
560
561 std::int64_t asInt64() const override
562 {
563 return x;
564 }
565
567 {
568 return static_cast<yarp::conf::float32_t>(x);
569 }
570
572 {
573 return x;
574 }
575
577 {
578 return x;
579 }
580};
581
586 public Storable
587{
588private:
589 std::int64_t x{0};
590
591public:
592 StoreInt64() = default;
593
594 StoreInt64(std::int64_t x) :
595 x(x)
596 {
597 }
598
599 Storable* createStorable() const override
600 {
601 return new StoreInt64();
602 }
603
604 void copy(const Storable& alt) override
605 {
606 x = alt.asInt64();
607 }
608
609 std::string toString() const override;
610 void fromString(const std::string& src) override;
611
612 static const std::int32_t code;
613 std::int32_t getCode() const override
614 {
615 return code;
616 }
617
618 bool readRaw(ConnectionReader& reader) override;
619 bool writeRaw(ConnectionWriter& writer) const override;
620
621 bool isInt64() const override
622 {
623 return true;
624 }
625
626 bool asBool() const override
627 {
628 return x != 0;
629 }
630
631 std::int8_t asInt8() const override
632 {
633 return static_cast<std::int8_t>(x);
634 }
635
636 std::int16_t asInt16() const override
637 {
638 return static_cast<std::int16_t>(x);
639 }
640
641 std::int32_t asInt32() const override
642 {
643 return static_cast<std::int32_t>(x);
644 }
645
646 std::int64_t asInt64() const override
647 {
648 return x;
649 }
650
652 {
653 return static_cast<yarp::conf::float32_t>(x);
654 }
655
657 {
658 return static_cast<yarp::conf::float64_t>(x);
659 }
660
662 {
663 return static_cast<yarp::conf::vocab32_t>(x);
664 }
665};
666
671 public Storable
672{
673private:
674 yarp::conf::float32_t x{0.0f};
675
676public:
677 StoreFloat32() = default;
678
680 x(x)
681 {
682 }
683
684 Storable* createStorable() const override
685 {
686 return new StoreFloat32();
687 }
688
689 void copy(const Storable& alt) override
690 {
691 x = alt.asFloat32();
692 }
693
694 std::string toString() const override;
695 void fromString(const std::string& src) override;
696
697 static const std::int32_t code;
698 std::int32_t getCode() const override
699 {
700 return code;
701 }
702
703 bool readRaw(ConnectionReader& reader) override;
704 bool writeRaw(ConnectionWriter& writer) const override;
705
706 bool isFloat32() const override
707 {
708 return true;
709 }
710
711 std::int8_t asInt8() const override
712 {
713 return static_cast<std::int8_t>(x);
714 }
715
716 std::int16_t asInt16() const override
717 {
718 return static_cast<std::int16_t>(x);
719 }
720
721 std::int32_t asInt32() const override
722 {
723 return static_cast<std::int32_t>(x);
724 }
725
726 std::int64_t asInt64() const override
727 {
728 return static_cast<std::int64_t>(x);
729 }
730
732 {
733 return x;
734 }
735
737 {
738 return x;
739 }
740};
741
746 public Storable
747{
748private:
750
751public:
752 StoreFloat64() = default;
753
755 x(x)
756 {
757 }
758
759 Storable* createStorable() const override
760 {
761 return new StoreFloat64();
762 }
763
764 void copy(const Storable& alt) override
765 {
766 x = alt.asFloat64();
767 }
768
769 std::string toString() const override;
770 void fromString(const std::string& src) override;
771
772 static const std::int32_t code;
773 std::int32_t getCode() const override
774 {
775 return code;
776 }
777
778 bool readRaw(ConnectionReader& reader) override;
779 bool writeRaw(ConnectionWriter& writer) const override;
780
781 bool isFloat64() const override
782 {
783 return true;
784 }
785
786 std::int8_t asInt8() const override
787 {
788 return static_cast<std::int8_t>(x);
789 }
790
791 std::int16_t asInt16() const override
792 {
793 return static_cast<std::int16_t>(x);
794 }
795
796 std::int32_t asInt32() const override
797 {
798 return static_cast<std::int32_t>(x);
799 }
800
801 std::int64_t asInt64() const override
802 {
803 return static_cast<std::int64_t>(x);
804 }
805
807 {
808 return static_cast<yarp::conf::float32_t>(x);
809 }
810
812 {
813 return x;
814 }
815};
816
821 public Storable
822{
824
825public:
826 StoreVocab32() = default;
827
829 x(x)
830 {
831 }
832
833 Storable* createStorable() const override
834 {
835 return new StoreVocab32();
836 }
837
838 void copy(const Storable& alt) override
839 {
840 x = alt.asVocab32();
841 }
842
843 std::string toString() const override;
844 void fromString(const std::string& src) override;
845 std::string toStringNested() const override;
846 void fromStringNested(const std::string& src) override;
847
848 static const std::int32_t code;
849 std::int32_t getCode() const override
850 {
851 return code;
852 }
853
854 bool readRaw(ConnectionReader& reader) override;
855 bool writeRaw(ConnectionWriter& writer) const override;
856
857 bool isBool() const override
858 {
859 return (x == 0 || x == '1');
860 }
861
862 bool asBool() const override
863 {
864 return x != 0;
865 }
866
867 std::int32_t asInt32() const override
868 {
869 return x;
870 }
871
872 std::int64_t asInt64() const override
873 {
874 return x;
875 }
876
878 {
879 return static_cast<yarp::conf::float32_t>(x);
880 }
881
883 {
884 return x;
885 }
886
887 bool isVocab32() const override
888 {
889 return true;
890 }
891
893 {
894 return x;
895 }
896
897 std::string asString() const override
898 {
899 return toString();
900 }
901};
902
907 public Storable
908{
910
911public:
912 StoreVocab64() = default;
913
915 x(x)
916 {
917 }
918
919 Storable* createStorable() const override
920 {
921 return new StoreVocab64();
922 }
923
924 void copy(const Storable& alt) override
925 {
926 x = alt.asVocab64();
927 }
928
929 std::string toString() const override;
930 void fromString(const std::string& src) override;
931 std::string toStringNested() const override;
932 void fromStringNested(const std::string& src) override;
933
934 static const std::int32_t code;
935 std::int32_t getCode() const override
936 {
937 return code;
938 }
939
940 bool readRaw(ConnectionReader& reader) override;
941 bool writeRaw(ConnectionWriter& writer) const override;
942
943 bool isBool() const override
944 {
945 return (x == 0 || x == '1');
946 }
947
948 bool asBool() const override
949 {
950 return x != 0;
951 }
952
953 std::int32_t asInt32() const override
954 {
955 return x;
956 }
957
958 std::int64_t asInt64() const override
959 {
960 return x;
961 }
962
964 {
965 return static_cast<yarp::conf::float32_t>(x);
966 }
967
969 {
970 return x;
971 }
972
973 bool isVocab64() const override
974 {
975 return true;
976 }
977
979 {
980 return x;
981 }
982
983 std::string asString() const override
984 {
985 return toString();
986 }
987};
988
993 public Storable
994{
995private:
997
998public:
999 StoreString() = default;
1000
1001 StoreString(const std::string& x)
1002 {
1003 this->x = x;
1004 }
1005
1006 Storable* createStorable() const override
1007 {
1008 return new StoreString();
1009 }
1010
1011 void copy(const Storable& alt) override
1012 {
1013 x = alt.asString();
1014 }
1015
1016 std::string toString() const override;
1017 void fromString(const std::string& src) override;
1018 std::string toStringNested() const override;
1019 void fromStringNested(const std::string& src) override;
1020
1021 static const std::int32_t code;
1022 std::int32_t getCode() const override
1023 {
1024 return code;
1025 }
1026
1027 bool readRaw(ConnectionReader& reader) override;
1028 bool writeRaw(ConnectionWriter& writer) const override;
1029
1030 bool isString() const override
1031 {
1032 return true;
1033 }
1034
1035 std::string asString() const override
1036 {
1037 return x;
1038 }
1039
1041 {
1042 return yarp::os::Vocab32::encode(x);
1043 }
1044
1045 // Quote and escape a string for printing it nested
1046 static std::string quotedString(const std::string& x);
1047};
1048
1053 public Storable
1054{
1055private:
1057
1058public:
1059 StoreBlob() = default;
1060
1061 StoreBlob(const std::string& x)
1062 {
1063 this->x = x;
1064 }
1065
1066 Storable* createStorable() const override
1067 {
1068 return new StoreBlob();
1069 }
1070
1071 void copy(const Storable& alt) override
1072 {
1073 if (alt.isBlob()) {
1074 std::string tmp((char*)alt.asBlob(), alt.asBlobLength());
1075 x = tmp;
1076 } else {
1077 x = std::string();
1078 }
1079 }
1080
1081 std::string toString() const override;
1082 void fromString(const std::string& src) override;
1083 std::string toStringNested() const override;
1084 void fromStringNested(const std::string& src) override;
1085
1086 static const std::int32_t code;
1087 std::int32_t getCode() const override
1088 {
1089 return code;
1090 }
1091
1092 bool readRaw(ConnectionReader& reader) override;
1093 bool writeRaw(ConnectionWriter& writer) const override;
1094
1095 bool isBlob() const override
1096 {
1097 return true;
1098 }
1099
1100 const char* asBlob() const override
1101 {
1102 return x.c_str();
1103 }
1104
1105 size_t asBlobLength() const override
1106 {
1107 return x.length();
1108 }
1109};
1110
1111
1116 public Storable
1117{
1118private:
1119 yarp::os::Bottle content{};
1120
1121public:
1122 StoreList() = default;
1123
1124 Storable* createStorable() const override
1125 {
1126 return new StoreList();
1127 }
1128
1129 void copy(const Storable& alt) override
1130 {
1131 content = *(alt.asList());
1132 }
1133
1135 {
1136 return content;
1137 }
1138
1139 std::string toString() const override;
1140 void fromString(const std::string& src) override;
1141 std::string toStringNested() const override;
1142 void fromStringNested(const std::string& src) override;
1143
1144 static const std::int32_t code;
1145 std::int32_t getCode() const override
1146 {
1147 return code + subCode();
1148 }
1149
1150 bool readRaw(ConnectionReader& reader) override;
1151 bool writeRaw(ConnectionWriter& writer) const override;
1152
1153 bool isList() const override
1154 {
1155 return true;
1156 }
1157
1158 yarp::os::Bottle* asList() const override
1159 {
1160 return (yarp::os::Bottle*)(&content);
1161 }
1162
1163 std::int32_t subCode() const override;
1164
1165 yarp::os::Value& find(const std::string& key) const override
1166 {
1167 return content.find(key);
1168 }
1169
1170 yarp::os::Bottle& findGroup(const std::string& key) const override
1171 {
1172 return content.findGroup(key);
1173 }
1174};
1175
1176template <typename T>
1177inline std::int32_t subCoder(T& content)
1178{
1179 std::int32_t c = -1;
1180 bool ok = false;
1181 for (unsigned int i = 0; i < content.size(); ++i) {
1182 std::int32_t sc = content.get(i).getCode();
1183 if (c == -1) {
1184 c = sc;
1185 ok = true;
1186 }
1187 if (sc != c) {
1188 ok = false;
1189 }
1190 }
1191 // just optimize primitive types
1192 if ((c & GROUP_MASK) != 0) {
1193 ok = false;
1194 }
1195 c = ok ? c : 0;
1196 content.specialize(c);
1197 return c;
1198}
1199
1200} // namespace yarp::os::impl
1201
1202#endif // YARP_OS_IMPL_STORABLE_H
bool operator==(const struct v4l2_control &left, const struct v4l2_control &right)
Definition CApiMock.h:65
std::string toString(const T &value)
convert an arbitrary type to string.
const yarp::os::LogComponent & STORABLE()
Definition Storable.cpp:42
const yarp::os::LogComponent & STORABLE()
Definition Storable.cpp:42
#define GROUP_MASK
Definition Storable.h:31
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
Definition Bottle.cpp:294
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
An interface for writing to a network connection.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
Definition Value.h:44
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Definition Value.cpp:318
A single item in a Bottle.
Definition Storable.h:43
virtual Storable * createStorable() const =0
Factory method.
size_t asBlobLength() const override
Get binary data length.
Definition Storable.h:212
virtual std::string toStringNested() const
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Definition Storable.h:252
std::int8_t asInt8() const override
Get 8-bit integer value.
Definition Storable.h:107
virtual ~Storable()
Destructor.
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:137
bool isVocab32() const override
Checks if value is a 32bit vocabulary identifier.
Definition Storable.h:182
bool isList() const override
Checks if value is a list.
Definition Storable.h:172
bool isInt16() const override
Checks if value is a 16-bit integer.
Definition Storable.h:112
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:157
virtual bool writeRaw(ConnectionWriter &connection) const =0
bool isNull() const override
Checks if the object is invalid.
Definition Storable.h:217
const char * asBlob() const override
Get binary data value.
Definition Storable.h:207
std::string asString() const override
Get string value.
Definition Storable.h:167
yarp::os::Value * clone() const override
Create a copy of the value.
Definition Storable.h:78
bool isBlob() const override
Checks if value is a binary object.
Definition Storable.h:202
virtual void fromStringNested(const std::string &src)
Initialize from a string representation.
Definition Storable.h:241
bool isVocab64() const override
Checks if value is a 64bit vocabulary identifier.
Definition Storable.h:187
virtual void fromString(const std::string &src)=0
Initialize from a string representation, assuming that any syntax around this representation such as ...
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:147
bool isFloat32() const override
Checks if value is a 32-bit floating point number.
Definition Storable.h:142
bool isBool() const override
Checks if value is a boolean.
Definition Storable.h:92
std::string toString() const override=0
Return a standard text representation of the content of the object.
virtual std::int32_t subCode() const
Return a code describing this item, used in serializing bottles.
Definition Storable.h:260
bool asBool() const override
Get boolean value.
Definition Storable.h:97
bool isString() const override
Checks if value is a string.
Definition Storable.h:162
virtual void copy(const Storable &alt)=0
Become a copy of the passed item.
virtual Storable * cloneStorable() const
Typed synonym for clone()
Definition Storable.h:58
bool isInt32() const override
Checks if value is a 32-bit integer.
Definition Storable.h:122
bool isInt8() const override
Checks if value is a 8-bit integer.
Definition Storable.h:102
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Definition Storable.h:192
yarp::os::Bottle * asList() const override
Get list value.
Definition Storable.h:177
bool isInt64() const override
Checks if value is a 64-bit integer.
Definition Storable.h:132
yarp::conf::vocab64_t asVocab64() const override
Get 64 bit vocabulary identifier as an integer.
Definition Storable.h:197
virtual bool readRaw(ConnectionReader &connection)=0
bool isLeaf() const override
Definition Storable.h:265
bool isFloat64() const override
Checks if value is a 64-bit floating point number.
Definition Storable.h:152
yarp::os::Value * create() const override
Create a new value of the same type.
Definition Storable.h:73
std::int16_t asInt16() const override
Get 16-bit integer value.
Definition Storable.h:117
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:127
A binary blob item.
Definition Storable.h:1054
bool isBlob() const override
Checks if value is a binary object.
Definition Storable.h:1095
Storable * createStorable() const override
Factory method.
Definition Storable.h:1066
size_t asBlobLength() const override
Get binary data length.
Definition Storable.h:1105
static const std::int32_t code
Definition Storable.h:1086
StoreBlob(const std::string &x)
Definition Storable.h:1061
const char * asBlob() const override
Get binary data value.
Definition Storable.h:1100
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:1071
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:1087
A 32-bit floating point number item.
Definition Storable.h:672
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:736
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:731
bool isFloat32() const override
Checks if value is a 32-bit floating point number.
Definition Storable.h:706
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:689
std::int8_t asInt8() const override
Get 8-bit integer value.
Definition Storable.h:711
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:726
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:698
static const std::int32_t code
Definition Storable.h:697
std::int16_t asInt16() const override
Get 16-bit integer value.
Definition Storable.h:716
StoreFloat32(yarp::conf::float32_t x)
Definition Storable.h:679
Storable * createStorable() const override
Factory method.
Definition Storable.h:684
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:721
A 64-bit floating point number item.
Definition Storable.h:747
StoreFloat64(yarp::conf::float64_t x)
Definition Storable.h:754
std::int16_t asInt16() const override
Get 16-bit integer value.
Definition Storable.h:791
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:801
bool isFloat64() const override
Checks if value is a 64-bit floating point number.
Definition Storable.h:781
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:796
Storable * createStorable() const override
Factory method.
Definition Storable.h:759
std::int8_t asInt8() const override
Get 8-bit integer value.
Definition Storable.h:786
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:811
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:764
static const std::int32_t code
Definition Storable.h:772
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:806
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:773
A 16-bit integer item.
Definition Storable.h:416
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Definition Storable.h:490
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:480
bool asBool() const override
Get boolean value.
Definition Storable.h:455
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:442
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:433
static const std::int32_t code
Definition Storable.h:441
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:485
std::int8_t asInt8() const override
Get 8-bit integer value.
Definition Storable.h:460
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:470
bool isInt16() const override
Checks if value is a 16-bit integer.
Definition Storable.h:450
Storable * createStorable() const override
Factory method.
Definition Storable.h:428
std::int16_t asInt16() const override
Get 16-bit integer value.
Definition Storable.h:465
StoreInt16(std::int16_t x)
Definition Storable.h:423
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:475
A 32-bit integer item.
Definition Storable.h:502
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:528
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:566
StoreInt32(std::int32_t x)
Definition Storable.h:509
bool isInt32() const override
Checks if value is a 32-bit integer.
Definition Storable.h:551
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:571
std::int8_t asInt8() const override
Get 8-bit integer value.
Definition Storable.h:536
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:556
bool asBool() const override
Get boolean value.
Definition Storable.h:541
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Definition Storable.h:576
Storable * createStorable() const override
Factory method.
Definition Storable.h:514
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:561
static const std::int32_t code
Definition Storable.h:527
std::int16_t asInt16() const override
Get 16-bit integer value.
Definition Storable.h:546
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:519
A 64-bit integer item.
Definition Storable.h:587
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:613
static const std::int32_t code
Definition Storable.h:612
std::int8_t asInt8() const override
Get 8-bit integer value.
Definition Storable.h:631
bool asBool() const override
Get boolean value.
Definition Storable.h:626
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:646
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:604
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:656
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Definition Storable.h:661
std::int16_t asInt16() const override
Get 16-bit integer value.
Definition Storable.h:636
bool isInt64() const override
Checks if value is a 64-bit integer.
Definition Storable.h:621
Storable * createStorable() const override
Factory method.
Definition Storable.h:599
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:651
StoreInt64(std::int64_t x)
Definition Storable.h:594
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:641
A 8-bit integer item.
Definition Storable.h:330
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:384
StoreInt8(std::int8_t x)
Definition Storable.h:337
bool asBool() const override
Get boolean value.
Definition Storable.h:369
static const std::int32_t code
Definition Storable.h:355
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Definition Storable.h:404
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:347
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:356
std::int8_t asInt8() const override
Get 8-bit integer value.
Definition Storable.h:374
Storable * createStorable() const override
Factory method.
Definition Storable.h:342
std::int16_t asInt16() const override
Get 16-bit integer value.
Definition Storable.h:379
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:399
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:389
bool isInt8() const override
Checks if value is a 8-bit integer.
Definition Storable.h:364
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:394
A nested list of items.
Definition Storable.h:1117
yarp::os::Bottle & internal()
Definition Storable.h:1134
Storable * createStorable() const override
Factory method.
Definition Storable.h:1124
yarp::os::Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Definition Storable.h:1165
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:1129
bool isList() const override
Checks if value is a list.
Definition Storable.h:1153
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:1145
yarp::os::Bottle * asList() const override
Get list value.
Definition Storable.h:1158
static const std::int32_t code
Definition Storable.h:1144
yarp::os::Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
Definition Storable.h:1170
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:301
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.h:291
Storable * createStorable() const override
Factory method.
Definition Storable.h:281
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:286
bool writeRaw(ConnectionWriter &connection) const override
Definition Storable.h:312
bool readRaw(ConnectionReader &connection) override
Definition Storable.h:306
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.h:296
bool isNull() const override
Checks if the object is invalid.
Definition Storable.h:318
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Definition Storable.h:1040
Storable * createStorable() const override
Factory method.
Definition Storable.h:1006
StoreString(const std::string &x)
Definition Storable.h:1001
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:1022
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:1011
std::string asString() const override
Get string value.
Definition Storable.h:1035
static const std::int32_t code
Definition Storable.h:1021
bool isString() const override
Checks if value is a string.
Definition Storable.h:1030
A 32 bit vocabulary item.
Definition Storable.h:822
yarp::conf::vocab32_t asVocab32() const override
Get 32 bit vocabulary identifier as an integer.
Definition Storable.h:892
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:849
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:877
std::string asString() const override
Get string value.
Definition Storable.h:897
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:838
bool asBool() const override
Get boolean value.
Definition Storable.h:862
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:872
Storable * createStorable() const override
Factory method.
Definition Storable.h:833
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:882
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:867
bool isVocab32() const override
Checks if value is a 32bit vocabulary identifier.
Definition Storable.h:887
static const std::int32_t code
Definition Storable.h:848
StoreVocab32(yarp::conf::vocab32_t x)
Definition Storable.h:828
bool isBool() const override
Checks if value is a boolean.
Definition Storable.h:857
A 64 bit vocabulary item.
Definition Storable.h:908
std::int32_t getCode() const override
Get standard type code of value.
Definition Storable.h:935
bool isVocab64() const override
Checks if value is a 64bit vocabulary identifier.
Definition Storable.h:973
StoreVocab64(yarp::conf::vocab64_t x)
Definition Storable.h:914
std::int64_t asInt64() const override
Get 64-bit integer value.
Definition Storable.h:958
yarp::conf::float32_t asFloat32() const override
Get 32-bit floating point value.
Definition Storable.h:963
void copy(const Storable &alt) override
Become a copy of the passed item.
Definition Storable.h:924
std::int32_t asInt32() const override
Get 32-bit integer value.
Definition Storable.h:953
static const std::int32_t code
Definition Storable.h:934
std::string asString() const override
Get string value.
Definition Storable.h:983
yarp::conf::float64_t asFloat64() const override
Get 64-bit floating point value.
Definition Storable.h:968
bool asBool() const override
Get boolean value.
Definition Storable.h:948
bool isBool() const override
Checks if value is a boolean.
Definition Storable.h:943
yarp::conf::vocab64_t asVocab64() const override
Get 64 bit vocabulary identifier as an integer.
Definition Storable.h:978
Storable * createStorable() const override
Factory method.
Definition Storable.h:919
#define yCAssert(component, x)
#define YARP_DECLARE_LOG_COMPONENT(name)
std::int32_t vocab32_t
Definition numeric.h:78
std::int64_t vocab64_t
Definition numeric.h:79
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
Definition Vocab32.cpp:11
The components from which ports and connections are built.
std::int32_t subCoder(T &content)
Definition Storable.h:1177
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition system.h:338
#define YARP_UNUSED(var)
Definition api.h:162
#define YARP_os_impl_API
Definition api.h:46