FastCdr.cpp
Go to the documentation of this file.
1 // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <fastcdr/FastCdr.h>
17 #include <string.h>
18 
19 using namespace eprosima::fastcdr;
20 using namespace ::exception;
21 
23  const FastCdr& fastcdr)
24  : m_currentPosition(fastcdr.m_currentPosition)
25 {
26 }
27 
29  const state& current_state)
30  : m_currentPosition(current_state.m_currentPosition)
31 {
32 }
33 
35  FastBuffer& cdrBuffer)
36  : m_cdrBuffer(cdrBuffer)
37  , m_currentPosition(cdrBuffer.begin())
38  , m_lastPosition(cdrBuffer.end())
39 {
40 }
41 
43  size_t numBytes)
44 {
45  bool returnedValue = false;
46 
47  if (((m_lastPosition - m_currentPosition) >= numBytes) || resize(numBytes))
48  {
49  m_currentPosition += numBytes;
50  returnedValue = true;
51  }
52 
53  return returnedValue;
54 }
55 
57 {
58  return &m_currentPosition;
59 }
60 
62 {
63  return FastCdr::state(*this);
64 }
65 
67  FastCdr::state& current_state)
68 {
69  m_currentPosition >> current_state.m_currentPosition;
70 }
71 
73 {
75 }
76 
78  size_t minSizeInc)
79 {
80  if (m_cdrBuffer.resize(minSizeInc))
81  {
84  return true;
85  }
86 
87  return false;
88 }
89 
91  const bool bool_t)
92 {
93  uint8_t value = 0;
94 
95  if (((m_lastPosition - m_currentPosition) >= sizeof(uint8_t)) || resize(sizeof(uint8_t)))
96  {
97  if (bool_t)
98  {
99  value = 1;
100  }
101  m_currentPosition++ << value;
102 
103  return *this;
104  }
105 
106  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
107 }
108 
110  const char* string_t)
111 {
112  uint32_t length = 0;
113 
114  if (string_t != nullptr)
115  {
116  length = size_to_uint32(strlen(string_t)) + 1;
117  }
118 
119  if (length > 0)
120  {
121  FastCdr::state state_before_error(*this);
122  serialize(length);
123 
124  if (((m_lastPosition - m_currentPosition) >= length) || resize(length))
125  {
126  m_currentPosition.memcopy(string_t, length);
127  m_currentPosition += length;
128  }
129  else
130  {
131  setState(state_before_error);
132  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
133  }
134  }
135  else
136  {
137  serialize(length);
138  }
139 
140  return *this;
141 }
142 
144  const wchar_t* string_t)
145 {
146  uint32_t bytesLength = 0;
147  size_t wstrlen = 0;
148 
149  if (string_t != nullptr)
150  {
151  wstrlen = wcslen(string_t);
152  bytesLength = size_to_uint32(wstrlen * 4);
153  }
154 
155  if (bytesLength > 0)
156  {
157  FastCdr::state state_(*this);
158  serialize(size_to_uint32(wstrlen));
159 
160  if (((m_lastPosition - m_currentPosition) >= bytesLength) || resize(bytesLength))
161  {
162 #if defined(_WIN32)
163  serializeArray(string_t, wstrlen);
164 #else
165  m_currentPosition.memcopy(string_t, bytesLength);
166  m_currentPosition += bytesLength; // size on bytes
167 #endif // if defined(_WIN32)
168  }
169  else
170  {
171  setState(state_);
172  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
173  }
174  }
175  else
176  {
177  serialize(bytesLength);
178  }
179 
180  return *this;
181 }
182 
184  const bool* bool_t,
185  size_t numElements)
186 {
187  size_t totalSize = sizeof(*bool_t) * numElements;
188 
189  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
190  {
191  for (size_t count = 0; count < numElements; ++count)
192  {
193  uint8_t value = 0;
194 
195  if (bool_t[count])
196  {
197  value = 1;
198  }
199  m_currentPosition++ << value;
200  }
201 
202  return *this;
203  }
204 
205  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
206 }
207 
209  const char* char_t,
210  size_t numElements)
211 {
212  size_t totalSize = sizeof(*char_t) * numElements;
213 
214  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
215  {
216  m_currentPosition.memcopy(char_t, totalSize);
217  m_currentPosition += totalSize;
218  return *this;
219  }
220 
221  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
222 }
223 
225  const int16_t* short_t,
226  size_t numElements)
227 {
228  size_t totalSize = sizeof(*short_t) * numElements;
229 
230  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
231  {
232  m_currentPosition.memcopy(short_t, totalSize);
233  m_currentPosition += totalSize;
234 
235  return *this;
236  }
237 
238  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
239 }
240 
242  const int32_t* long_t,
243  size_t numElements)
244 {
245  size_t totalSize = sizeof(*long_t) * numElements;
246 
247  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
248  {
249  m_currentPosition.memcopy(long_t, totalSize);
250  m_currentPosition += totalSize;
251 
252  return *this;
253  }
254 
255  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
256 }
257 
259  const wchar_t* wchar,
260  size_t numElements)
261 {
262  for (size_t count = 0; count < numElements; ++count)
263  {
264  serialize(wchar[count]);
265  }
266  return *this;
267 }
268 
270  const int64_t* longlong_t,
271  size_t numElements)
272 {
273  size_t totalSize = sizeof(*longlong_t) * numElements;
274 
275  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
276  {
277  m_currentPosition.memcopy(longlong_t, totalSize);
278  m_currentPosition += totalSize;
279 
280  return *this;
281  }
282 
283  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
284 }
285 
287  const float* float_t,
288  size_t numElements)
289 {
290  size_t totalSize = sizeof(*float_t) * numElements;
291 
292  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
293  {
294  m_currentPosition.memcopy(float_t, totalSize);
295  m_currentPosition += totalSize;
296 
297  return *this;
298  }
299 
300  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
301 }
302 
304  const double* double_t,
305  size_t numElements)
306 {
307  size_t totalSize = sizeof(*double_t) * numElements;
308 
309  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
310  {
311  m_currentPosition.memcopy(double_t, totalSize);
312  m_currentPosition += totalSize;
313 
314  return *this;
315  }
316 
317  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
318 }
319 
321  const long double* ldouble_t,
322  size_t numElements)
323 {
324  size_t totalSize = 16 * numElements;
325 
326  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
327  {
328 #if FASTCDR_HAVE_FLOAT128 && FASTCDR_SIZEOF_LONG_DOUBLE < 16
329  for (size_t idx = 0; idx < numElements; ++idx)
330  {
331  __float128 tmp = ldouble_t[idx];
332  m_currentPosition << tmp;
333  m_currentPosition += 16;
334  }
335 #else
336 #if FASTCDR_SIZEOF_LONG_DOUBLE == 16
337  m_currentPosition.memcopy(ldouble_t, totalSize);
338  m_currentPosition += totalSize;
339 #else
340 #if FASTCDR_SIZEOF_LONG_DOUBLE == 8
341  for (size_t idx = 0; idx < numElements; ++idx)
342  {
343  m_currentPosition << static_cast<long double>(0);
344  m_currentPosition += 8;
345  m_currentPosition << ldouble_t[idx];
346  m_currentPosition += 8;
347  }
348 #else
349 #error unsupported long double type and no __float128 available
350 #endif // FASTCDR_SIZEOF_LONG_DOUBLE == 8
351 #endif // FASTCDR_SIZEOF_LONG_DOUBLE == 16
352 #endif // FASTCDR_HAVE_FLOAT128 && FASTCDR_SIZEOF_LONG_DOUBLE < 16
353 
354  return *this;
355  }
356 
357  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
358 }
359 
361  bool& bool_t)
362 {
363  uint8_t value = 0;
364 
365  if ((m_lastPosition - m_currentPosition) >= sizeof(uint8_t))
366  {
367  m_currentPosition++ >> value;
368 
369  if (value == 1)
370  {
371  bool_t = true;
372  return *this;
373  }
374  else if (value == 0)
375  {
376  bool_t = false;
377  return *this;
378  }
379 
380  throw BadParamException("Got unexpected byte value in deserialize for bool (expected 0 or 1)");
381  }
382 
383  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
384 }
385 
387  char*& string_t)
388 {
389  uint32_t length = 0;
390  FastCdr::state state_before_error(*this);
391 
392  deserialize(length);
393 
394  if (length == 0)
395  {
396  string_t = NULL;
397  return *this;
398  }
399  else if ((m_lastPosition - m_currentPosition) >= length)
400  {
401  // Allocate memory.
402  string_t =
403  reinterpret_cast<char*>(calloc(length + ((&m_currentPosition)[length - 1] == '\0' ? 0 : 1),
404  sizeof(char)));
405  memcpy(string_t, &m_currentPosition, length);
406  m_currentPosition += length;
407  return *this;
408  }
409 
410  setState(state_before_error);
411  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
412 }
413 
415  wchar_t*& string_t)
416 {
417  uint32_t length = 0;
418  FastCdr::state state_before_error(*this);
419 
420  deserialize(length);
421 
422  if (length == 0)
423  {
424  string_t = NULL;
425  return *this;
426  }
427  else if ((m_lastPosition - m_currentPosition) >= length)
428  {
429  // Allocate memory.
430  string_t = reinterpret_cast<wchar_t*>(calloc(length + 1, sizeof(wchar_t))); // WStrings never serialize terminating zero
431 
432 #if defined(_WIN32)
433  for (size_t idx = 0; idx < length; ++idx)
434  {
435  uint32_t temp;
436  m_currentPosition >> temp;
437  string_t[idx] = static_cast<wchar_t>(temp);
438  m_currentPosition += 4;
439  }
440 #else
441  memcpy(string_t, &m_currentPosition, length * sizeof(wchar_t));
442  m_currentPosition += length * sizeof(wchar_t);
443 #endif // if defined(_WIN32)
444 
445  return *this;
446  }
447 
448  setState(state_before_error);
449  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
450 }
451 
453  uint32_t& length)
454 {
455  const char* returnedValue = "";
456  state state_before_error(*this);
457 
458  *this >> length;
459 
460  if (length == 0)
461  {
462  return returnedValue;
463  }
464  else if ((m_lastPosition - m_currentPosition) >= length)
465  {
466  returnedValue = &m_currentPosition;
467  m_currentPosition += length;
468  if (returnedValue[length - 1] == '\0')
469  {
470  --length;
471  }
472  return returnedValue;
473  }
474 
475  setState(state_before_error);
478 }
479 
480 std::wstring FastCdr::readWString(
481  uint32_t& length)
482 {
483  std::wstring returnedValue = L"";
484  state state_(*this);
485 
486  *this >> length;
487  uint32_t bytesLength = length * 4;
488 
489  if (bytesLength == 0)
490  {
491  return returnedValue;
492  }
493  else if ((m_lastPosition - m_currentPosition) >= bytesLength)
494  {
495 
496  returnedValue.resize(length);
497  deserializeArray(const_cast<wchar_t*>(returnedValue.c_str()), length);
498  if (returnedValue[length - 1] == L'\0')
499  {
500  --length;
501  returnedValue.erase(length);
502  }
503  return returnedValue;
504  }
505 
506  setState(state_);
509 }
510 
512  bool* bool_t,
513  size_t numElements)
514 {
515  size_t totalSize = sizeof(*bool_t) * numElements;
516 
517  if ((m_lastPosition - m_currentPosition) >= totalSize)
518  {
519  for (size_t count = 0; count < numElements; ++count)
520  {
521  uint8_t value = 0;
522  m_currentPosition++ >> value;
523 
524  if (value == 1)
525  {
526  bool_t[count] = true;
527  }
528  else if (value == 0)
529  {
530  bool_t[count] = false;
531  }
532  }
533 
534  return *this;
535  }
536 
537  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
538 }
539 
541  char* char_t,
542  size_t numElements)
543 {
544  size_t totalSize = sizeof(*char_t) * numElements;
545 
546  if ((m_lastPosition - m_currentPosition) >= totalSize)
547  {
548  m_currentPosition.rmemcopy(char_t, totalSize);
549  m_currentPosition += totalSize;
550  return *this;
551  }
552 
553  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
554 }
555 
557  int16_t* short_t,
558  size_t numElements)
559 {
560  size_t totalSize = sizeof(*short_t) * numElements;
561 
562  if ((m_lastPosition - m_currentPosition) >= totalSize)
563  {
564  m_currentPosition.rmemcopy(short_t, totalSize);
565  m_currentPosition += totalSize;
566 
567  return *this;
568  }
569 
570  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
571 }
572 
574  int32_t* long_t,
575  size_t numElements)
576 {
577  size_t totalSize = sizeof(*long_t) * numElements;
578 
579  if ((m_lastPosition - m_currentPosition) >= totalSize)
580  {
581  m_currentPosition.rmemcopy(long_t, totalSize);
582  m_currentPosition += totalSize;
583 
584  return *this;
585  }
586 
587  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
588 }
589 
591  wchar_t* wchar,
592  size_t numElements)
593 {
594  uint32_t value = 0;
595  for (size_t count = 0; count < numElements; ++count)
596  {
597  deserialize(value);
598  wchar[count] = static_cast<wchar_t>(value);
599  }
600  return *this;
601 }
602 
604  int64_t* longlong_t,
605  size_t numElements)
606 {
607  size_t totalSize = sizeof(*longlong_t) * numElements;
608 
609  if ((m_lastPosition - m_currentPosition) >= totalSize)
610  {
611  m_currentPosition.rmemcopy(longlong_t, totalSize);
612  m_currentPosition += totalSize;
613 
614  return *this;
615  }
616 
617  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
618 }
619 
621  float* float_t,
622  size_t numElements)
623 {
624  size_t totalSize = sizeof(*float_t) * numElements;
625 
626  if ((m_lastPosition - m_currentPosition) >= totalSize)
627  {
628  m_currentPosition.rmemcopy(float_t, totalSize);
629  m_currentPosition += totalSize;
630 
631  return *this;
632  }
633 
634  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
635 }
636 
638  double* double_t,
639  size_t numElements)
640 {
641  size_t totalSize = sizeof(*double_t) * numElements;
642 
643  if ((m_lastPosition - m_currentPosition) >= totalSize)
644  {
645  m_currentPosition.rmemcopy(double_t, totalSize);
646  m_currentPosition += totalSize;
647 
648  return *this;
649  }
650 
651  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
652 }
653 
655  long double* ldouble_t,
656  size_t numElements)
657 {
658  size_t totalSize = 16 * numElements;
659 
660  if ((m_lastPosition - m_currentPosition) >= totalSize)
661  {
662 #if FASTCDR_HAVE_FLOAT128 && FASTCDR_SIZEOF_LONG_DOUBLE < 16
663  for (size_t idx = 0; idx < numElements; ++idx)
664  {
665  __float128 tmp;
666  m_currentPosition >> tmp;
667  m_currentPosition += 16;
668  ldouble_t[idx] = static_cast<long double>(tmp);
669  }
670 #else
671 #if FASTCDR_SIZEOF_LONG_DOUBLE == 16
672  m_currentPosition.rmemcopy(ldouble_t, totalSize);
673  m_currentPosition += totalSize;
674 #else
675 #if FASTCDR_SIZEOF_LONG_DOUBLE == 8
676  for (size_t idx = 0; idx < numElements; ++idx)
677  {
678  m_currentPosition += 8;
679  m_currentPosition >> ldouble_t[idx];
680  m_currentPosition += 8;
681  }
682 #else
683 #error unsupported long double type and no __float128 available
684 #endif // FASTCDR_SIZEOF_LONG_DOUBLE == 8
685 #endif // FASTCDR_SIZEOF_LONG_DOUBLE == 16
686 #endif // FASTCDR_HAVE_FLOAT128 && FASTCDR_SIZEOF_LONG_DOUBLE < 16
687 
688  return *this;
689  }
690 
691  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
692 }
693 
695  const std::vector<bool>& vector_t)
696 {
697  state state_before_error(*this);
698 
699  *this << static_cast<int32_t>(vector_t.size());
700 
701  size_t totalSize = vector_t.size() * sizeof(bool);
702 
703  if (((m_lastPosition - m_currentPosition) >= totalSize) || resize(totalSize))
704  {
705  for (size_t count = 0; count < vector_t.size(); ++count)
706  {
707  uint8_t value = 0;
708  std::vector<bool>::const_reference ref = vector_t[count];
709 
710  if (ref)
711  {
712  value = 1;
713  }
714  m_currentPosition++ << value;
715  }
716  }
717  else
718  {
719  setState(state_before_error);
720  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
721  }
722 
723  return *this;
724 }
725 
727  std::vector<bool>& vector_t)
728 {
729  uint32_t seqLength = 0;
730  state state_before_error(*this);
731 
732  *this >> seqLength;
733 
734  size_t totalSize = seqLength * sizeof(bool);
735 
736  if ((m_lastPosition - m_currentPosition) >= totalSize)
737  {
738  vector_t.resize(seqLength);
739  for (uint32_t count = 0; count < seqLength; ++count)
740  {
741  uint8_t value = 0;
742  m_currentPosition++ >> value;
743 
744  if (value == 1)
745  {
746  vector_t[count] = true;
747  }
748  else if (value == 0)
749  {
750  vector_t[count] = false;
751  }
752  }
753  }
754  else
755  {
756  setState(state_before_error);
757  throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
758  }
759 
760  return *this;
761 }
762 
764  std::string*& sequence_t,
765  size_t& numElements)
766 {
767  uint32_t seqLength = 0;
768  state state_before_error(*this);
769 
770  deserialize(seqLength);
771 
772  try
773  {
774  sequence_t = new std::string[seqLength];
775  deserializeArray(sequence_t, seqLength);
776  }
778  {
779  delete [] sequence_t;
780  sequence_t = NULL;
781  setState(state_before_error);
782  ex.raise();
783  }
784 
785  numElements = seqLength;
786  return *this;
787 }
788 
790  std::wstring*& sequence_t,
791  size_t& numElements)
792 {
793  uint32_t seqLength = 0;
794  state state_before_error(*this);
795 
796  deserialize(seqLength);
797 
798  try
799  {
800  sequence_t = new std::wstring[seqLength];
801  deserializeArray(sequence_t, seqLength);
802  }
804  {
805  delete [] sequence_t;
806  sequence_t = NULL;
807  setState(state_before_error);
808  ex.raise();
809  }
810 
811  numElements = seqLength;
812  return *this;
813 }
virtual Cdr_DllAPI void raise() const =0
This function throws the object as exception.
This class stores the current state of a CDR serialization.
Definition: FastCdr.h:49
This abstract class is used to create exceptions.
Definition: Exception.h:29
typename detail::char_t_impl< S >::type char_t
Definition: core.h:621
This class is thrown as an exception when the buffer&#39;s internal memory reachs its size limit...
FastCdr(FastBuffer &cdrBuffer)
This constructor creates a eprosima::fastcdr::FastCdr object that can serialize/deserialize the assig...
Definition: FastCdr.cpp:34
This class offers an interface to serialize/deserialize some basic types using a modified CDR protoco...
Definition: FastCdr.h:42
FastCdr & serializeBoolSequence(const std::vector< bool > &vector_t)
Definition: FastCdr.cpp:694
static Cdr_DllAPI const char *const NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT
Default message used in the library.
FastCdr & deserializeStringSequence(std::string *&sequence_t, size_t &numElements)
Definition: FastCdr.cpp:763
char * getCurrentPosition()
This function returns the current position in the CDR stream.
Definition: FastCdr.cpp:56
iterator begin()
This function returns a iterator that points to the begining of the stream.
Definition: FastBuffer.h:302
FastCdr & deserializeArray(uint8_t *octet_t, size_t numElements)
This function deserializes an array of octets.
Definition: FastCdr.h:1676
uint32_t size_to_uint32(size_t val)
Definition: FastBuffer.h:25
void rmemcopy(void *dst, const size_t size)
This function copies from the raw buffer to a external buffer.
Definition: FastBuffer.h:146
FastCdr & deserializeBoolSequence(std::vector< bool > &vector_t)
Definition: FastCdr.cpp:726
constexpr auto count() -> size_t
Definition: core.h:1050
FastCdr & deserializeWStringSequence(std::wstring *&sequence_t, size_t &numElements)
Definition: FastCdr.cpp:789
FastCdr & serializeArray(const uint8_t *octet_t, size_t numElements)
This function serializes an array of octets.
Definition: FastCdr.h:1012
FastBuffer::iterator m_currentPosition
The current position in the serialization/deserialization process.
Definition: FastCdr.h:2096
const char * readString(uint32_t &length)
Definition: FastCdr.cpp:452
FastBuffer & m_cdrBuffer
Reference to the buffer that will be serialized/deserialized.
Definition: FastCdr.h:2093
state(const FastCdr &fastcdr)
Default constructor.
Definition: FastCdr.cpp:22
const FastBuffer::iterator m_currentPosition
The position in the buffer when the state was created.
Definition: FastCdr.h:73
void reset()
This function resets the current position in the buffer to the begining.
Definition: FastCdr.cpp:72
This class represents a stream of bytes that contains (or will contain) serialized data...
Definition: FastBuffer.h:228
bool jump(size_t numBytes)
This function skips a number of bytes in the CDR stream buffer.
Definition: FastCdr.cpp:42
FastCdr::state getState()
This function returns the current state of the CDR stream.
Definition: FastCdr.cpp:61
bool resize(size_t minSizeInc)
This function resizes the raw buffer. It will call the user&#39;s defined function for this purpose...
Definition: FastBuffer.cpp:66
bool resize(size_t minSizeInc)
Definition: FastCdr.cpp:77
FastCdr & serialize(const uint8_t octet_t)
This function serializes an octet.
Definition: FastCdr.h:642
void memcopy(const void *src, const size_t size)
This function copies a buffer into the raw buffer.
Definition: FastBuffer.h:130
Definition: core.h:1131
iterator end()
This function returns a iterator that points to the end of the stream.
Definition: FastBuffer.h:312
FastCdr & deserialize(uint8_t &octet_t)
This function deserializes an octet.
Definition: FastCdr.h:1290
FastBuffer::iterator m_lastPosition
The last position in the buffer;.
Definition: FastCdr.h:2099
std::wstring readWString(uint32_t &length)
Definition: FastCdr.cpp:480
void setState(FastCdr::state &state)
This function sets a previous state of the CDR stream;.
Definition: FastCdr.cpp:66


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:01:02