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