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