YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Storable.cpp
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
9
10#include <yarp/conf/numeric.h>
11
12#include <yarp/os/Bottle.h>
15#include <yarp/os/NetType.h>
16#include <yarp/os/Value.h>
19
20#include <cstdio>
21#include <cstdlib>
22
26using yarp::os::Value;
41
42
43YARP_OS_LOG_COMPONENT(STORABLE, "yarp.os.impl.Storable")
44
45
46const int StoreInt8::code = BOTTLE_TAG_INT8;
47const int StoreInt16::code = BOTTLE_TAG_INT16;
48const int StoreInt32::code = BOTTLE_TAG_INT32;
49const int StoreInt64::code = BOTTLE_TAG_INT64;
50const int StoreFloat32::code = BOTTLE_TAG_FLOAT32;
51const int StoreFloat64::code = BOTTLE_TAG_FLOAT64;
52const int StoreVocab32::code = BOTTLE_TAG_VOCAB32;
53const int StoreVocab64::code = BOTTLE_TAG_VOCAB64;
54const int StoreString::code = BOTTLE_TAG_STRING;
55const int StoreBlob::code = BOTTLE_TAG_BLOB;
56const int StoreList::code = BOTTLE_TAG_LIST;
57const int StoreDict::code = BOTTLE_TAG_LIST | BOTTLE_TAG_DICT;
58
59
60
62// Storable
63
64Storable::~Storable() = default;
65
66Storable* Storable::createByCode(std::int32_t id)
67{
68 Storable* storable = nullptr;
69 std::int32_t subCode = 0;
70 switch (id) {
71 case StoreInt8::code:
72 storable = new StoreInt8();
73 break;
75 storable = new StoreInt16();
76 break;
78 storable = new StoreInt32();
79 break;
81 storable = new StoreInt64();
82 break;
84 storable = new StoreVocab32();
85 break;
87 storable = new StoreVocab64();
88 break;
90 storable = new StoreFloat32();
91 break;
93 storable = new StoreFloat64();
94 break;
96 storable = new StoreString();
97 break;
98 case StoreBlob::code:
99 storable = new StoreBlob();
100 break;
101 case StoreList::code:
102 storable = new StoreList();
103 yCAssert(STORABLE, storable != nullptr);
104 storable->asList()->implementation->setNested(true);
105 break;
106 default:
107 if ((id & GROUP_MASK) != 0) {
108 // typed list
109 subCode = (id & UNIT_MASK);
110 if ((id & BOTTLE_TAG_DICT) != 0) {
111 storable = new StoreDict();
112 yCAssert(STORABLE, storable != nullptr);
113 } else {
114 storable = new StoreList();
115 yCAssert(STORABLE, storable != nullptr);
116 storable->asList()->implementation->specialize(subCode);
117 storable->asList()->implementation->setNested(true);
118 }
119 }
120 break;
121 }
122 return storable;
123}
124
125Value& Storable::find(const std::string& key) const
126{
127 YARP_UNUSED(key);
128 return BottleImpl::getNull();
129}
130
131Bottle& Storable::findGroup(const std::string& key) const
132{
133 YARP_UNUSED(key);
134 return Bottle::getNullBottle();
135}
136
137bool Storable::check(const std::string& key) const
138{
139 Bottle& val = findGroup(key);
140 if (!val.isNull()) {
141 return true;
142 }
143 Value& val2 = find(key);
144 return !val2.isNull();
145}
146
148{
149 return toString() == alt.toString();
150}
151
152
154{
155 std::int32_t x = connection.expectInt32();
156 if (x != getCode()) {
157 return false;
158 }
159 return readRaw(connection);
160}
161
162bool Storable::write(ConnectionWriter& connection) const
163{
164 connection.appendInt32(getCode());
165 return writeRaw(connection);
166}
167
168
170// StoreInt8
171
172std::string StoreInt8::toString() const
173{
174 return std::to_string(x);
175}
176
177void StoreInt8::fromString(const std::string& src)
178{
179 x = static_cast<std::int8_t>(strtol(src.c_str(), static_cast<char**>(nullptr), 0));
180}
181
183{
184 x = reader.expectInt8();
185 return true;
186}
187
189{
190 writer.appendInt8(x);
191 return true;
192}
193
194
196// StoreInt16
197
198std::string StoreInt16::toString() const
199{
200 return std::to_string(x);
201}
202
203void StoreInt16::fromString(const std::string& src)
204{
205 x = static_cast<std::int16_t>(strtol(src.c_str(), static_cast<char**>(nullptr), 0));
206}
207
209{
210 x = reader.expectInt16();
211 return true;
212}
213
215{
216 writer.appendInt16(x);
217 return true;
218}
219
220
222// StoreInt32
223
224std::string StoreInt32::toString() const
225{
226 return std::to_string(x);
227}
228
229void StoreInt32::fromString(const std::string& src)
230{
231 x = strtol(src.c_str(), static_cast<char**>(nullptr), 0);
232}
233
235{
236 x = reader.expectInt32();
237 return true;
238}
239
241{
242 writer.appendInt32(x);
243 return true;
244}
245
246
248// StoreInt64
249
250std::string StoreInt64::toString() const
251{
252 return std::to_string(x);
253}
254
255void StoreInt64::fromString(const std::string& src)
256{
257 x = strtoll(src.c_str(), static_cast<char**>(nullptr), 0);
258}
259
261{
262 x = reader.expectInt64();
263 return true;
264}
265
267{
268 writer.appendInt64(x);
269 return true;
270}
271
272
274// StoreVocab32
275
276std::string StoreVocab32::toString() const
277{
278 if (x == 0) {
279 return "false";
280 }
281 if (x == '1') {
282 return "true";
283 }
284 return Vocab32::decode(x);
285}
286
287void StoreVocab32::fromString(const std::string& src)
288{
289 x = Vocab32::encode(src);
290}
291
293{
294 if (x == 0) {
295 return "false";
296 }
297 if (x == '1') {
298 return "true";
299 }
300 return std::string("[") + toString() + "]";
301}
302
303void StoreVocab32::fromStringNested(const std::string& src)
304{
305 x = 0;
306 if (src.length() > 0) {
307 if (src[0] == '[') {
308 // ignore first [ and last ]
309 fromString(src.substr(1, src.length() - 2));
310 } else if (src == "true") {
311 x = static_cast<int>('1');
312 } else if (src == "false") {
313 x = 0;
314 }
315 }
316}
317
319{
320 x = reader.expectInt32();
321 return true;
322}
323
325{
326 writer.appendInt32(x);
327 return true;
328}
329
331// StoreVocab64
332
333std::string StoreVocab64::toString() const
334{
335 if (x == 0) {
336 return "false";
337 }
338 if (x == '1') {
339 return "true";
340 }
341 return Vocab64::decode64(x);
342}
343
344void StoreVocab64::fromString(const std::string& src)
345{
346 x = Vocab64::encode64(src);
347}
348
350{
351 if (x == 0) {
352 return "false";
353 }
354 if (x == '1') {
355 return "true";
356 }
357 return std::string("[") + toString() + "]";
358}
359
360void StoreVocab64::fromStringNested(const std::string& src)
361{
362 x = 0;
363 if (src.length() > 0) {
364 if (src[0] == '[') {
365 // ignore first [ and last ]
366 fromString(src.substr(1, src.length() - 2));
367 } else if (src == "true") {
368 x = static_cast<int>('1');
369 } else if (src == "false") {
370 x = 0;
371 }
372 }
373}
374
376{
377 x = reader.expectInt64();
378 return true;
379}
380
382{
383 writer.appendInt64(x);
384 return true;
385}
386
388// StoreFloat32
389
390
391std::string StoreFloat32::toString() const
392{
394}
395
396void StoreFloat32::fromString(const std::string& src)
397{
398 x = yarp::conf::numeric::from_string<yarp::conf::float32_t>(src);
399}
400
402{
403 x = reader.expectFloat32();
404 return true;
405}
406
408{
409 writer.appendFloat32(x);
410 return true;
411}
412
413
415// StoreFloat64
416
417std::string StoreFloat64::toString() const
418{
420}
421
422void StoreFloat64::fromString(const std::string& src)
423{
424 x = yarp::conf::numeric::from_string<yarp::conf::float64_t>(src);
425}
426
428{
429 x = reader.expectFloat64();
430 return true;
431}
432
434{
435 writer.appendFloat64(x);
436 return true;
437}
438
439
441// StoreString
442
443std::string StoreString::toString() const
444{
445 return x;
446}
447
448std::string StoreString::quotedString(const std::string& x)
449{
450 // quoting code: very inefficient, but portable
451 std::string result;
452
453 bool needQuote = false;
454 for (unsigned int i = 0; i < x.length(); i++) {
455 char ch = x[i];
456 if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && ch != '_') {
457 if ((ch >= '0' && ch <= '9') || ch == '.' || ch == '-') {
458 if (i == 0) {
459 needQuote = true;
460 break;
461 }
462 } else {
463 needQuote = true;
464 break;
465 }
466 }
467 }
468 if (x.length() == 0) {
469 needQuote = true;
470 }
471 if (x == "true" || x == "false") {
472 needQuote = true;
473 }
474
475 if (!needQuote) {
476 return x;
477 }
478
479 result += "\"";
480 for (char ch : x) {
481 if (ch == '\n') {
482 result += '\\';
483 result += 'n';
484 } else if (ch == '\r') {
485 result += '\\';
486 result += 'r';
487 } else if (ch == '\0') {
488 result += '\\';
489 result += '0';
490 } else {
491 if (ch == '\\' || ch == '\"') {
492 result += '\\';
493 }
494 result += ch;
495 }
496 }
497 result += "\"";
498
499 return result;
500}
501
503{
504 return quotedString(x);
505}
506
507void StoreString::fromString(const std::string& src)
508{
509 x = src;
510}
511
512void StoreString::fromStringNested(const std::string& src)
513{
514 // unquoting code: very inefficient, but portable
515 x = "";
516 size_t len = src.length();
517 if (len > 0) {
518 bool skip = false;
519 bool back = false;
520 if (src[0] == '\"') {
521 skip = true;
522 }
523 for (size_t i = 0; i < len; i++) {
524 if (skip && (i == 0 || i == len - 1)) {
525 // omit
526 } else {
527 char ch = src[i];
528 if (ch == '\\') {
529 if (!back) {
530 back = true;
531 } else {
532 x += '\\';
533 back = false;
534 }
535 } else {
536 if (back) {
537 if (ch == 'n') {
538 x += '\n';
539 } else if (ch == 'r') {
540 x += '\r';
541 } else if (ch == '0') {
542 x += '\0';
543 } else {
544 x += ch;
545 }
546 } else {
547 x += ch;
548 }
549 back = false;
550 }
551 }
552 }
553 }
554}
555
556
558{
559 std::int32_t len = reader.expectInt32();
560 x.resize(len);
561 reader.expectBlock(const_cast<char*>(x.data()), len);
562 return true;
563}
564
566{
567 writer.appendInt32(static_cast<std::int32_t>(x.length()));
568 writer.appendBlock(x.c_str(), x.length());
569 return true;
570}
571
572
574// StoreBlob
575
576std::string StoreBlob::toString() const
577{
578 std::string result;
579 for (unsigned int i = 0; i < x.length(); i++) {
580 if (i > 0) {
581 result += " ";
582 }
583 const auto* src = reinterpret_cast<const unsigned char*>(&x[i]);
584 result += yarp::conf::numeric::to_string(*src);
585 }
586 return result;
587}
588
589std::string StoreBlob::toStringNested() const
590{
591 return std::string("{") + toString() + "}";
592}
593
594void StoreBlob::fromString(const std::string& src)
595{
596 Bottle bot(src);
597 std::string buf(bot.size(), 0);
598 for (size_t i = 0; i < bot.size(); i++) {
599 buf[i] = static_cast<char>(static_cast<unsigned char>(bot.get(i).asInt32()));
600 }
601 x = buf;
602}
603
604void StoreBlob::fromStringNested(const std::string& src)
605{
606 if (src.length() > 0) {
607 if (src[0] == '{') {
608 // ignore first { and last }
609 std::string buf = src.substr(1, src.length() - 2);
610 fromString(buf);
611 }
612 }
613}
614
616{
617 std::int32_t len = reader.expectInt32();
618 x.resize(len);
619 reader.expectBlock(const_cast<char*>(x.data()), len);
620 return true;
621}
622
624{
625 writer.appendInt32(static_cast<std::int32_t>(x.length()));
626 writer.appendBlock(x.c_str(), x.length());
627 return true;
628}
629
630
632// StoreList
633
634std::string StoreList::toString() const
635{
636 return content.toString();
637}
638
639std::string StoreList::toStringNested() const
640{
641 return std::string("(") + content.toString() + ")";
642}
643
644void StoreList::fromString(const std::string& src)
645{
646 content.fromString(src);
647}
648
649void StoreList::fromStringNested(const std::string& src)
650{
651 if (src.length() > 0) {
652 if (src[0] == '(') {
653 // ignore first ( and last )
654 std::string buf = src.substr(1, src.length() - 2);
655 content.fromString(buf);
656 }
657 }
658}
659
661{
662 // not using the most efficient representation
663 content.read(reader);
664 return true;
665}
666
668{
669 // not using the most efficient representation
670 content.write(writer);
671 return true;
672}
673
674std::int32_t StoreList::subCode() const
675{
676 return subCoder(*(content.implementation));
677}
678
679
681// StoreDict
682
683std::string StoreDict::toString() const
684{
685 return std::string(content.toString());
686}
687
688std::string StoreDict::toStringNested() const
689{
690 return std::string("(") + content.toString() + ")";
691}
692
693void StoreDict::fromString(const std::string& src)
694{
695 content.fromString(src);
696}
697
698void StoreDict::fromStringNested(const std::string& src)
699{
700 if (src.length() > 0) {
701 if (src[0] == '(') {
702 // ignore first ( and last )
703 std::string buf = src.substr(1, src.length() - 2);
704 content.fromString(buf);
705 }
706 }
707}
708
710{
711 // not using the most efficient representation
712 content.read(reader);
713 return true;
714}
715
717{
718 // not using the most efficient representation
719 content.write(writer);
720 return true;
721}
#define BOTTLE_TAG_INT8
Definition Bottle.h:19
#define BOTTLE_TAG_FLOAT64
Definition Bottle.h:26
#define BOTTLE_TAG_VOCAB64
Definition Bottle.h:24
#define BOTTLE_TAG_DICT
Definition Bottle.h:30
#define BOTTLE_TAG_INT64
Definition Bottle.h:22
#define BOTTLE_TAG_INT16
Definition Bottle.h:20
#define BOTTLE_TAG_INT32
Definition Bottle.h:21
#define BOTTLE_TAG_STRING
Definition Bottle.h:27
#define BOTTLE_TAG_BLOB
Definition Bottle.h:28
#define BOTTLE_TAG_LIST
Definition Bottle.h:29
#define BOTTLE_TAG_VOCAB32
Definition Bottle.h:23
#define BOTTLE_TAG_FLOAT32
Definition Bottle.h:25
const yarp::os::LogComponent & STORABLE()
Definition Storable.cpp:43
#define GROUP_MASK
Definition Storable.h:31
#define UNIT_MASK
Definition Storable.h:19
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:65
static Bottle & getNullBottle()
A special Bottle with no content.
Definition Bottle.cpp:321
void fromString(const std::string &text)
Initializes bottle from a string.
Definition Bottle.cpp:210
size_type size() const
Gets the number of elements in the bottle.
Definition Bottle.cpp:257
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Definition Bottle.cpp:246
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition Bottle.cpp:252
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
Definition Bottle.cpp:236
bool isNull() const override
Checks if the object is invalid.
Definition Bottle.cpp:349
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Definition Bottle.cpp:217
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual yarp::conf::float32_t expectFloat32()=0
Read a 32-bit floating point number from the network connection.
virtual std::int64_t expectInt64()=0
Read a 64-bit integer from the network connection.
virtual std::int16_t expectInt16()=0
Read a 16-bit integer from the network connection.
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
An interface for writing to a network connection.
virtual void appendInt64(std::int64_t data)=0
Send a representation of a 64-bit integer to the network connection.
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual void appendFloat32(yarp::conf::float32_t data)=0
Send a representation of a 32-bit floating point number to the network connection.
virtual void appendInt16(std::int16_t data)=0
Send a representation of a 16-bit integer to the network connection.
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number to the network connection.
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data to the network connection.
std::string toString() const override
Return a standard text representation of the content of the object.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
bool write(ConnectionWriter &writer) const override
Write this object to a network connection.
bool read(ConnectionReader &reader) override
Read this object from a network connection.
A single value (typically within a Bottle).
Definition Value.h:44
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition Value.cpp:210
virtual std::int32_t getCode() const
Get standard type code of value.
Definition Value.cpp:386
A flexible data format for holding a bunch of numbers and strings.
Definition BottleImpl.h:34
static StoreNull & getNull()
Definition BottleImpl.h:161
A single item in a Bottle.
Definition Storable.h:44
virtual bool writeRaw(ConnectionWriter &connection) const =0
bool write(ConnectionWriter &connection) const override
Write this object to a network connection.
Definition Storable.cpp:162
yarp::os::Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Definition Storable.cpp:125
std::string toString() const override=0
Return a standard text representation of the content of the object.
bool operator==(const yarp::os::Value &alt) const
Definition Storable.cpp:147
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Definition Storable.cpp:137
bool read(ConnectionReader &connection) override
Read this object from a network connection.
Definition Storable.cpp:153
virtual bool readRaw(ConnectionReader &connection)=0
yarp::os::Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
Definition Storable.cpp:131
A binary blob item.
Definition Storable.h:1073
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:594
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:623
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:615
static const std::int32_t code
Definition Storable.h:1105
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:576
void fromStringNested(const std::string &src) override
Initialize from a string representation.
Definition Storable.cpp:604
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Definition Storable.cpp:589
Key/value pairs.
Definition Storable.h:1201
void fromStringNested(const std::string &src) override
Initialize from a string representation.
Definition Storable.cpp:698
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:693
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:683
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Definition Storable.cpp:688
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:716
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:709
A 32-bit floating point number item.
Definition Storable.h:691
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:407
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:401
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:391
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:396
static const std::int32_t code
Definition Storable.h:716
A 64-bit floating point number item.
Definition Storable.h:766
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:433
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:427
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:417
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:422
static const std::int32_t code
Definition Storable.h:791
A 16-bit integer item.
Definition Storable.h:435
static const std::int32_t code
Definition Storable.h:460
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:214
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:203
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:208
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:198
A 32-bit integer item.
Definition Storable.h:521
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:240
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:224
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:234
static const std::int32_t code
Definition Storable.h:546
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:229
A 64-bit integer item.
Definition Storable.h:606
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:260
static const std::int32_t code
Definition Storable.h:631
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:255
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:250
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:266
A 8-bit integer item.
Definition Storable.h:349
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:172
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:177
static const std::int32_t code
Definition Storable.h:374
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:188
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:182
A nested list of items.
Definition Storable.h:1136
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:660
void fromStringNested(const std::string &src) override
Initialize from a string representation.
Definition Storable.cpp:649
std::int32_t subCode() const override
Return a code describing this item, used in serializing bottles.
Definition Storable.cpp:674
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Definition Storable.cpp:639
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:634
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:667
static const std::int32_t code
Definition Storable.h:1163
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:644
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:557
static std::string quotedString(const std::string &x)
Definition Storable.cpp:448
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:443
void fromStringNested(const std::string &src) override
Initialize from a string representation.
Definition Storable.cpp:512
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Definition Storable.cpp:502
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:507
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:565
static const std::int32_t code
Definition Storable.h:1040
A 32 bit vocabulary item.
Definition Storable.h:841
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:276
void fromStringNested(const std::string &src) override
Initialize from a string representation.
Definition Storable.cpp:303
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Definition Storable.cpp:292
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:318
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:287
static const std::int32_t code
Definition Storable.h:867
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:324
A 64 bit vocabulary item.
Definition Storable.h:927
bool writeRaw(ConnectionWriter &writer) const override
Definition Storable.cpp:381
void fromString(const std::string &src) override
Initialize from a string representation, assuming that any syntax around this representation such as ...
Definition Storable.cpp:344
std::string toStringNested() const override
Create string representation, including any syntax that should wrap it such as braces or parentheses.
Definition Storable.cpp:349
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Storable.cpp:333
static const std::int32_t code
Definition Storable.h:953
void fromStringNested(const std::string &src) override
Initialize from a string representation.
Definition Storable.cpp:360
bool readRaw(ConnectionReader &reader) override
Definition Storable.cpp:375
#define yCAssert(component, x)
#define YARP_OS_LOG_COMPONENT(name, name_string)
STL namespace.
std::string to_string(IntegerType x)
Definition numeric.h:116
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
Definition Vocab32.cpp:11
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
Definition Vocab32.cpp:33
NetInt64 encode64(const std::string &str)
Convert a string into a vocabulary identifier.
Definition Vocab64.cpp:10
std::string decode64(NetInt64 code)
Convert a vocabulary identifier into a string.
Definition Vocab64.cpp:48
std::int32_t subCoder(T &content)
Definition Storable.h:1260
#define YARP_UNUSED(var)
Definition api.h:162