20 using namespace ::exception;
24 : current_position_(fastcdr.current_position_)
29 const state& current_state)
45 bool ret_value =
false;
110 const char* string_t)
114 if (string_t !=
nullptr)
144 const wchar_t* string_t)
146 uint32_t bytes_length = 0;
149 if (string_t !=
nullptr)
151 wstrlen = wcslen(string_t);
155 if (bytes_length > 0)
167 #endif // if defined(_WIN32)
187 size_t total_size =
sizeof(*bool_t) * num_elements;
191 for (
size_t count = 0; count < num_elements; ++count)
212 size_t total_size =
sizeof(*char_t) * num_elements;
225 const int16_t* short_t,
228 size_t total_size =
sizeof(*short_t) * num_elements;
242 const int32_t* long_t,
245 size_t total_size =
sizeof(*long_t) * num_elements;
259 const wchar_t* wchar,
262 for (
size_t count = 0; count < num_elements; ++count)
270 const int64_t* longlong_t,
273 size_t total_size =
sizeof(*longlong_t) * num_elements;
287 const float* float_t,
290 size_t total_size =
sizeof(*float_t) * num_elements;
304 const double* double_t,
307 size_t total_size =
sizeof(*double_t) * num_elements;
321 const long double* ldouble_t,
324 size_t total_size = 16 * num_elements;
328 #if FASTCDR_HAVE_FLOAT128 && FASTCDR_SIZEOF_LONG_DOUBLE < 16
329 for (
size_t idx = 0; idx < num_elements; ++idx)
331 __float128 tmp = ldouble_t[idx];
336 #if FASTCDR_SIZEOF_LONG_DOUBLE == 16
340 #if FASTCDR_SIZEOF_LONG_DOUBLE == 8
341 for (
size_t idx = 0; idx < num_elements; ++idx)
343 current_position_ << static_cast<long double>(0);
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
380 throw BadParamException(
"Got unexpected byte value in deserialize for bool (expected 0 or 1)");
403 reinterpret_cast<char*
>(calloc(length + ((&
current_position_)[length - 1] ==
'\0' ? 0 : 1),
430 string_t =
reinterpret_cast<wchar_t*
>(calloc(length + 1,
sizeof(
wchar_t)));
433 for (
size_t idx = 0; idx < length; ++idx)
437 string_t[idx] =
static_cast<wchar_t>(temp);
443 #endif // if defined(_WIN32)
455 const char* ret_value =
"";
456 state state_before_error(*
this);
468 if (ret_value[length - 1] ==
'\0')
483 std::wstring ret_value = L
"";
487 uint32_t bytes_length = length * 4;
489 if (bytes_length == 0)
496 ret_value.resize(length);
498 if (ret_value[length - 1] == L
'\0')
501 ret_value.erase(length);
515 size_t total_size =
sizeof(*bool_t) * num_elements;
519 for (
size_t count = 0; count < num_elements; ++count)
526 bool_t[count] =
true;
530 bool_t[count] =
false;
544 size_t total_size =
sizeof(*char_t) * num_elements;
560 size_t total_size =
sizeof(*short_t) * num_elements;
577 size_t total_size =
sizeof(*long_t) * num_elements;
595 for (
size_t count = 0; count < num_elements; ++count)
598 wchar[count] =
static_cast<wchar_t>(value);
607 size_t total_size =
sizeof(*longlong_t) * num_elements;
624 size_t total_size =
sizeof(*float_t) * num_elements;
641 size_t total_size =
sizeof(*double_t) * num_elements;
655 long double* ldouble_t,
658 size_t total_size = 16 * num_elements;
662 #if FASTCDR_HAVE_FLOAT128 && FASTCDR_SIZEOF_LONG_DOUBLE < 16
663 for (
size_t idx = 0; idx < num_elements; ++idx)
668 ldouble_t[idx] =
static_cast<long double>(tmp);
671 #if FASTCDR_SIZEOF_LONG_DOUBLE == 16
675 #if FASTCDR_SIZEOF_LONG_DOUBLE == 8
676 for (
size_t idx = 0; idx < num_elements; ++idx)
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
695 const std::vector<bool>& vector_t)
697 state state_before_error(*
this);
699 *this << static_cast<int32_t>(vector_t.size());
701 size_t total_size = vector_t.size() *
sizeof(bool);
705 for (
size_t count = 0; count < vector_t.size(); ++count)
708 std::vector<bool>::const_reference ref = vector_t[count];
727 std::vector<bool>& vector_t)
729 uint32_t sequence_length = 0;
730 state state_before_error(*
this);
732 *
this >> sequence_length;
734 size_t total_size = sequence_length *
sizeof(bool);
738 vector_t.resize(sequence_length);
739 for (uint32_t count = 0; count < sequence_length; ++count)
746 vector_t[count] =
true;
750 vector_t[count] =
false;
764 std::string*& sequence_t,
765 size_t& num_elements)
767 uint32_t sequence_length = 0;
768 state state_before_error(*
this);
774 sequence_t =
new std::string[sequence_length];
779 delete [] sequence_t;
785 num_elements = sequence_length;
790 std::wstring*& sequence_t,
791 size_t& num_elements)
793 uint32_t sequence_length = 0;
794 state state_before_error(*
this);
800 sequence_t =
new std::wstring[sequence_length];
805 delete [] sequence_t;
811 num_elements = sequence_length;