From 8cb66ee796ffb6b714f2e6ca39bb77d52a0c7a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Tue, 18 Jul 2023 16:38:45 +0200 Subject: [PATCH] Refs #18687. Remove duplicated code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno --- include/fastcdr/Cdr.h | 1406 +++-------------------------------------- src/cpp/Cdr.cpp | 644 ------------------- 2 files changed, 84 insertions(+), 1966 deletions(-) diff --git a/include/fastcdr/Cdr.h b/include/fastcdr/Cdr.h index 7b8bddba..c8037982 100644 --- a/include/fastcdr/Cdr.h +++ b/include/fastcdr/Cdr.h @@ -363,21 +363,6 @@ class Cdr_DllAPI Cdr return serialize(static_cast(octet_t)); } - /*! - * @brief This function serializes an octet with a different endianness. - * @param octet_t The value of the octet that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const uint8_t octet_t, - Endianness endianness) - { - return serialize(static_cast(octet_t), endianness); - } - /*! * @brief This function serializes a character. * @param char_t The value of the character that will be serialized in the buffer. @@ -387,22 +372,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const char char_t); - /*! - * @brief This function serializes a character with a different endianness. - * @param char_t The value of the character that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const char char_t, - Endianness endianness) - { - (void) endianness; - return serialize(char_t); - } - /*! * @brief This function serializes an int8_t. * @param int8 The value of the int8_t that will be serialized in the buffer. @@ -416,21 +385,6 @@ class Cdr_DllAPI Cdr return serialize(static_cast(int8)); } - /*! - * @brief This function serializes an int8_t with a different endianness. - * @param int8 The value of the int8_t that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const int8_t int8, - Endianness endianness) - { - return serialize(static_cast(int8), endianness); - } - /*! * @brief This function serializes an unsigned short. * @param ushort_t The value of the unsigned short that will be serialized in the buffer. @@ -444,21 +398,6 @@ class Cdr_DllAPI Cdr return serialize(static_cast(ushort_t)); } - /*! - * @brief This function serializes an unsigned short with a different endianness. - * @param ushort_t The value of the unsigned short that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const uint16_t ushort_t, - Endianness endianness) - { - return serialize(static_cast(ushort_t), endianness); - } - /*! * @brief This function serializes a short. * @param short_t The value of the short that will be serialized in the buffer. @@ -468,17 +407,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const int16_t short_t); - /*! - * @brief This function serializes a short with a different endianness. - * @param short_t The value of the short that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serialize( - const int16_t short_t, - Endianness endianness); - /*! * @brief This function serializes an unsigned long. * @param ulong_t The value of the unsigned long that will be serialized in the buffer. @@ -492,21 +420,6 @@ class Cdr_DllAPI Cdr return serialize(static_cast(ulong_t)); } - /*! - * @brief This function serializes an unsigned long with a different endianness. - * @param ulong_t The value of the unsigned long that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const uint32_t ulong_t, - Endianness endianness) - { - return serialize(static_cast(ulong_t), endianness); - } - /*! * @brief This function serializes a long. * @param long_t The value of the long that will be serialized in the buffer. @@ -516,17 +429,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const int32_t long_t); - /*! - * @brief This function serializes a long with a different endianness. - * @param long_t The value of the long that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serialize( - const int32_t long_t, - Endianness endianness); - /*! * @brief This function serializes a wide-char. * @param wchar The value of the wide-char that will be serialized in the buffer. @@ -540,21 +442,6 @@ class Cdr_DllAPI Cdr return serialize(static_cast(wchar)); } - /*! - * @brief This function serializes a wide-char with a different endianness. - * @param wchar The value of the wide-char that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const wchar_t wchar, - Endianness endianness) - { - return serialize(static_cast(wchar), endianness); - } - /*! * @brief This function serializes an unsigned long long. * @param ulonglong_t The value of the unsigned long long that will be serialized in the buffer. @@ -568,21 +455,6 @@ class Cdr_DllAPI Cdr return serialize(static_cast(ulonglong_t)); } - /*! - * @brief This function serializes an unsigned long long with a different endianness. - * @param ulonglong_t The value of the unsigned long long that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const uint64_t ulonglong_t, - Endianness endianness) - { - return serialize(static_cast(ulonglong_t), endianness); - } - /*! * @brief This function serializes a long long. * @param longlong_t The value of the long long that will be serialized in the buffer. @@ -592,17 +464,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const int64_t longlong_t); - /*! - * @brief This function serializes a long long with a different endianness. - * @param longlong_t The value of the long long that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serialize( - const int64_t longlong_t, - Endianness endianness); - /*! * @brief This function serializes a float. * @param float_t The value of the float that will be serialized in the buffer. @@ -612,17 +473,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const float float_t); - /*! - * @brief This function serializes a float with a different endianness. - * @param float_t The value of the float that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serialize( - const float float_t, - Endianness endianness); - /*! * @brief This function serializes a double. * @param double_t The value of the double that will be serialized in the buffer. @@ -632,18 +482,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const double double_t); - /*! - * @brief This function serializes a double with a different endianness. - * @param double_t The value of the double that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serialize( - const double double_t, - Endianness endianness); - - /*! * @brief This function serializes a long double. * @param ldouble_t The value of the long double that will be serialized in the buffer. @@ -654,18 +492,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const long double ldouble_t); - /*! - * @brief This function serializes a long double with a different endianness. - * @param ldouble_t The value of the long double that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - * @note Due to internal representation differences, WIN32 and *NIX like systems are not compatible. - */ - Cdr& serialize( - const long double ldouble_t, - Endianness endianness); - /*! * @brief This function serializes a boolean. * @param bool_t The value of the boolean that will be serialized in the buffer. @@ -675,22 +501,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const bool bool_t); - /*! - * @brief This function serializes a boolean with a different endianness. - * @param bool_t The value of the boolean that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const bool bool_t, - Endianness endianness) - { - (void) endianness; - return serialize(bool_t); - } - /*! * @brief This function serializes a string. * @param string_t The pointer to the string that will be serialized in the buffer. @@ -721,28 +531,6 @@ class Cdr_DllAPI Cdr Cdr& serialize( const wchar_t* string_t); - /*! - * @brief This function serializes a string with a different endianness. - * @param string_t The pointer to the string that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serialize( - const char* string_t, - Endianness endianness); - - /*! - * @brief This function serializes a wstring with a different endianness. - * @param string_t The pointer to the wstring that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serialize( - const wchar_t* string_t, - Endianness endianness); - /*! * @brief This function serializes a std::string. * @param string_t The string that will be serialized in the buffer. @@ -769,21 +557,6 @@ class Cdr_DllAPI Cdr return serialize(string_t.c_str()); } - /*! - * @brief This function serializes a std::string with a different endianness. - * @param string_t The string that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serialize( - const std::string& string_t, - Endianness endianness) - { - return serialize(string_t.c_str(), endianness); - } - /*! * @brief Encodes a eprosima::fastcdr::fixed_string in the buffer. * @param[in] value A reference to the fixed string which will be encoded in the buffer. @@ -799,23 +572,6 @@ class Cdr_DllAPI Cdr return serialize(value.c_str()); } - /*! - * @brief Encodes a eprosima::fastcdr::fixed_string in the buffer with a different endianness. - * @param[in] value A reference to the fixed string which will be encoded in the buffer. - * @param[in] endianness Endianness that will be used for the encoding of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer - * position that exceeds the internal memory size. - */ - template - inline - Cdr& serialize( - const fixed_string& value, - Endianness endianness) - { - return serialize(value.c_str(), endianness); - } - /*! * @brief This function template serializes an array. * @param array_t The array that will be serialized in the buffer. @@ -851,21 +607,6 @@ class Cdr_DllAPI Cdr return *this; } - /*! - * @brief This function template serializes an array with a different endianness. - * @param array_t The array that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - template - inline Cdr& serialize( - const std::array<_T, _Size>& array_t, - Endianness endianness) - { - return serializeArray(array_t.data(), array_t.size(), endianness); - } - /*! * @brief This function template serializes a sequence of booleans. * @param vector_t The sequence that will be serialized in the buffer. @@ -1052,91 +793,31 @@ class Cdr_DllAPI Cdr #endif // ifdef _MSC_VER /*! - * @brief This function template serializes a sequence with a different endianness. - * @param vector_t The sequence that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. + * @brief Encodes the value of a bitset into the buffer. + * + * @param[in] value A reference to the value which will be encoded in the buffer. * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. */ - template + template ::type* = nullptr> Cdr& serialize( - const std::vector<_T>& vector_t, - Endianness endianness) + const std::bitset& value) { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); + state state_before_error(*this); - try - { - serialize(vector_t); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } + serialize(static_cast(value.to_ulong())); return *this; } - /*! - * @brief This function template serializes a map with a different endianness. - * @param vector_t The map that will be serialized in the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - template + template ::type* = nullptr> Cdr& serialize( - const std::map<_K, _T>& value, - Endianness endianness) + const std::bitset& value) { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); + state state_before_error(*this); - try - { - serialize(value); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - - /*! - * @brief Encodes the value of a bitset into the buffer. - * - * @param[in] value A reference to the value which will be encoded in the buffer. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer - * position that exceeds the internal memory size. - */ - template ::type* = nullptr> - Cdr& serialize( - const std::bitset& value) - { - state state_before_error(*this); - - serialize(static_cast(value.to_ulong())); - - return *this; - } - - template ::type* = nullptr> - Cdr& serialize( - const std::bitset& value) - { - state state_before_error(*this); - - serialize(static_cast(value.to_ulong())); + serialize(static_cast(value.to_ulong())); return *this; } @@ -1163,9 +844,38 @@ class Cdr_DllAPI Cdr return *this; } - template + /*! + * @brief Encodes the value of a type into the buffer. + * + * To do that, the encoder expects a function `serialize` is provided by the type. + * + * @param[in] value A reference to the value which will be encoded in the buffer. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. + */ + template::value>::type* = nullptr, typename = void> + inline Cdr& serialize( + const _T& value) + { + extern void serialize( + Cdr&, + const _T&); + serialize(*this, value); + return *this; + } + + /*! + * @brief Encodes the value of a type with a different endianness. + * @param[in] value A reference to the value which will be encoded in the buffer. + * @param endianness Endianness that will be used in the serialization of this value. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. + */ + template Cdr& serialize( - const std::bitset& value, + const _T& value, Endianness endianness) { bool auxSwap = m_swapBytes; @@ -1186,27 +896,6 @@ class Cdr_DllAPI Cdr return *this; } - /*! - * @brief Encodes the value of a type not managed by this encoder into the buffer. - * - * To do that, the encoder expects a function `serialize` is provided by the type. - * - * @param[in] value A reference to the value which will be encoded in the buffer. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer - * position that exceeds the internal memory size. - */ - template::value>::type* = nullptr, typename = void> - inline Cdr& serialize( - const _T& value) - { - extern void serialize( - Cdr&, - const _T&); - serialize(*this, value); - return *this; - } - /*! * @brief Encodes the value of a enumerator into the buffer. * @@ -1330,24 +1019,6 @@ class Cdr_DllAPI Cdr return serializeArray(reinterpret_cast(octet_t), numElements); } - /*! - * @brief This function serializes an array of octets with a different endianness. - * @param octet_t The array of octets that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const uint8_t* octet_t, - size_t numElements, - Endianness endianness) - { - (void) endianness; - return serializeArray(reinterpret_cast(octet_t), numElements); - } - /*! * @brief This function serializes an array of characters. * @param char_t The array of characters that will be serialized in the buffer. @@ -1359,24 +1030,6 @@ class Cdr_DllAPI Cdr const char* char_t, size_t numElements); - /*! - * @brief This function serializes an array of characters with a different endianness. - * @param char_t The array of characters that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const char* char_t, - size_t numElements, - Endianness endianness) - { - (void) endianness; - return serializeArray(char_t, numElements); - } - /*! * @brief This function serializes an array of int8_t. * @param int8 The sequence of int8_t that will be serialized in the buffer. @@ -1392,24 +1045,6 @@ class Cdr_DllAPI Cdr return serializeArray(reinterpret_cast(int8), numElements); } - /*! - * @brief This function serializes an array of int8_t with a different endianness. - * @param int8 The array of int8_t that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const int8_t* int8, - size_t numElements, - Endianness endianness) - { - (void) endianness; - return serializeArray(reinterpret_cast(int8), numElements); - } - /*! * @brief This function serializes an array of unsigned shorts. * @param ushort_t The array of unsigned shorts that will be serialized in the buffer. @@ -1425,23 +1060,6 @@ class Cdr_DllAPI Cdr return serializeArray(reinterpret_cast(ushort_t), numElements); } - /*! - * @brief This function serializes an array of unsigned shorts with a different endianness. - * @param ushort_t The array of unsigned shorts that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const uint16_t* ushort_t, - size_t numElements, - Endianness endianness) - { - return serializeArray(reinterpret_cast(ushort_t), numElements, endianness); - } - /*! * @brief This function serializes an array of shorts. * @param short_t The array of shorts that will be serialized in the buffer. @@ -1453,19 +1071,6 @@ class Cdr_DllAPI Cdr const int16_t* short_t, size_t numElements); - /*! - * @brief This function serializes an array of shorts with a different endianness. - * @param short_t The array of shorts that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serializeArray( - const int16_t* short_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function serializes an array of unsigned longs. * @param ulong_t The array of unsigned longs that will be serialized in the buffer. @@ -1481,23 +1086,6 @@ class Cdr_DllAPI Cdr return serializeArray(reinterpret_cast(ulong_t), numElements); } - /*! - * @brief This function serializes an array of unsigned longs with a different endianness. - * @param ulong_t The array of unsigned longs that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const uint32_t* ulong_t, - size_t numElements, - Endianness endianness) - { - return serializeArray(reinterpret_cast(ulong_t), numElements, endianness); - } - /*! * @brief This function serializes an array of longs. * @param long_t The array of longs that will be serialized in the buffer. @@ -1509,19 +1097,6 @@ class Cdr_DllAPI Cdr const int32_t* long_t, size_t numElements); - /*! - * @brief This function serializes an array of longs with a different endianness. - * @param long_t The array of longs that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serializeArray( - const int32_t* long_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function serializes an array of wide-chars. * @param wchar The array of wide-chars that will be serialized in the buffer. @@ -1533,19 +1108,6 @@ class Cdr_DllAPI Cdr const wchar_t* wchar, size_t numElements); - /*! - * @brief This function serializes an array of wide-chars with a different endianness. - * @param wchar The array of longs that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serializeArray( - const wchar_t* wchar, - size_t numElements, - Endianness endianness); - /*! * @brief This function serializes an array of unsigned long longs. * @param ulonglong_t The array of unsigned long longs that will be serialized in the buffer. @@ -1561,23 +1123,6 @@ class Cdr_DllAPI Cdr return serializeArray(reinterpret_cast(ulonglong_t), numElements); } - /*! - * @brief This function serializes an array of unsigned long longs with a different endianness. - * @param ulonglong_t The array of unsigned long longs that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const uint64_t* ulonglong_t, - size_t numElements, - Endianness endianness) - { - return serializeArray(reinterpret_cast(ulonglong_t), numElements, endianness); - } - /*! * @brief This function serializes an array of long longs. * @param longlong_t The array of long longs that will be serialized in the buffer. @@ -1589,19 +1134,6 @@ class Cdr_DllAPI Cdr const int64_t* longlong_t, size_t numElements); - /*! - * @brief This function serializes an array of long longs with a different endianness. - * @param longlong_t The array of long longs that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serializeArray( - const int64_t* longlong_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function serializes an array of floats. * @param float_t The array of floats that will be serialized in the buffer. @@ -1613,19 +1145,6 @@ class Cdr_DllAPI Cdr const float* float_t, size_t numElements); - /*! - * @brief This function serializes an array of floats with a different endianness. - * @param float_t The array of floats that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serializeArray( - const float* float_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function serializes an array of doubles. * @param double_t The array of doubles that will be serialized in the buffer. @@ -1637,19 +1156,6 @@ class Cdr_DllAPI Cdr const double* double_t, size_t numElements); - /*! - * @brief This function serializes an array of doubles with a different endianness. - * @param double_t The array of doubles that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serializeArray( - const double* double_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function serializes an array of long doubles. * @param ldouble_t The array of long doubles that will be serialized in the buffer. @@ -1661,19 +1167,6 @@ class Cdr_DllAPI Cdr const long double* ldouble_t, size_t numElements); - /*! - * @brief This function serializes an array of long doubles with a different endianness. - * @param ldouble_t The array of long doubles that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - Cdr& serializeArray( - const long double* ldouble_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function serializes an array of booleans. * @param bool_t The array of booleans that will be serialized in the buffer. @@ -1685,24 +1178,6 @@ class Cdr_DllAPI Cdr const bool* bool_t, size_t numElements); - /*! - * @brief This function serializes an array of booleans with a different endianness. - * @param bool_t The array of booleans that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const bool* bool_t, - size_t numElements, - Endianness endianness) - { - (void) endianness; - return serializeArray(bool_t, numElements); - } - /*! * @brief This function serializes an array of strings. * @param string_t The array of strings that will be serialized in the buffer. @@ -1762,104 +1237,6 @@ class Cdr_DllAPI Cdr return *this; } - /*! - * @brief This function serializes an array of strings with a different endianness. - * @param string_t The array of strings that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const std::string* string_t, - size_t numElements, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - serializeArray(string_t, numElements); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - - /*! - * @brief This function serializes an array of wide-strings with a different endianness. - * @param string_t The array of wide-strings that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - inline - Cdr& serializeArray( - const std::wstring* string_t, - size_t numElements, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - serializeArray(string_t, numElements); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - - /*! - * @brief Encodes an array of fixed strings with a different endianness. - * @param[in] value Array of fixed strings which will be encoded in the buffer. - * @param[in] num_elements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer - * position that exceeds the internal memory size. - */ - template - inline - Cdr& serializeArray( - const fixed_string* value, - size_t num_elements, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - serializeArray(value, num_elements); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - /*! * @brief Encodes an array of a type not managed by this encoder into the buffer. * @@ -2127,21 +1504,6 @@ class Cdr_DllAPI Cdr return deserialize(reinterpret_cast(octet_t)); } - /*! - * @brief This function deserializes an octet with a different endianness. - * @param octet_t The variable that will store the octet read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - uint8_t& octet_t, - Endianness endianness) - { - return deserialize(reinterpret_cast(octet_t), endianness); - } - /*! * @brief This function deserializes a character. * @param char_t The variable that will store the character read from the buffer. @@ -2151,22 +1513,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( char& char_t); - /*! - * @brief This function deserializes a character with a different endianness. - * @param char_t The variable that will store the character read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - char& char_t, - Endianness endianness) - { - (void) endianness; - return deserialize(char_t); - } - /*! * @brief This function deserializes an int8_t. * @param int8 The variable that will store the int8_t read from the buffer. @@ -2180,21 +1526,6 @@ class Cdr_DllAPI Cdr return deserialize(reinterpret_cast(int8)); } - /*! - * @brief This function deserializes an int8_t with a different endianness. - * @param int8 The variable that will store the int8_t read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - int8_t& int8, - Endianness endianness) - { - return deserialize(reinterpret_cast(int8), endianness); - } - /*! * @brief This function deserializes an unsigned short. * @param ushort_t The variable that will store the unsigned short read from the buffer. @@ -2208,21 +1539,6 @@ class Cdr_DllAPI Cdr return deserialize(reinterpret_cast(ushort_t)); } - /*! - * @brief This function deserializes an unsigned short with a different endianness. - * @param ushort_t The variable that will store the unsigned short read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - uint16_t& ushort_t, - Endianness endianness) - { - return deserialize(reinterpret_cast(ushort_t), endianness); - } - /*! * @brief This function deserializes a short. * @param short_t The variable that will store the short read from the buffer. @@ -2232,17 +1548,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( int16_t& short_t); - /*! - * @brief This function deserializes a short with a different endianness. - * @param short_t The variable that will store the short read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - int16_t& short_t, - Endianness endianness); - /*! * @brief This function deserializes an unsigned long. * @param ulong_t The variable that will store the unsigned long read from the buffer. @@ -2257,70 +1562,26 @@ class Cdr_DllAPI Cdr } /*! - * @brief This function deserializes an unsigned long with a different endianness. - * @param ulong_t The variable that will store the unsigned long read from the buffer.. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - uint32_t& ulong_t, - Endianness endianness) - { - return deserialize(reinterpret_cast(ulong_t), endianness); - } - - /*! - * @brief This function deserializes a long. - * @param long_t The variable that will store the long read from the buffer. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - int32_t& long_t); - - /*! - * @brief This function deserializes a long with a different endianness. - * @param long_t The variable that will store the long read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - int32_t& long_t, - Endianness endianness); - - /*! - * @brief This function deserializes a wide-char. - * @param wchar The variable that will store the wide-char read from the buffer. + * @brief This function deserializes a long. + * @param long_t The variable that will store the long read from the buffer. * @return Reference to the eprosima::fastcdr::Cdr object. * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. */ - inline Cdr& deserialize( - wchar_t& wchar) - { - uint32_t ret; - deserialize(ret); - wchar = static_cast(ret); - return *this; - } + int32_t& long_t); /*! - * @brief This function deserializes a wide-char with a different endianness. + * @brief This function deserializes a wide-char. * @param wchar The variable that will store the wide-char read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. * @return Reference to the eprosima::fastcdr::Cdr object. * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. */ inline Cdr& deserialize( - wchar_t& wchar, - Endianness endianness) + wchar_t& wchar) { uint32_t ret; - deserialize(ret, endianness); + deserialize(ret); wchar = static_cast(ret); return *this; } @@ -2338,21 +1599,6 @@ class Cdr_DllAPI Cdr return deserialize(reinterpret_cast(ulonglong_t)); } - /*! - * @brief This function deserializes an unsigned long long with a different endianness. - * @param ulonglong_t The variable that will store the unsigned long long read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - uint64_t& ulonglong_t, - Endianness endianness) - { - return deserialize(reinterpret_cast(ulonglong_t), endianness); - } - /*! * @brief This function deserializes a long long. * @param longlong_t The variable that will store the long long read from the buffer. @@ -2362,17 +1608,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( int64_t& longlong_t); - /*! - * @brief This function deserializes a long long with a different endianness. - * @param longlong_t The variable that will store the long long read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - int64_t& longlong_t, - Endianness endianness); - /*! * @brief This function deserializes a float. * @param float_t The variable that will store the float read from the buffer. @@ -2382,17 +1617,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( float& float_t); - /*! - * @brief This function deserializes a float with a different endianness. - * @param float_t The variable that will store the float read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - float& float_t, - Endianness endianness); - /*! * @brief This function deserializes a double. * @param double_t The variable that will store the double read from the buffer. @@ -2402,17 +1626,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( double& double_t); - /*! - * @brief This function deserializes a double with a different endianness. - * @param double_t The variable that will store the double read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - double& double_t, - Endianness endianness); - /*! * @brief This function deserializes a long double. * @param ldouble_t The variable that will store the long double read from the buffer. @@ -2423,18 +1636,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( long double& ldouble_t); - /*! - * @brief This function deserializes a long double with a different endianness. - * @param ldouble_t The variable that will store the long double read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - * @note Due to internal representation differences, WIN32 and *NIX like systems are not compatible. - */ - Cdr& deserialize( - long double& ldouble_t, - Endianness endianness); - /*! * @brief This function deserializes a boolean. * @param bool_t The variable that will store the boolean read from the buffer. @@ -2445,23 +1646,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( bool& bool_t); - /*! - * @brief This function deserializes a boolean with a different endianness. - * @param bool_t The variable that will store the boolean read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - * @exception exception::BadParamException This exception is thrown when trying to deserialize an invalid value. - */ - inline - Cdr& deserialize( - bool& bool_t, - Endianness endianness) - { - (void) endianness; - return deserialize(bool_t); - } - /*! * @brief This function deserializes a string. * This function allocates memory to store the string. The user pointer will be set to point this allocated memory. @@ -2486,34 +1670,6 @@ class Cdr_DllAPI Cdr Cdr& deserialize( wchar_t*& string_t); - /*! - * @brief This function deserializes a string with a different endianness. - * This function allocates memory to store the string. The user pointer will be set to point this allocated memory. - * The user will have to free this allocated memory using free() - * @param string_t The pointer that will point to the string read from the buffer. - * @param endianness Endianness that will be used in the deserialization of this value. - * The user will have to free the allocated memory using free() - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - char*& string_t, - Endianness endianness); - - /*! - * @brief This function deserializes a wide string with a different endianness. - * This function allocates memory to store the wide string. The user pointer will be set to point this allocated memory. - * The user will have to free this allocated memory using free() - * @param string_t The pointer that will point to the wide string read from the buffer. - * @param endianness Endianness that will be used in the deserialization of this value. - * The user will have to free the allocated memory using free() - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserialize( - wchar_t*& string_t, - Endianness endianness); - /*! * @brief This function deserializes a std::string. * @param string_t The variable that will store the string read from the buffer. @@ -2562,97 +1718,6 @@ class Cdr_DllAPI Cdr return *this; } - /*! - * @brief This function deserializes a string with a different endianness. - * @param string_t The variable that will store the string read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - std::string& string_t, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - deserialize(string_t); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - - /*! - * @brief This function deserializes a string with a different endianness. - * @param string_t The variable that will store the string read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserialize( - std::wstring& string_t, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - deserialize(string_t); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - - /*! - * @brief Decodes a fixed string with a different endianness. - * @param[out] value Reference to the variable where the fixed string will be stored after decoding from the buffer. - * @param[in] endianness Endianness that will be used in the encoding of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to decode from a buffer - * position that exceeds the internal memory size. - */ - template - Cdr& deserialize( - fixed_string& value, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - deserialize(value); - m_swapBytes = auxSwap; - } - catch (eprosima::fastcdr::exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - /*! * @brief This function template deserializes an array. * @param array_t The variable that will store the array read from the buffer. @@ -2686,21 +1751,6 @@ class Cdr_DllAPI Cdr return *this; } - /*! - * @brief This function template deserializes an array with a different endianness. - * @param array_t The variable that will store the array read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - template - inline Cdr& deserialize( - std::array<_T, _Size>& array_t, - Endianness endianness) - { - return deserializeArray(array_t.data(), array_t.size(), endianness); - } - /*! * @brief This function template deserializes a sequence. * @param vector_t The variable that will store the sequence read from the buffer. @@ -2939,75 +1989,15 @@ class Cdr_DllAPI Cdr * @return Reference to the eprosima::fastcdr::Cdr object. * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. */ - template<> - Cdr& deserialize( - std::vector& vector_t) - { - return deserializeBoolSequence(vector_t); - } - -#endif // ifdef _MSC_VER - - /*! - * @brief This function template deserializes a sequence with a different endianness. - * @param vector_t The variable that will store the sequence read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - template - Cdr& deserialize( - std::vector<_T>& vector_t, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - deserialize(vector_t); - m_swapBytes = auxSwap; - } - catch (exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; - } - - /*! - * @brief This function template deserializes a map with a different endianness. - * @param vector_t The variable that will store the map read from the buffer. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - template - Cdr& deserialize( - std::map<_K, _T>& value, - Endianness endianness) - { - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (static_cast(m_endianness) == endianness)) || - (!m_swapBytes && (static_cast(m_endianness) != endianness)); - - try - { - deserialize(value); - m_swapBytes = auxSwap; - } - catch (exception::Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; + template<> + Cdr& deserialize( + std::vector& vector_t) + { + return deserializeBoolSequence(vector_t); } +#endif // ifdef _MSC_VER + /*! * @brief Decodes a bitset from the buffer. * @param[out] value Reference to the variable where the bitset will be stored after decoding from the buffer. @@ -3056,15 +2046,37 @@ class Cdr_DllAPI Cdr } /*! - * @brief This function template deserializes a bitset with a different endianness. - * @param vector_t The variable that will store the bitset read from the buffer. + * @brief Decodes the value of a type from the buffer. + * + * To do that, the encoder expects a function `deserialize` is provided by the type. + * + * @param[out] value Reference to the variable where the value will be stored after decoding from the buffer. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to decode from a buffer + * position that exceeds the internal memory size. + */ + template::value>::type* = nullptr, typename = void> + inline Cdr& deserialize( + _T& value) + { + extern void deserialize( + Cdr&, + _T&); + deserialize(*this, value); + return *this; + } + + /*! + * @brief Decodes the value of a type with a different endianness. + * @param[out] value Reference to the variable where the value will be stored after decoding from the buffer. * @param endianness Endianness that will be used in the serialization of this value. * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to decode from a buffer + * position that exceeds the internal memory size. */ - template + template Cdr& deserialize( - std::bitset& value, + _T& value, Endianness endianness) { bool auxSwap = m_swapBytes; @@ -3085,27 +2097,6 @@ class Cdr_DllAPI Cdr return *this; } - /*! - * @brief Decodes the value of a type not managed by this encoder from the buffer. - * - * To do that, the encoder expects a function `deserialize` is provided by the type. - * - * @param[out] value Reference to the variable where the value will be stored after decoding from the buffer. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to decode from a buffer - * position that exceeds the internal memory size. - */ - template::value>::type* = nullptr, typename = void> - inline Cdr& deserialize( - _T& value) - { - extern void deserialize( - Cdr&, - _T&); - deserialize(*this, value); - return *this; - } - /*! * @brief Decodes an enumeration from the buffer. * @param[out] value Reference to the variable where the enumeration will be stored after decoding from the buffer. @@ -3241,23 +2232,6 @@ class Cdr_DllAPI Cdr return deserializeArray(reinterpret_cast(octet_t), numElements); } - /*! - * @brief This function deserializes an array of octets with a different endianness. - * @param octet_t The variable that will store the array of octets read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserializeArray( - uint8_t* octet_t, - size_t numElements, - Endianness endianness) - { - return deserializeArray(reinterpret_cast(octet_t), numElements, endianness); - } - /*! * @brief This function deserializes an array of characters. * @param char_t The variable that will store the array of characters read from the buffer. @@ -3269,24 +2243,6 @@ class Cdr_DllAPI Cdr char* char_t, size_t numElements); - /*! - * @brief This function deserializes an array of characters with a different endianness. - * @param char_t The variable that will store the array of characters read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserializeArray( - char* char_t, - size_t numElements, - Endianness endianness) - { - (void) endianness; - return deserializeArray(char_t, numElements); - } - /*! * @brief This function deserializes an array of int8_t. * @param int8 The variable that will store the array of int8_t read from the buffer. @@ -3302,23 +2258,6 @@ class Cdr_DllAPI Cdr return deserializeArray(reinterpret_cast(int8), numElements); } - /*! - * @brief This function deserializes an array of int8_t with a different endianness. - * @param int8 The variable that will store the array of int8_t read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserializeArray( - int8_t* int8, - size_t numElements, - Endianness endianness) - { - return deserializeArray(reinterpret_cast(int8), numElements, endianness); - } - /*! * @brief This function deserializes an array of unsigned shorts. * @param ushort_t The variable that will store the array of unsigned shorts read from the buffer. @@ -3334,23 +2273,6 @@ class Cdr_DllAPI Cdr return deserializeArray(reinterpret_cast(ushort_t), numElements); } - /*! - * @brief This function deserializes an array of unsigned shorts with a different endianness. - * @param ushort_t The variable that will store the array of unsigned shorts read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserializeArray( - uint16_t* ushort_t, - size_t numElements, - Endianness endianness) - { - return deserializeArray(reinterpret_cast(ushort_t), numElements, endianness); - } - /*! * @brief This function deserializes an array of shorts. * @param short_t The variable that will store the array of shorts read from the buffer. @@ -3362,19 +2284,6 @@ class Cdr_DllAPI Cdr int16_t* short_t, size_t numElements); - /*! - * @brief This function deserializes an array of shorts with a different endianness. - * @param short_t The variable that will store the array of shorts read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserializeArray( - int16_t* short_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function deserializes an array of unsigned longs. * @param ulong_t The variable that will store the array of unsigned longs read from the buffer. @@ -3390,23 +2299,6 @@ class Cdr_DllAPI Cdr return deserializeArray(reinterpret_cast(ulong_t), numElements); } - /*! - * @brief This function deserializes an array of unsigned longs with a different endianness. - * @param ulong_t The variable that will store the array of unsigned longs read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserializeArray( - uint32_t* ulong_t, - size_t numElements, - Endianness endianness) - { - return deserializeArray(reinterpret_cast(ulong_t), numElements, endianness); - } - /*! * @brief This function deserializes an array of longs. * @param long_t The variable that will store the array of longs read from the buffer. @@ -3418,19 +2310,6 @@ class Cdr_DllAPI Cdr int32_t* long_t, size_t numElements); - /*! - * @brief This function deserializes an array of longs with a different endianness. - * @param long_t The variable that will store the array of longs read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserializeArray( - int32_t* long_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function deserializes an array of wide-chars. * @param wchar The variable that will store the array of wide-chars read from the buffer. @@ -3442,19 +2321,6 @@ class Cdr_DllAPI Cdr wchar_t* wchar, size_t numElements); - /*! - * @brief This function deserializes an array of wide-chars with a different endianness. - * @param wchar The variable that will store the array of wide-chars read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserializeArray( - wchar_t* wchar, - size_t numElements, - Endianness endianness); - /*! * @brief This function deserializes an array of unsigned long longs. * @param ulonglong_t The variable that will store the array of unsigned long longs read from the buffer. @@ -3470,23 +2336,6 @@ class Cdr_DllAPI Cdr return deserializeArray(reinterpret_cast(ulonglong_t), numElements); } - /*! - * @brief This function deserializes an array of unsigned long longs with a different endianness. - * @param ulonglong_t The variable that will store the array of unsigned long longs read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserializeArray( - uint64_t* ulonglong_t, - size_t numElements, - Endianness endianness) - { - return deserializeArray(reinterpret_cast(ulonglong_t), numElements, endianness); - } - /*! * @brief This function deserializes an array of long longs. * @param longlong_t The variable that will store the array of long longs read from the buffer. @@ -3498,19 +2347,6 @@ class Cdr_DllAPI Cdr int64_t* longlong_t, size_t numElements); - /*! - * @brief This function deserializes an array of long longs with a different endianness. - * @param longlong_t The variable that will store the array of long longs read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserializeArray( - int64_t* longlong_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function deserializes an array of floats. * @param float_t The variable that will store the array of floats read from the buffer. @@ -3522,19 +2358,6 @@ class Cdr_DllAPI Cdr float* float_t, size_t numElements); - /*! - * @brief This function deserializes an array of floats with a different endianness. - * @param float_t The variable that will store the array of floats read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserializeArray( - float* float_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function deserializes an array of doubles. * @param double_t The variable that will store the array of doubles read from the buffer. @@ -3546,19 +2369,6 @@ class Cdr_DllAPI Cdr double* double_t, size_t numElements); - /*! - * @brief This function deserializes an array of doubles with a different endianness. - * @param double_t The variable that will store the array of doubles read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserializeArray( - double* double_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function deserializes an array of long doubles. * @param ldouble_t The variable that will store the array of long doubles read from the buffer. @@ -3570,19 +2380,6 @@ class Cdr_DllAPI Cdr long double* ldouble_t, size_t numElements); - /*! - * @brief This function deserializes an array of long doubles with a different endianness. - * @param ldouble_t The variable that will store the array of long doubles read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - Cdr& deserializeArray( - long double* ldouble_t, - size_t numElements, - Endianness endianness); - /*! * @brief This function deserializes an array of booleans. * @param bool_t The variable that will store the array of booleans read from the buffer. @@ -3594,24 +2391,6 @@ class Cdr_DllAPI Cdr bool* bool_t, size_t numElements); - /*! - * @brief This function deserializes an array of booleans with a different endianness. - * @param bool_t The variable that will store the array of booleans read from the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to deserialize a position that exceeds the internal memory size. - */ - inline - Cdr& deserializeArray( - bool* bool_t, - size_t numElements, - Endianness endianness) - { - (void) endianness; - return deserializeArray(bool_t, numElements); - } - /*! * @brief Decodes an array of a type not managed by this encoder from the buffer. * @@ -4197,23 +2976,6 @@ class Cdr_DllAPI Cdr return serializeArray(array_t->data(), numElements * array_t->size()); } - /*! - * @brief This function template detects the content type of the STD container array and serializes the array with a different endianness. - * @param array_t The array that will be serialized in the buffer. - * @param numElements Number of the elements in the array. - * @param endianness Endianness that will be used in the serialization of this value. - * @return Reference to the eprosima::fastcdr::Cdr object. - * @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size. - */ - template - Cdr& serializeArray( - const std::array<_T, _Size>* array_t, - size_t numElements, - Endianness endianness) - { - return serializeArray(array_t->data(), numElements * array_t->size(), endianness); - } - /*! * @brief This function template detects the content type of the STD container array and deserializes the array. * @param array_t The variable that will store the array read from the buffer. diff --git a/src/cpp/Cdr.cpp b/src/cpp/Cdr.cpp index 8194c892..00b75b86 100644 --- a/src/cpp/Cdr.cpp +++ b/src/cpp/Cdr.cpp @@ -439,27 +439,6 @@ Cdr& Cdr::serialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serialize( - const int16_t short_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(short_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serialize( const int32_t long_t) { @@ -495,27 +474,6 @@ Cdr& Cdr::serialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serialize( - const int32_t long_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(long_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serialize( const int64_t longlong_t) { @@ -555,27 +513,6 @@ Cdr& Cdr::serialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serialize( - const int64_t longlong_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(longlong_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serialize( const float float_t) { @@ -611,27 +548,6 @@ Cdr& Cdr::serialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serialize( - const float float_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(float_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serialize( const double double_t) { @@ -671,27 +587,6 @@ Cdr& Cdr::serialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serialize( - const double double_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(double_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serialize( const long double ldouble_t) { @@ -781,27 +676,6 @@ Cdr& Cdr::serialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serialize( - const long double ldouble_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(ldouble_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serialize( const bool bool_t) { @@ -925,48 +799,6 @@ Cdr& Cdr::serialize( return *this; } -Cdr& Cdr::serialize( - const char* string_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(string_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - -Cdr& Cdr::serialize( - const wchar_t* string_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serialize(string_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeArray( const bool* bool_t, size_t numElements) @@ -1061,28 +893,6 @@ Cdr& Cdr::serializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serializeArray( - const int16_t* short_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serializeArray(short_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeArray( const int32_t* long_t, size_t numElements) @@ -1132,28 +942,6 @@ Cdr& Cdr::serializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serializeArray( - const int32_t* long_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serializeArray(long_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeArray( const wchar_t* wchar, size_t numElements) @@ -1170,28 +958,6 @@ Cdr& Cdr::serializeArray( return *this; } -Cdr& Cdr::serializeArray( - const wchar_t* wchar, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serializeArray(wchar, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeArray( const int64_t* longlong_t, size_t numElements) @@ -1245,28 +1011,6 @@ Cdr& Cdr::serializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serializeArray( - const int64_t* longlong_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serializeArray(longlong_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeArray( const float* float_t, size_t numElements) @@ -1316,28 +1060,6 @@ Cdr& Cdr::serializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serializeArray( - const float* float_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serializeArray(float_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeArray( const double* double_t, size_t numElements) @@ -1391,28 +1113,6 @@ Cdr& Cdr::serializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serializeArray( - const double* double_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serializeArray(double_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeArray( const long double* ldouble_t, size_t numElements) @@ -1536,28 +1236,6 @@ Cdr& Cdr::serializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::serializeArray( - const long double* ldouble_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - serializeArray(ldouble_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserialize( char& char_t) { @@ -1606,27 +1284,6 @@ Cdr& Cdr::deserialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserialize( - int16_t& short_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(short_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserialize( int32_t& long_t) { @@ -1662,27 +1319,6 @@ Cdr& Cdr::deserialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserialize( - int32_t& long_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(long_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserialize( int64_t& longlong_t) { @@ -1722,27 +1358,6 @@ Cdr& Cdr::deserialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserialize( - int64_t& longlong_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(longlong_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserialize( float& float_t) { @@ -1778,27 +1393,6 @@ Cdr& Cdr::deserialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserialize( - float& float_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(float_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserialize( double& double_t) { @@ -1838,27 +1432,6 @@ Cdr& Cdr::deserialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserialize( - double& double_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(double_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserialize( long double& ldouble_t) { @@ -1941,27 +1514,6 @@ Cdr& Cdr::deserialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserialize( - long double& ldouble_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(ldouble_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserialize( bool& bool_t) { @@ -2061,48 +1613,6 @@ Cdr& Cdr::deserialize( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserialize( - char*& string_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(string_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - -Cdr& Cdr::deserialize( - wchar_t*& string_t, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserialize(string_t); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - const char* Cdr::readString( uint32_t& length) { @@ -2265,28 +1775,6 @@ Cdr& Cdr::deserializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserializeArray( - int16_t* short_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserializeArray(short_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserializeArray( int32_t* long_t, size_t numElements) @@ -2336,28 +1824,6 @@ Cdr& Cdr::deserializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserializeArray( - int32_t* long_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserializeArray(long_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserializeArray( wchar_t* wchar, size_t numElements) @@ -2376,28 +1842,6 @@ Cdr& Cdr::deserializeArray( return *this; } -Cdr& Cdr::deserializeArray( - wchar_t* wchar, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserializeArray(wchar, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserializeArray( int64_t* longlong_t, size_t numElements) @@ -2451,28 +1895,6 @@ Cdr& Cdr::deserializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserializeArray( - int64_t* longlong_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserializeArray(longlong_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserializeArray( float* float_t, size_t numElements) @@ -2522,28 +1944,6 @@ Cdr& Cdr::deserializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserializeArray( - float* float_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserializeArray(float_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserializeArray( double* double_t, size_t numElements) @@ -2597,28 +1997,6 @@ Cdr& Cdr::deserializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserializeArray( - double* double_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserializeArray(double_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::deserializeArray( long double* ldouble_t, size_t numElements) @@ -2734,28 +2112,6 @@ Cdr& Cdr::deserializeArray( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } -Cdr& Cdr::deserializeArray( - long double* ldouble_t, - size_t numElements, - Endianness endianness) -{ - bool auxSwap = m_swapBytes; - m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness)); - - try - { - deserializeArray(ldouble_t, numElements); - m_swapBytes = auxSwap; - } - catch (Exception& ex) - { - m_swapBytes = auxSwap; - ex.raise(); - } - - return *this; -} - Cdr& Cdr::serializeBoolSequence( const std::vector& vector_t) {