pjmsg_mcap_wrapper
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
eprosima::fastcdr::Cdr Class Reference

Detailed Description

This class offers an interface to serialize/deserialize some basic types using CDR protocol inside an eprosima::fastcdr::FastBuffer.

Definition at line 68 of file Cdr.h.

#include <Cdr.h>

Classes

class  state
 This class stores the current state of a CDR serialization. More...
 

Public Types

enum  Endianness : uint8_t {
  BIG_ENDIANNESS = 0x0 ,
  LITTLE_ENDIANNESS = 0x1
}
 This enumeration represents endianness types. More...
 
enum  XCdrHeaderSelection {
  SHORT_HEADER ,
  LONG_HEADER ,
  AUTO_WITH_SHORT_HEADER_BY_DEFAULT ,
  AUTO_WITH_LONG_HEADER_BY_DEFAULT
}
 

Public Member Functions

Cdr_DllAPI Cdr (FastBuffer &cdr_buffer, const Endianness endianness=DEFAULT_ENDIAN, const CdrVersion cdr_version=XCDRv2)
 This constructor creates an eprosima::fastcdr::Cdr object that can serialize/deserialize the assigned buffer.
 
Cdr_DllAPI Cdrread_encapsulation ()
 This function reads the encapsulation of the CDR stream. If the CDR stream contains an encapsulation, then this function should be called before starting to deserialize. CdrVersion and EncodingAlgorithmFlag internal values will be changed to the ones specified by the encapsulation.
 
Cdr_DllAPI Cdrserialize_encapsulation ()
 This function writes the encapsulation of the CDR stream. If the CDR stream should contain an encapsulation, then this function should be called before starting to serialize.
 
Cdr_DllAPI CdrVersion get_cdr_version () const
 Retrieves the CdrVersion used by the instance.
 
Cdr_DllAPI EncodingAlgorithmFlag get_encoding_flag () const
 Returns the EncodingAlgorithmFlag set in the encapsulation when the CDR type is CdrVersion::DDS_CDR, CdrVersion::XCDRv1 or CdrVersion::XCDRv2.
 
Cdr_DllAPI bool set_encoding_flag (EncodingAlgorithmFlag encoding_flag)
 Sets the EncodingAlgorithmFlag for the encapsulation when the CDR type is CdrVersion::DDS_CDR, CdrVersion::XCDRv1 or CdrVersion::XCDRv2. This function only works when is called before starting the encoding/decoding.
 
Cdr_DllAPI std::array< uint8_t, 2 > get_dds_cdr_options () const
 This function returns the option flags when the CDR type is eprosima::fastcdr::DDS_CDR.
 
Cdr_DllAPI void set_dds_cdr_options (const std::array< uint8_t, 2 > &options)
 This function sets the option flags when the CDR type is eprosima::fastcdr::DDS_CDR.
 
Cdr_DllAPI void change_endianness (Endianness endianness)
 This function sets the current endianness used by the CDR type.
 
Cdr_DllAPI Endianness endianness () const
 This function returns the current endianness used by the CDR type.
 
Cdr_DllAPI bool jump (size_t num_bytes)
 This function skips a number of bytes in the CDR stream buffer.
 
Cdr_DllAPI void reset ()
 This function resets the current position in the buffer to the beginning.
 
Cdr_DllAPI char * get_buffer_pointer ()
 This function returns the pointer to the current used buffer.
 
Cdr_DllAPI char * get_current_position ()
 This function returns the current position in the CDR stream.
 
Cdr_DllAPI size_t get_serialized_data_length () const
 This function returns the length of the serialized data inside the stream.
 
Cdr_DllAPI state get_state () const
 Returns the current state of the CDR serialization process.
 
Cdr_DllAPI void set_state (const state &state)
 Sets a previous state of the CDR serialization process;.
 
Cdr_DllAPI bool move_alignment_forward (size_t num_bytes)
 This function moves the alignment forward.
 
void reset_alignment ()
 This function resets the alignment to the current position in the buffer.
 
template<class _T >
Cdroperator<< (const _T &value)
 Encodes the value into the buffer.
 
template<class _T >
Cdroperator>> (_T &value)
 Decodes the value from the buffer.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value >::type * = nullptr, typename = void>
Cdrserialize (const _T &value)
 Encodes the value of a type into the buffer.
 
template<class _T >
Cdrserialize (const _T &value, Endianness endianness)
 Encodes the value of a type with a different endianness.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int32_t >::value >::type * = nullptr>
Cdrserialize (const _T &value)
 Encodes the value of a enumerator into the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint32_t >::value >::type * = nullptr>
Cdrserialize (const _T &value)
 Encodes the value of a enumerator into the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int16_t >::value >::type * = nullptr>
Cdrserialize (const _T &value)
 Encodes the value of a enumerator into the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint16_t >::value >::type * = nullptr>
Cdrserialize (const _T &value)
 Encodes the value of a enumerator into the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int8_t >::value >::type * = nullptr>
Cdrserialize (const _T &value)
 Encodes the value of a enumerator into the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint8_t >::value >::type * = nullptr>
Cdrserialize (const _T &value)
 Encodes the value of a enumerator into the buffer.
 
Cdr_DllAPI Cdrserialize (const uint8_t &octet_t)
 This function serializes an octet.
 
Cdr_DllAPI Cdrserialize (const char char_t)
 This function serializes a character.
 
Cdr_DllAPI Cdrserialize (const int8_t int8)
 This function serializes an int8_t.
 
Cdr_DllAPI Cdrserialize (const uint16_t ushort_t)
 This function serializes an unsigned short.
 
Cdr_DllAPI Cdrserialize (const int16_t short_t)
 This function serializes a short.
 
Cdr_DllAPI Cdrserialize (const uint32_t ulong_t)
 This function serializes an unsigned long.
 
Cdr_DllAPI Cdrserialize (const int32_t long_t)
 This function serializes a long.
 
Cdr_DllAPI Cdrserialize (const wchar_t wchar)
 This function serializes a wide-char.
 
Cdr_DllAPI Cdrserialize (const uint64_t ulonglong_t)
 This function serializes an unsigned long long.
 
Cdr_DllAPI Cdrserialize (const int64_t longlong_t)
 This function serializes a long long.
 
Cdr_DllAPI Cdrserialize (const float float_t)
 This function serializes a float.
 
Cdr_DllAPI Cdrserialize (const double double_t)
 This function serializes a double.
 
Cdr_DllAPI Cdrserialize (const long double ldouble_t)
 This function serializes a long double.
 
Cdr_DllAPI Cdrserialize (const bool bool_t)
 This function serializes a boolean.
 
Cdr_DllAPI Cdrserialize (char *string_t)
 This function serializes a string.
 
Cdr_DllAPI Cdrserialize (const char *string_t)
 This function serializes a string.
 
Cdr_DllAPI Cdrserialize (const wchar_t *string_t)
 This function serializes a wstring.
 
TEMPLATE_SPEC Cdrserialize (const std::string &string_t)
 This function serializes a std::string.
 
TEMPLATE_SPEC Cdrserialize (const std::wstring &string_t)
 This function serializes a std::wstring.
 
template<size_t MAX_CHARS>
Cdrserialize (const fixed_string< MAX_CHARS > &value)
 Encodes a eprosima::fastcdr::fixed_string in the buffer.
 
template<class _T , size_t _Size>
Cdrserialize (const std::array< _T, _Size > &array_t)
 This function template serializes an array.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize (const std::vector< _T > &vector_t)
 This function template serializes a sequence of non-primitive.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize (const std::vector< _T > &vector_t)
 This function template serializes a sequence of primitive.
 
TEMPLATE_SPEC Cdrserialize (const std::vector< bool > &vector_t)
 This function template serializes a sequence of booleans.
 
template<class _K , class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize (const std::map< _K, _T > &map_t)
 This function template serializes a map of non-primitive.
 
template<class _K , class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize (const std::map< _K, _T > &map_t)
 This function template serializes a map of primitive.
 
template<size_t N, typename std::enable_if<(N< 9) > ::type * = nullptr>
Cdrserialize (const std::bitset< N > &value)
 Encodes the value of a bitset into the buffer.
 
template<size_t N, typename std::enable_if<(8< N &&N< 17) > ::type * = nullptr>
Cdrserialize (const std::bitset< N > &value)
 
template<size_t N, typename std::enable_if<(16< N &&N< 33) > ::type * = nullptr>
Cdrserialize (const std::bitset< N > &value)
 
template<size_t N, typename std::enable_if<(32< N &&N< 65) > ::type * = nullptr>
Cdrserialize (const std::bitset< N > &value)
 
template<class _T >
Cdrserialize_array (const _T *value, size_t num_elements)
 Encodes an array of a type not managed by this encoder into the buffer.
 
template<class _T >
Cdrserialize_array (const _T *type_t, size_t num_elements, Endianness endianness)
 This function template serializes an array of non-basic objects with a different endianness.
 
TEMPLATE_SPEC Cdrserialize_array (const uint8_t *octet_t, size_t num_elements)
 This function serializes an array of octets.
 
Cdr_DllAPI Cdrserialize_array (const char *char_t, size_t num_elements)
 This function serializes an array of characters.
 
TEMPLATE_SPEC Cdrserialize_array (const int8_t *int8, size_t num_elements)
 This function serializes an array of int8_t.
 
TEMPLATE_SPEC Cdrserialize_array (const uint16_t *ushort_t, size_t num_elements)
 This function serializes an array of unsigned shorts.
 
Cdr_DllAPI Cdrserialize_array (const int16_t *short_t, size_t num_elements)
 This function serializes an array of shorts.
 
TEMPLATE_SPEC Cdrserialize_array (const uint32_t *ulong_t, size_t num_elements)
 This function serializes an array of unsigned longs.
 
Cdr_DllAPI Cdrserialize_array (const int32_t *long_t, size_t num_elements)
 This function serializes an array of longs.
 
Cdr_DllAPI Cdrserialize_array (const wchar_t *wchar, size_t num_elements)
 This function serializes an array of wide-chars.
 
TEMPLATE_SPEC Cdrserialize_array (const uint64_t *ulonglong_t, size_t num_elements)
 This function serializes an array of unsigned long longs.
 
Cdr_DllAPI Cdrserialize_array (const int64_t *longlong_t, size_t num_elements)
 This function serializes an array of long longs.
 
Cdr_DllAPI Cdrserialize_array (const float *float_t, size_t num_elements)
 This function serializes an array of floats.
 
Cdr_DllAPI Cdrserialize_array (const double *double_t, size_t num_elements)
 This function serializes an array of doubles.
 
Cdr_DllAPI Cdrserialize_array (const long double *ldouble_t, size_t num_elements)
 This function serializes an array of long doubles.
 
Cdr_DllAPI Cdrserialize_array (const bool *bool_t, size_t num_elements)
 This function serializes an array of booleans.
 
TEMPLATE_SPEC Cdrserialize_array (const std::string *string_t, size_t num_elements)
 This function serializes an array of strings.
 
TEMPLATE_SPEC Cdrserialize_array (const std::wstring *string_t, size_t num_elements)
 This function serializes an array of wide-strings.
 
template<size_t MAX_CHARS>
Cdrserialize_array (const fixed_string< MAX_CHARS > *value, size_t num_elements)
 Encodes an array of fixed strings.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize_array (const std::vector< _T > &value)
 Encodes an std::vector of primitives as an array.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize_array (const std::vector< _T > &value)
 Encodes an std::vector of non-primitives as an array.
 
template<class _T >
Cdrserialize_array (const std::vector< _T > &value, Endianness endianness)
 Encodes an std::vector as an array with a different endianness.
 
TEMPLATE_SPEC Cdrserialize_array (const std::vector< bool > &value)
 Encodes an std::vector of booleans as an array.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize_sequence (const _T *sequence_t, size_t num_elements)
 This function template serializes a raw sequence of non-primitives.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrserialize_sequence (const _T *sequence_t, size_t num_elements)
 This function template serializes a raw sequence of primitives.
 
template<class _T >
Cdrserialize_sequence (const _T *sequence_t, size_t num_elements, Endianness endianness)
 This function template serializes a raw sequence with a different endianness.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value >::type * = nullptr, typename = void>
Cdrdeserialize (_T &value)
 Decodes the value of a type from the buffer.
 
template<class _T >
Cdrdeserialize (_T &value, Endianness endianness)
 Decodes the value of a type with a different endianness.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int32_t >::value >::type * = nullptr>
Cdrdeserialize (_T &value)
 Decodes an enumeration from the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint32_t >::value >::type * = nullptr>
Cdrdeserialize (_T &value)
 Decodes an enumeration from the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int16_t >::value >::type * = nullptr>
Cdrdeserialize (_T &value)
 Decodes an enumeration from the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint16_t >::value >::type * = nullptr>
Cdrdeserialize (_T &value)
 Decodes an enumeration from the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int8_t >::value >::type * = nullptr>
Cdrdeserialize (_T &value)
 Decodes an enumeration from the buffer.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint8_t >::value >::type * = nullptr>
Cdrdeserialize (_T &value)
 Decodes an enumeration from the buffer.
 
TEMPLATE_SPEC Cdrdeserialize (uint8_t &octet_t)
 This function deserializes an octet.
 
Cdr_DllAPI Cdrdeserialize (char &char_t)
 This function deserializes a character.
 
TEMPLATE_SPEC Cdrdeserialize (int8_t &int8)
 This function deserializes an int8_t.
 
TEMPLATE_SPEC Cdrdeserialize (uint16_t &ushort_t)
 This function deserializes an unsigned short.
 
Cdr_DllAPI Cdrdeserialize (int16_t &short_t)
 This function deserializes a short.
 
TEMPLATE_SPEC Cdrdeserialize (uint32_t &ulong_t)
 This function deserializes an unsigned long.
 
Cdr_DllAPI Cdrdeserialize (int32_t &long_t)
 This function deserializes a long.
 
TEMPLATE_SPEC Cdrdeserialize (wchar_t &wchar)
 This function deserializes a wide-char.
 
TEMPLATE_SPEC Cdrdeserialize (uint64_t &ulonglong_t)
 This function deserializes an unsigned long long.
 
Cdr_DllAPI Cdrdeserialize (int64_t &longlong_t)
 This function deserializes a long long.
 
Cdr_DllAPI Cdrdeserialize (float &float_t)
 This function deserializes a float.
 
Cdr_DllAPI Cdrdeserialize (double &double_t)
 This function deserializes a double.
 
Cdr_DllAPI Cdrdeserialize (long double &ldouble_t)
 This function deserializes a long double.
 
Cdr_DllAPI Cdrdeserialize (bool &bool_t)
 This function deserializes a boolean.
 
Cdr_DllAPI Cdrdeserialize (char *&string_t)
 This function deserializes a string. 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()
 
Cdr_DllAPI Cdrdeserialize (wchar_t *&string_t)
 This function deserializes a wide-string. 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()
 
TEMPLATE_SPEC Cdrdeserialize (std::string &string_t)
 This function deserializes a std::string.
 
TEMPLATE_SPEC Cdrdeserialize (std::wstring &string_t)
 This function deserializes a std::wstring.
 
template<size_t MAX_CHARS>
Cdrdeserialize (fixed_string< MAX_CHARS > &value)
 Decodes a fixed string.
 
template<class _T , size_t _Size>
Cdrdeserialize (std::array< _T, _Size > &array_t)
 This function template deserializes an array.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize (std::vector< _T > &vector_t)
 This function template deserializes a sequence of non-primitive.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize (std::vector< _T > &vector_t)
 This function template deserializes a sequence of primitive.
 
TEMPLATE_SPEC Cdrdeserialize (std::vector< bool > &vector_t)
 This function template deserializes a sequence.
 
template<class _K , class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize (std::map< _K, _T > &map_t)
 This function template deserializes a map of non-primitive.
 
template<class _K , class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize (std::map< _K, _T > &map_t)
 This function template deserializes a map of primitive.
 
template<size_t N, typename std::enable_if<(N< 9) > ::type * = nullptr>
Cdrdeserialize (std::bitset< N > &value)
 Decodes a bitset from the buffer.
 
template<size_t N, typename std::enable_if<(8< N &&N< 17) > ::type * = nullptr>
Cdrdeserialize (std::bitset< N > &value)
 
template<size_t N, typename std::enable_if<(16< N &&N< 33) > ::type * = nullptr>
Cdrdeserialize (std::bitset< N > &value)
 
template<size_t N, typename std::enable_if<(32< N &&N< 65) > ::type * = nullptr>
Cdrdeserialize (std::bitset< N > &value)
 
template<class _T >
Cdrdeserialize_array (_T *value, size_t num_elements)
 Decodes an array of a type not managed by this encoder from the buffer.
 
template<class _T >
Cdrdeserialize_array (_T *type_t, size_t num_elements, Endianness endianness)
 This function template deserializes an array of non-basic objects with a different endianness.
 
TEMPLATE_SPEC Cdrdeserialize_array (uint8_t *octet_t, size_t num_elements)
 This function deserializes an array of octets.
 
Cdr_DllAPI Cdrdeserialize_array (char *char_t, size_t num_elements)
 This function deserializes an array of characters.
 
TEMPLATE_SPEC Cdrdeserialize_array (int8_t *int8, size_t num_elements)
 This function deserializes an array of int8_t.
 
TEMPLATE_SPEC Cdrdeserialize_array (uint16_t *ushort_t, size_t num_elements)
 This function deserializes an array of unsigned shorts.
 
Cdr_DllAPI Cdrdeserialize_array (int16_t *short_t, size_t num_elements)
 This function deserializes an array of shorts.
 
TEMPLATE_SPEC Cdrdeserialize_array (uint32_t *ulong_t, size_t num_elements)
 This function deserializes an array of unsigned longs.
 
Cdr_DllAPI Cdrdeserialize_array (int32_t *long_t, size_t num_elements)
 This function deserializes an array of longs.
 
Cdr_DllAPI Cdrdeserialize_array (wchar_t *wchar, size_t num_elements)
 This function deserializes an array of wide-chars.
 
TEMPLATE_SPEC Cdrdeserialize_array (uint64_t *ulonglong_t, size_t num_elements)
 This function deserializes an array of unsigned long longs.
 
Cdr_DllAPI Cdrdeserialize_array (int64_t *longlong_t, size_t num_elements)
 This function deserializes an array of long longs.
 
Cdr_DllAPI Cdrdeserialize_array (float *float_t, size_t num_elements)
 This function deserializes an array of floats.
 
Cdr_DllAPI Cdrdeserialize_array (double *double_t, size_t num_elements)
 This function deserializes an array of doubles.
 
Cdr_DllAPI Cdrdeserialize_array (long double *ldouble_t, size_t num_elements)
 This function deserializes an array of long doubles.
 
Cdr_DllAPI Cdrdeserialize_array (bool *bool_t, size_t num_elements)
 This function deserializes an array of booleans.
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize_array (std::vector< _T > &value)
 Decodes an array of primitives on a std::vector.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize_array (std::vector< _T > &value)
 Decodes an array of non-primitives on a std::vector.
 
template<class _T >
Cdrdeserialize_array (std::vector< _T > &value, Endianness endianness)
 Decodes an array of non-primitives on a std::vector with a different endianness.
 
TEMPLATE_SPEC Cdrdeserialize_array (std::vector< bool > &value)
 Decodes an array of booleans on a std::vector.
 
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize_sequence (_T *&sequence_t, size_t &num_elements)
 This function template deserializes a raw sequence of non-primitives. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdrdeserialize_sequence (_T *&sequence_t, size_t &num_elements)
 This function template deserializes a raw sequence of primitives. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()
 
template<class _T >
Cdrdeserialize_sequence (_T *&sequence_t, size_t &num_elements, Endianness endianness)
 This function template deserializes a raw sequence with a different endianness. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()
 
TEMPLATE_SPEC Cdrdeserialize_sequence (std::string *&sequence_t, size_t &num_elements)
 This function template deserializes a string sequence. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()
 
TEMPLATE_SPEC Cdrdeserialize_sequence (std::wstring *&sequence_t, size_t &num_elements)
 This function template deserializes a wide-string sequence. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()
 
template<class _T >
Cdrserialize_member (const MemberId &member_id, const _T &member_value, XCdrHeaderSelection header_selection=XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT)
 XCDR extensions.
 
template<class _T >
Cdrserialize_member (const MemberId &member_id, const optional< _T > &member_value, XCdrHeaderSelection header_selection=XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT)
 Encodes an optional member of a type according to the encoding algorithm used.
 
template<class _T >
Cdrdeserialize_member (_T &member_value)
 Decodes a member of a type according to the encoding algorithm used.
 
template<class _T >
Cdrdeserialize_member (optional< _T > &member_value)
 Decodes an optional member of a type according to the encoding algorithm used.
 
Cdr_DllAPI Cdrbegin_serialize_type (Cdr::state &current_state, EncodingAlgorithmFlag type_encoding)
 Tells to the encoder a new type and its members starts to be encoded.
 
Cdr_DllAPI Cdrend_serialize_type (Cdr::state &current_state)
 Tells to the encoder the encoding of the type finishes.
 
Cdr_DllAPI Cdrdeserialize_type (EncodingAlgorithmFlag type_encoding, std::function< bool(Cdr &, const MemberId &)> functor)
 Tells to the encoder a new type and its members starts to be decoded.
 
template<class _T >
Cdrserialize (const optional< _T > &value)
 Encodes an optional in the buffer.
 
template<class _T >
Cdrserialize (const external< _T > &value)
 Encodes an external in the buffer.
 
Cdr_DllAPI Cdroperator<< (const MemberId &member_id)
 Tells the encoder the member identifier for the next member to be encoded.
 
template<class _T >
Cdrdeserialize (optional< _T > &value)
 Decodes an optional from the buffer.
 
template<class _T >
Cdrdeserialize (external< _T > &value)
 Decodes an external from the buffer.
 
template<class _T >
Cdrdeserialize (optional< external< _T > > &value)
 Decodes an optional of an external from the buffer.
 
Cdr_DllAPI state allocate_xcdrv2_dheader ()
 Encodes an empty DHEADER if the encoding version is XCDRv2. After serializing the members's type, set_xcdrv2_dheader must be called to set the correct DHEADER value using the state returned by this function.
 
Cdr_DllAPI void set_xcdrv2_dheader (const state &state)
 Uses the state to calculate the member's type size and serialize the value in the previous allocated DHEADER.
 

Static Public Member Functions

static size_t alignment (size_t current_alignment, size_t data_size)
 Returns the number of bytes needed to align a position to certain data size.
 

Static Public Attributes

static Cdr_DllAPI const Endianness DEFAULT_ENDIAN = LITTLE_ENDIANNESS
 Default endianess in the system.
 

Private Types

enum  SerializedMemberSizeForNextInt {
  NO_SERIALIZED_MEMBER_SIZE ,
  SERIALIZED_MEMBER_SIZE ,
  SERIALIZED_MEMBER_SIZE_4 ,
  SERIALIZED_MEMBER_SIZE_8
}
 
using begin_serialize_member_functor = Cdr &(Cdr::*)(const MemberId &, bool, Cdr::state &, XCdrHeaderSelection)
 
using end_serialize_member_functor = Cdr &(Cdr::*)(const Cdr::state &)
 
using begin_serialize_opt_member_functor = Cdr &(Cdr::*)(const MemberId &, bool, Cdr::state &, XCdrHeaderSelection)
 
using end_serialize_memberopt__functor = Cdr &(Cdr::*)(const Cdr::state &)
 
using begin_serialize_type_functor = Cdr &(Cdr::*)(Cdr::state &, EncodingAlgorithmFlag)
 
using end_serialize_type_functor = Cdr &(Cdr::*)(const Cdr::state &)
 
using deserialize_type_functor = Cdr &(Cdr::*)(EncodingAlgorithmFlag, std::function< bool(Cdr &, const MemberId &)>)
 

Private Member Functions

 Cdr (const Cdr &)=delete
 
Cdroperator= (const Cdr &)=delete
 
Cdr_DllAPI Cdrserialize_bool_array (const std::vector< bool > &vector_t)
 
Cdr_DllAPI Cdrserialize_bool_sequence (const std::vector< bool > &vector_t)
 
Cdr_DllAPI Cdrdeserialize_bool_array (std::vector< bool > &vector_t)
 
Cdr_DllAPI Cdrdeserialize_bool_sequence (std::vector< bool > &vector_t)
 
Cdr_DllAPI Cdrdeserialize_string_sequence (std::string *&sequence_t, size_t &num_elements)
 
Cdr_DllAPI Cdrdeserialize_wstring_sequence (std::wstring *&sequence_t, size_t &num_elements)
 
template<class _T , size_t _Size>
Cdrserialize_array (const std::array< _T, _Size > *array_t, size_t num_elements)
 This function template detects the content type of the STD container array and serializes the array.
 
template<class _T , size_t _Size>
Cdrdeserialize_array (std::array< _T, _Size > *array_t, size_t num_elements)
 This function template detects the content type of the STD container array and deserializes the array.
 
template<class _T , size_t _Size>
Cdrdeserialize_array (std::array< _T, _Size > *array_t, size_t num_elements, Endianness endianness)
 This function template detects the content type of STD container array and deserializes the array with a different endianness.
 
size_t alignment (size_t data_size) const
 Returns the number of bytes needed to align the current position (having as reference the origin) to certain data size.
 
void make_alignment (size_t align)
 This function jumps the number of bytes of the alignment. These bytes should be calculated with the function eprosima::fastcdr::Cdr::alignment.
 
bool resize (size_t min_size_inc)
 This function resizes the internal buffer. It only applies if the FastBuffer object was created with the default constructor.
 
Cdr_DllAPI const char * read_string (uint32_t &length)
 
Cdr_DllAPI const std::wstring read_wstring (uint32_t &length)
 
void xcdr1_serialize_short_member_header (const MemberId &member_id)
 XCDR extensions.
 
void xcdr1_end_short_member_header (const MemberId &member_id, size_t member_serialized_size)
 Finish the encoding of a short member header of a member according to XCDRv1.
 
void xcdr1_serialize_long_member_header (const MemberId &member_id)
 Encodes a long member header of a member according to XCDRv1.
 
void xcdr1_end_long_member_header (const MemberId &member_id, size_t member_serialized_size)
 Finish the encoding of a long member header of a member according to XCDRv1.
 
void xcdr1_change_to_short_member_header (const MemberId &member_id, size_t member_serialized_size)
 Changes the previous encoded long header to a short header according to XCDRv1.
 
void xcdr1_change_to_long_member_header (const MemberId &member_id, size_t member_serialized_size)
 Changes the previous encoded short header to a long header according to XCDRv1.
 
Cdr_DllAPI bool xcdr1_deserialize_member_header (MemberId &member_id, Cdr::state &current_state)
 Decodes a member header according to XCDRv1.
 
void xcdr2_serialize_short_member_header (const MemberId &member_id)
 Encodes a short member header of a member according to XCDRv2.
 
void xcdr2_end_short_member_header (const MemberId &member_id, size_t member_serialized_size)
 Finish the encoding of a short member header of a member according to XCDRv2.
 
void xcdr2_serialize_long_member_header (const MemberId &member_id)
 Encodes a long member header of a member according to XCDRv2.
 
void xcdr2_end_long_member_header (const MemberId &member_id, size_t member_serialized_size)
 Finish the encoding of a long member header of a member according to XCDRv2.
 
void xcdr2_change_to_short_member_header (const MemberId &member_id, size_t member_serialized_size)
 Changes the previous encoded long header to a short header according to XCDRv2.
 
void xcdr2_change_to_long_member_header (const MemberId &member_id, size_t member_serialized_size)
 Changes the previous encoded long header to a short header according to XCDRv2.
 
void xcdr2_shrink_to_long_member_header (const MemberId &member_id, const FastBuffer::iterator &offset)
 Join the previous encoded long header with the next DHEADER which was serialized after.
 
void xcdr2_deserialize_member_header (MemberId &member_id, Cdr::state &current_state)
 Decodes a member header according to XCDRv2.
 
Cdrxcdr1_begin_serialize_member (const MemberId &member_id, bool is_present, Cdr::state &current_state, XCdrHeaderSelection header_selection)
 Tells to the encoder a member starts to be encoded according to XCDRv1.
 
Cdrxcdr1_end_serialize_member (const Cdr::state &current_state)
 Tells to the encoder to finish the encoding of the member.
 
Cdrxcdr1_begin_serialize_opt_member (const MemberId &member_id, bool is_present, Cdr::state &current_state, XCdrHeaderSelection header_selection)
 Tells to the encoder a member starts to be encoded according to XCDRv1.
 
Cdrxcdr1_end_serialize_opt_member (const Cdr::state &current_state)
 Tells to the encoder to finish the encoding of the member.
 
Cdrxcdr2_begin_serialize_member (const MemberId &member_id, bool is_present, Cdr::state &current_state, XCdrHeaderSelection header_selection)
 Tells to the encoder a member starts to be encoded according to XCDRv2.
 
Cdrxcdr2_end_serialize_member (const Cdr::state &current_state)
 Tells to the encoder to finish the encoding of the member.
 
Cdrxcdr1_begin_serialize_type (Cdr::state &current_state, EncodingAlgorithmFlag type_encoding) noexcept
 Tells to the encoder a new type and its members start to be encoded according to XCDRv1.
 
Cdrxcdr1_end_serialize_type (const Cdr::state &current_state)
 Tells to the encoder to finish the encoding of the type.
 
Cdrxcdr2_begin_serialize_type (Cdr::state &current_state, EncodingAlgorithmFlag type_encoding)
 Tells to the encoder a new type and its members start to be encoded according to XCDRv2.
 
Cdrxcdr2_end_serialize_type (const Cdr::state &current_state)
 Tells to the encoder to finish the encoding of the type.
 
Cdrxcdr1_deserialize_type (EncodingAlgorithmFlag type_encoding, std::function< bool(Cdr &, const MemberId &)> functor)
 Tells to the encoder a new type and its members start to be decoded according to XCDRv1.
 
Cdrxcdr2_deserialize_type (EncodingAlgorithmFlag type_encoding, std::function< bool(Cdr &, const MemberId &)> functor)
 Tells to the encoder a new type and its members start to be decoded according to XCDRv2.
 
Cdrcdr_begin_serialize_member (const MemberId &member_id, bool is_present, Cdr::state &current_state, XCdrHeaderSelection header_selection)
 
Cdrcdr_end_serialize_member (const Cdr::state &current_state)
 
Cdrcdr_begin_serialize_type (Cdr::state &current_state, EncodingAlgorithmFlag type_encoding)
 
Cdrcdr_end_serialize_type (const Cdr::state &current_state)
 
Cdrcdr_deserialize_type (EncodingAlgorithmFlag type_encoding, std::function< bool(Cdr &, const MemberId &)> functor)
 
void reset_callbacks ()
 Resets the internal callbacks depending on the current selected Cdr version.
 
uint32_t get_long_lc (SerializedMemberSizeForNextInt serialized_member_size)
 
uint32_t get_short_lc (size_t member_serialized_size)
 
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
constexpr SerializedMemberSizeForNextInt get_serialized_member_size () const
 

Private Attributes

begin_serialize_member_functor begin_serialize_member_ { nullptr }
 
end_serialize_member_functor end_serialize_member_ { nullptr }
 
begin_serialize_opt_member_functor begin_serialize_opt_member_ { nullptr }
 
end_serialize_member_functor end_serialize_opt_member_ { nullptr }
 
begin_serialize_type_functor begin_serialize_type_ { nullptr }
 
end_serialize_type_functor end_serialize_type_ { nullptr }
 
deserialize_type_functor deserialize_type_ { nullptr }
 
FastBuffercdr_buffer_
 Reference to the buffer that will be serialized/deserialized.
 
CdrVersion cdr_version_ {CdrVersion::XCDRv2}
 The type of CDR that will be use in serialization/deserialization.
 
EncodingAlgorithmFlag encoding_flag_ {EncodingAlgorithmFlag::PLAIN_CDR2}
 Stores the main encoding algorithm.
 
EncodingAlgorithmFlag current_encoding_ {EncodingAlgorithmFlag::PLAIN_CDR2}
 Stores the current encoding algorithm.
 
std::array< uint8_t, 2 > options_ {{0}}
 This attribute stores the option flags when the CDR type is DDS_CDR;.
 
uint8_t endianness_ {Endianness::LITTLE_ENDIANNESS}
 The endianness that will be applied over the buffer.
 
bool swap_bytes_ {false}
 This attribute specifies if it is needed to swap the bytes.
 
size_t last_data_size_ {0}
 Stores the last datasize serialized/deserialized. It's used to optimize.
 
FastBuffer::iterator offset_
 The current position in the serialization/deserialization process.
 
FastBuffer::iterator origin_
 The position from where the alignment is calculated.
 
FastBuffer::iterator end_
 The last position in the buffer;.
 
MemberId next_member_id_
 Next member identifier to be processed.
 
size_t align64_ {4}
 Align for types equal or greater than 64bits.
 
enum eprosima::fastcdr::Cdr::SerializedMemberSizeForNextInt NO_SERIALIZED_MEMBER_SIZE
 Specifies if a DHEADER was serialized. Used to optimize XCDRv2 member headers.
 
state initial_state_
 Stores the initial state.
 
bool encapsulation_serialized_ {false}
 Whether the encapsulation was serialized.
 

Member Typedef Documentation

◆ begin_serialize_member_functor

Definition at line 3433 of file Cdr.h.

◆ begin_serialize_opt_member_functor

Definition at line 3444 of file Cdr.h.

◆ begin_serialize_type_functor

Definition at line 3455 of file Cdr.h.

◆ deserialize_type_functor

Definition at line 3464 of file Cdr.h.

◆ end_serialize_member_functor

Definition at line 3440 of file Cdr.h.

◆ end_serialize_memberopt__functor

Definition at line 3451 of file Cdr.h.

◆ end_serialize_type_functor

Definition at line 3460 of file Cdr.h.

Member Enumeration Documentation

◆ Endianness

This enumeration represents endianness types.

Enumerator
BIG_ENDIANNESS 

Big endianness.

LITTLE_ENDIANNESS 

Little endianness.

Definition at line 75 of file Cdr.h.

◆ SerializedMemberSizeForNextInt

When serializing a member's type using XCDRv2, this enumerator is used to inform the type was serialized with a DHEADER and the algorithm could optimize the XCDRv2 member header.

Enumerator
NO_SERIALIZED_MEMBER_SIZE 
SERIALIZED_MEMBER_SIZE 

Default. No serialized member size in a DHEADER.

SERIALIZED_MEMBER_SIZE_4 

Serialized member size in a DHEADER.

SERIALIZED_MEMBER_SIZE_8 

Serialized member size (which is a multiple of 4) in a DHEADER.

Serialized member size (which is a multiple of 8) in a DHEADER.

Definition at line 3512 of file Cdr.h.

◆ XCdrHeaderSelection

Used to decide, in encoding algorithms where member headers support a short header version and a long header version, which one will be used.

Enumerator
SHORT_HEADER 

Initially a short member header is allocated and cannot be changed. This option may cause an exception.

LONG_HEADER 

Initially a long member header is allocated and cannot be changed.

AUTO_WITH_SHORT_HEADER_BY_DEFAULT 

Initially a short member header is allocated but can be changed to the longer version.

AUTO_WITH_LONG_HEADER_BY_DEFAULT 

Initially a long member header is allocated but can be changed to the shorter version.

Definition at line 90 of file Cdr.h.

Constructor & Destructor Documentation

◆ Cdr() [1/2]

eprosima::fastcdr::Cdr::Cdr ( FastBuffer cdr_buffer,
const Endianness  endianness = DEFAULT_ENDIAN,
const CdrVersion  cdr_version = XCDRv2 
)

This constructor creates an eprosima::fastcdr::Cdr object that can serialize/deserialize the assigned buffer.

Parameters
cdr_bufferA reference to the buffer that contains (or will contain) the CDR representation.
endiannessThe initial endianness that will be used. The default value is the endianness of the system.
cdr_versionRepresents the type of encoding algorithm that will be used for the encoding. The default value is CdrVersion::XCDRv2.

Definition at line 133 of file Cdr.cpp.

◆ Cdr() [2/2]

eprosima::fastcdr::Cdr::Cdr ( const Cdr )
privatedelete

Member Function Documentation

◆ alignment() [1/2]

static size_t eprosima::fastcdr::Cdr::alignment ( size_t  current_alignment,
size_t  data_size 
)
inlinestatic

Returns the number of bytes needed to align a position to certain data size.

Parameters
current_alignmentPosition to be aligned.
data_sizeSize of next data to process (should be power of two).
Returns
Number of required alignment bytes.

Definition at line 275 of file Cdr.h.

◆ alignment() [2/2]

size_t eprosima::fastcdr::Cdr::alignment ( size_t  data_size) const
inlineprivate

Returns the number of bytes needed to align the current position (having as reference the origin) to certain data size.

Parameters
data_sizeThe size of the data that will be serialized.
Returns
The size needed for the alignment.

Definition at line 3012 of file Cdr.h.

◆ allocate_xcdrv2_dheader()

Cdr::state eprosima::fastcdr::Cdr::allocate_xcdrv2_dheader ( )

Encodes an empty DHEADER if the encoding version is XCDRv2. After serializing the members's type, set_xcdrv2_dheader must be called to set the correct DHEADER value using the state returned by this function.

Definition at line 3499 of file Cdr.cpp.

◆ begin_serialize_type()

Cdr & eprosima::fastcdr::Cdr::begin_serialize_type ( Cdr::state current_state,
EncodingAlgorithmFlag  type_encoding 
)

Tells to the encoder a new type and its members starts to be encoded.

Parameters
[in,out]current_stateState of the encoder previous of calling this function.
[in]type_encodingThe encoding algorithm used to encode the type and its members.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2234 of file Cdr.cpp.

◆ cdr_begin_serialize_member()

Cdr & eprosima::fastcdr::Cdr::cdr_begin_serialize_member ( const MemberId member_id,
bool  is_present,
Cdr::state current_state,
XCdrHeaderSelection  header_selection 
)
private

Definition at line 3445 of file Cdr.cpp.

◆ cdr_begin_serialize_type()

Cdr & eprosima::fastcdr::Cdr::cdr_begin_serialize_type ( Cdr::state current_state,
EncodingAlgorithmFlag  type_encoding 
)
private

Definition at line 3462 of file Cdr.cpp.

◆ cdr_deserialize_type()

Cdr & eprosima::fastcdr::Cdr::cdr_deserialize_type ( EncodingAlgorithmFlag  type_encoding,
std::function< bool(Cdr &, const MemberId &)>  functor 
)
private

Definition at line 3480 of file Cdr.cpp.

◆ cdr_end_serialize_member()

Cdr & eprosima::fastcdr::Cdr::cdr_end_serialize_member ( const Cdr::state current_state)
private

Definition at line 3455 of file Cdr.cpp.

◆ cdr_end_serialize_type()

Cdr & eprosima::fastcdr::Cdr::cdr_end_serialize_type ( const Cdr::state current_state)
private

Definition at line 3473 of file Cdr.cpp.

◆ change_endianness()

void eprosima::fastcdr::Cdr::change_endianness ( Endianness  endianness)

This function sets the current endianness used by the CDR type.

Parameters
endiannessThe new endianness value.

Definition at line 405 of file Cdr.cpp.

◆ deserialize() [1/40]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value >::type * = nullptr, typename = void>
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value)
inline

Decodes the value of a type from the buffer.

To do that, the encoder expects a function deserialize to be provided by the type.

Parameters
[out]valueReference to the variable where the value will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1417 of file Cdr.h.

◆ deserialize() [2/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int32_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value)
inline

Decodes an enumeration from the buffer.

Parameters
[out]valueReference to the variable where the enumeration will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1466 of file Cdr.h.

◆ deserialize() [3/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint32_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value)
inline

Decodes an enumeration from the buffer.

Parameters
[out]valueReference to the variable where the enumeration will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1486 of file Cdr.h.

◆ deserialize() [4/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int16_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value)
inline

Decodes an enumeration from the buffer.

Parameters
[out]valueReference to the variable where the enumeration will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1506 of file Cdr.h.

◆ deserialize() [5/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint16_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value)
inline

Decodes an enumeration from the buffer.

Parameters
[out]valueReference to the variable where the enumeration will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1526 of file Cdr.h.

◆ deserialize() [6/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int8_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value)
inline

Decodes an enumeration from the buffer.

Parameters
[out]valueReference to the variable where the enumeration will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1546 of file Cdr.h.

◆ deserialize() [7/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint8_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value)
inline

Decodes an enumeration from the buffer.

Parameters
[out]valueReference to the variable where the enumeration will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1566 of file Cdr.h.

◆ deserialize() [8/40]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize ( _T &  value,
Endianness  endianness 
)
inline

Decodes the value of a type with a different endianness.

Parameters
[out]valueReference to the variable where the value will be stored after decoding from the buffer.
endiannessEndianness that will be used in the deserialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1433 of file Cdr.h.

◆ deserialize() [9/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( bool &  bool_t)

This function deserializes a boolean.

Parameters
bool_tThe variable that will store the boolean read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to deserialize an invalid value.

Definition at line 1646 of file Cdr.cpp.

◆ deserialize() [10/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( char &  char_t)

This function deserializes a character.

Parameters
char_tThe variable that will store the character read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1368 of file Cdr.cpp.

◆ deserialize() [11/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( char *&  string_t)

This function deserializes a string. 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()

Parameters
string_tThe pointer that will point to the string read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1675 of file Cdr.cpp.

◆ deserialize() [12/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( double &  double_t)

This function deserializes a double.

Parameters
double_tThe variable that will store the double read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1525 of file Cdr.cpp.

◆ deserialize() [13/40]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize ( external< _T > &  value)
inline

Decodes an external from the buffer.

Parameters
[out]valueA reference to the variable where the external will be stored.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::BadParamExceptionThis exception is thrown when the external is locked.
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2868 of file Cdr.h.

◆ deserialize() [14/40]

template<size_t MAX_CHARS>
Cdr & eprosima::fastcdr::Cdr::deserialize ( fixed_string< MAX_CHARS > &  value)
inline

Decodes a fixed string.

Parameters
[out]valueReference to the variable where the fixed string will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 1791 of file Cdr.h.

◆ deserialize() [15/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( float &  float_t)

This function deserializes a float.

Parameters
float_tThe variable that will store the float read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1490 of file Cdr.cpp.

◆ deserialize() [16/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( int16_t &  short_t)

This function deserializes a short.

Parameters
short_tThe variable that will store the short read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1383 of file Cdr.cpp.

◆ deserialize() [17/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( int32_t &  long_t)

This function deserializes a long.

Parameters
long_tThe variable that will store the long read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1416 of file Cdr.cpp.

◆ deserialize() [18/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( int64_t &  longlong_t)

This function deserializes a long long.

Parameters
longlong_tThe variable that will store the long long read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1451 of file Cdr.cpp.

◆ deserialize() [19/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( int8_t &  int8)
inline

This function deserializes an int8_t.

Parameters
int8The variable that will store the int8_t read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1604 of file Cdr.h.

◆ deserialize() [20/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( long double &  ldouble_t)

This function deserializes a long double.

Parameters
ldouble_tThe variable that will store the long double read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis 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.

Definition at line 1564 of file Cdr.cpp.

◆ deserialize() [21/40]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize ( optional< _T > &  value)
inline

Decodes an optional from the buffer.

Parameters
[out]valueA reference to the variable where the optional will be stored.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2843 of file Cdr.h.

◆ deserialize() [22/40]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize ( optional< external< _T > > &  value)
inline

Decodes an optional of an external from the buffer.

Parameters
[out]valueA reference to the variable where the optional will be stored.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::BadParamExceptionThis exception is thrown when the external is locked.
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2894 of file Cdr.h.

◆ deserialize() [23/40]

template<class _T , size_t _Size>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::array< _T, _Size > &  array_t)
inline

This function template deserializes an array.

Parameters
array_tThe variable that will store the array read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1807 of file Cdr.h.

◆ deserialize() [24/40]

template<size_t N, typename std::enable_if<(N< 9) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::bitset< N > &  value)
inline

Decodes a bitset from the buffer.

Parameters
[out]valueReference to the variable where the bitset will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2083 of file Cdr.h.

◆ deserialize() [25/40]

template<size_t N, typename std::enable_if<(8< N &&N< 17) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::bitset< N > &  value)
inline

Definition at line 2093 of file Cdr.h.

◆ deserialize() [26/40]

template<size_t N, typename std::enable_if<(16< N &&N< 33) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::bitset< N > &  value)
inline

Definition at line 2103 of file Cdr.h.

◆ deserialize() [27/40]

template<size_t N, typename std::enable_if<(32< N &&N< 65) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::bitset< N > &  value)
inline

Definition at line 2113 of file Cdr.h.

◆ deserialize() [28/40]

template<class _K , class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::map< _K, _T > &  map_t)
inline

This function template deserializes a map of non-primitive.

Parameters
map_tThe variable that will store the map read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1978 of file Cdr.h.

◆ deserialize() [29/40]

template<class _K , class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::map< _K, _T > &  map_t)
inline

This function template deserializes a map of primitive.

Parameters
map_tThe variable that will store the map read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2047 of file Cdr.h.

◆ deserialize() [30/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( std::string string_t)
inline

This function deserializes a std::string.

Parameters
string_tThe variable that will store the string read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1759 of file Cdr.h.

◆ deserialize() [31/40]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::vector< _T > &  vector_t)
inline

This function template deserializes a sequence of non-primitive.

Parameters
vector_tThe variable that will store the sequence read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1844 of file Cdr.h.

◆ deserialize() [32/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize ( std::vector< _T > &  vector_t)
inline

This function template deserializes a sequence of primitive.

Parameters
vector_tThe variable that will store the sequence read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1922 of file Cdr.h.

◆ deserialize() [33/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( std::vector< bool > &  vector_t)
inline

This function template deserializes a sequence.

Parameters
vector_tThe variable that will store the sequence read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1964 of file Cdr.h.

◆ deserialize() [34/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( std::wstring string_t)
inline

This function deserializes a std::wstring.

Parameters
string_tThe variable that will store the string read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1775 of file Cdr.h.

◆ deserialize() [35/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( uint16_t &  ushort_t)
inline

This function deserializes an unsigned short.

Parameters
ushort_tThe variable that will store the unsigned short read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1617 of file Cdr.h.

◆ deserialize() [36/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( uint32_t &  ulong_t)
inline

This function deserializes an unsigned long.

Parameters
ulong_tThe variable that will store the unsigned long read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1639 of file Cdr.h.

◆ deserialize() [37/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( uint64_t &  ulonglong_t)
inline

This function deserializes an unsigned long long.

Parameters
ulonglong_tThe variable that will store the unsigned long long read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1677 of file Cdr.h.

◆ deserialize() [38/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( uint8_t &  octet_t)
inline

This function deserializes an octet.

Parameters
octet_tThe variable that will store the octet read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1582 of file Cdr.h.

◆ deserialize() [39/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize ( wchar_t &  wchar)
inline

This function deserializes a wide-char.

Parameters
wcharThe variable that will store the wide-char read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1661 of file Cdr.h.

◆ deserialize() [40/40]

Cdr & eprosima::fastcdr::Cdr::deserialize ( wchar_t *&  string_t)

This function deserializes a wide-string. 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()

Parameters
string_tThe pointer that will point to the wide string read from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1706 of file Cdr.cpp.

◆ deserialize_array() [1/22]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize_array ( _T *  type_t,
size_t  num_elements,
Endianness  endianness 
)
inline

This function template deserializes an array of non-basic objects with a different endianness.

Parameters
type_tThe variable that will store the array of objects read from the buffer.
num_elementsNumber of the elements in the array.
endiannessEndianness that will be used in the deserialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2154 of file Cdr.h.

◆ deserialize_array() [2/22]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize_array ( _T *  value,
size_t  num_elements 
)
inline

Decodes an array of a type not managed by this encoder from the buffer.

To do that, the encoder expects a function deserialize to be provided by the type.

Parameters
[out]valueReference to the variable where the array will be stored after decoding from the buffer.
[in]num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2134 of file Cdr.h.

◆ deserialize_array() [3/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( bool *  bool_t,
size_t  num_elements 
)

This function deserializes an array of booleans.

Parameters
bool_tThe variable that will store the array of booleans read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1799 of file Cdr.cpp.

◆ deserialize_array() [4/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( char *  char_t,
size_t  num_elements 
)

This function deserializes an array of characters.

Parameters
char_tThe variable that will store the array of characters read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1831 of file Cdr.cpp.

◆ deserialize_array() [5/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( double *  double_t,
size_t  num_elements 
)

This function deserializes an array of doubles.

Parameters
double_tThe variable that will store the array of doubles read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2066 of file Cdr.cpp.

◆ deserialize_array() [6/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( float *  float_t,
size_t  num_elements 
)

This function deserializes an array of floats.

Parameters
float_tThe variable that will store the array of floats read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2017 of file Cdr.cpp.

◆ deserialize_array() [7/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( int16_t *  short_t,
size_t  num_elements 
)

This function deserializes an array of shorts.

Parameters
short_tThe variable that will store the array of shorts read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1850 of file Cdr.cpp.

◆ deserialize_array() [8/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( int32_t *  long_t,
size_t  num_elements 
)

This function deserializes an array of longs.

Parameters
long_tThe variable that will store the array of longs read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1897 of file Cdr.cpp.

◆ deserialize_array() [9/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( int64_t *  longlong_t,
size_t  num_elements 
)

This function deserializes an array of long longs.

Parameters
longlong_tThe variable that will store the array of long longs read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1964 of file Cdr.cpp.

◆ deserialize_array() [10/22]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_array ( int8_t *  int8,
size_t  num_elements 
)
inline

This function deserializes an array of int8_t.

Parameters
int8The variable that will store the array of int8_t read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2211 of file Cdr.h.

◆ deserialize_array() [11/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( long double *  ldouble_t,
size_t  num_elements 
)

This function deserializes an array of long doubles.

Parameters
ldouble_tThe variable that will store the array of long doubles read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis 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.

Definition at line 2119 of file Cdr.cpp.

◆ deserialize_array() [12/22]

template<class _T , size_t _Size>
Cdr & eprosima::fastcdr::Cdr::deserialize_array ( std::array< _T, _Size > *  array_t,
size_t  num_elements 
)
inlineprivate

This function template detects the content type of the STD container array and deserializes the array.

Parameters
array_tThe variable that will store the array read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2982 of file Cdr.h.

◆ deserialize_array() [13/22]

template<class _T , size_t _Size>
Cdr & eprosima::fastcdr::Cdr::deserialize_array ( std::array< _T, _Size > *  array_t,
size_t  num_elements,
Endianness  endianness 
)
inlineprivate

This function template detects the content type of STD container array and deserializes the array with a different endianness.

Parameters
array_tThe variable that will store the array read from the buffer.
num_elementsNumber of the elements in the array.
endiannessEndianness that will be used in the deserialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2998 of file Cdr.h.

◆ deserialize_array() [14/22]

template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize_array ( std::vector< _T > &  value)
inline

Decodes an array of primitives on a std::vector.

std::vector must have allocated the number of element of the array.

Parameters
[out]valueReference to the std::vector where the array will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2364 of file Cdr.h.

◆ deserialize_array() [15/22]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize_array ( std::vector< _T > &  value)
inline

Decodes an array of non-primitives on a std::vector.

std::vector must have allocated the number of element of the array.

Parameters
[out]valueReference to the std::vector where the array will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2384 of file Cdr.h.

◆ deserialize_array() [16/22]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize_array ( std::vector< _T > &  value,
Endianness  endianness 
)
inline

Decodes an array of non-primitives on a std::vector with a different endianness.

std::vector must have allocated the number of element of the array.

Parameters
[out]valueReference to the std::vector where the array will be stored after decoding from the buffer.
[in]endiannessEndianness that will be used in the serialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2425 of file Cdr.h.

◆ deserialize_array() [17/22]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_array ( std::vector< bool > &  value)
inline

Decodes an array of booleans on a std::vector.

std::vector must have allocated the number of element of the array.

Parameters
[out]valueReference to the std::vector where the array will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2458 of file Cdr.h.

◆ deserialize_array() [18/22]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_array ( uint16_t *  ushort_t,
size_t  num_elements 
)
inline

This function deserializes an array of unsigned shorts.

Parameters
ushort_tThe variable that will store the array of unsigned shorts read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2226 of file Cdr.h.

◆ deserialize_array() [19/22]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_array ( uint32_t *  ulong_t,
size_t  num_elements 
)
inline

This function deserializes an array of unsigned longs.

Parameters
ulong_tThe variable that will store the array of unsigned longs read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2252 of file Cdr.h.

◆ deserialize_array() [20/22]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_array ( uint64_t *  ulonglong_t,
size_t  num_elements 
)
inline

This function deserializes an array of unsigned long longs.

Parameters
ulonglong_tThe variable that will store the array of unsigned long longs read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2289 of file Cdr.h.

◆ deserialize_array() [21/22]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_array ( uint8_t *  octet_t,
size_t  num_elements 
)
inline

This function deserializes an array of octets.

Parameters
octet_tThe variable that will store the array of octets read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2185 of file Cdr.h.

◆ deserialize_array() [22/22]

Cdr & eprosima::fastcdr::Cdr::deserialize_array ( wchar_t *  wchar,
size_t  num_elements 
)

This function deserializes an array of wide-chars.

Parameters
wcharThe variable that will store the array of wide-chars read from the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 1946 of file Cdr.cpp.

◆ deserialize_bool_array()

Cdr & eprosima::fastcdr::Cdr::deserialize_bool_array ( std::vector< bool > &  vector_t)
private

Definition at line 2344 of file Cdr.cpp.

◆ deserialize_bool_sequence()

Cdr & eprosima::fastcdr::Cdr::deserialize_bool_sequence ( std::vector< bool > &  vector_t)
private

Definition at line 2384 of file Cdr.cpp.

◆ deserialize_member() [1/2]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize_member ( _T &  member_value)
inline

Decodes a member of a type according to the encoding algorithm used.

Parameters
[out]member_valueA reference of the variable where the member value will be stored.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2707 of file Cdr.h.

◆ deserialize_member() [2/2]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize_member ( optional< _T > &  member_value)
inline

Decodes an optional member of a type according to the encoding algorithm used.

Parameters
[out]member_valueA reference of the variable where the optional member value will be stored.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2721 of file Cdr.h.

◆ deserialize_sequence() [1/5]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize_sequence ( _T *&  sequence_t,
size_t &  num_elements 
)
inline

This function template deserializes a raw sequence of non-primitives. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()

Parameters
sequence_tThe pointer that will store the sequence read from the buffer.
num_elementsThis variable return the number of elements of the sequence.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2477 of file Cdr.h.

◆ deserialize_sequence() [2/5]

template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::deserialize_sequence ( _T *&  sequence_t,
size_t &  num_elements 
)
inline

This function template deserializes a raw sequence of primitives. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()

Parameters
sequence_tThe pointer that will store the sequence read from the buffer.
num_elementsThis variable return the number of elements of the sequence.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2557 of file Cdr.h.

◆ deserialize_sequence() [3/5]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::deserialize_sequence ( _T *&  sequence_t,
size_t &  num_elements,
Endianness  endianness 
)
inline

This function template deserializes a raw sequence with a different endianness. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()

Parameters
sequence_tThe pointer that will store the sequence read from the buffer.
num_elementsThis variable return the number of elements of the sequence.
endiannessEndianness that will be used in the deserialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2594 of file Cdr.h.

◆ deserialize_sequence() [4/5]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_sequence ( std::string *&  sequence_t,
size_t &  num_elements 
)
inline

This function template deserializes a string sequence. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()

Parameters
sequence_tThe pointer that will store the sequence read from the buffer.
num_elementsThis variable return the number of elements of the sequence.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2627 of file Cdr.h.

◆ deserialize_sequence() [5/5]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::deserialize_sequence ( std::wstring *&  sequence_t,
size_t &  num_elements 
)
inline

This function template deserializes a wide-string sequence. This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. The user will have to free this allocated memory using free()

Parameters
sequence_tThe pointer that will store the sequence read from the buffer.
num_elementsThis variable return the number of elements of the sequence.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.

Definition at line 2644 of file Cdr.h.

◆ deserialize_string_sequence()

Cdr & eprosima::fastcdr::Cdr::deserialize_string_sequence ( std::string *&  sequence_t,
size_t &  num_elements 
)
private

Definition at line 2428 of file Cdr.cpp.

◆ deserialize_type()

Cdr & eprosima::fastcdr::Cdr::deserialize_type ( EncodingAlgorithmFlag  type_encoding,
std::function< bool(Cdr &, const MemberId &)>  functor 
)

Tells to the encoder a new type and its members starts to be decoded.

Parameters
[in]type_encodingThe encoding algorithm used to decode the type and its members.
[in]functorFunctor called each time a member has to be decoded.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2247 of file Cdr.cpp.

◆ deserialize_wstring_sequence()

Cdr & eprosima::fastcdr::Cdr::deserialize_wstring_sequence ( std::wstring *&  sequence_t,
size_t &  num_elements 
)
private

Definition at line 2490 of file Cdr.cpp.

◆ end_serialize_type()

Cdr & eprosima::fastcdr::Cdr::end_serialize_type ( Cdr::state current_state)

Tells to the encoder the encoding of the type finishes.

Parameters
[in]current_stateState of the encoder previous of calling the function begin_serialize_type.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.

Definition at line 2241 of file Cdr.cpp.

◆ endianness()

Cdr::Endianness eprosima::fastcdr::Cdr::endianness ( ) const

This function returns the current endianness used by the CDR type.

Returns
The endianness.

Definition at line 415 of file Cdr.cpp.

◆ get_buffer_pointer()

char * eprosima::fastcdr::Cdr::get_buffer_pointer ( )

This function returns the pointer to the current used buffer.

Returns
Pointer to the starting position of the buffer.

Definition at line 435 of file Cdr.cpp.

◆ get_cdr_version()

CdrVersion eprosima::fastcdr::Cdr::get_cdr_version ( ) const

Retrieves the CdrVersion used by the instance.

Returns
Configured CdrVersion.

Definition at line 348 of file Cdr.cpp.

◆ get_current_position()

char * eprosima::fastcdr::Cdr::get_current_position ( )

This function returns the current position in the CDR stream.

Returns
Pointer to the current position in the buffer.

Definition at line 440 of file Cdr.cpp.

◆ get_dds_cdr_options()

std::array< uint8_t, 2 > eprosima::fastcdr::Cdr::get_dds_cdr_options ( ) const

This function returns the option flags when the CDR type is eprosima::fastcdr::DDS_CDR.

Returns
The option flags.

Definition at line 375 of file Cdr.cpp.

◆ get_encoding_flag()

EncodingAlgorithmFlag eprosima::fastcdr::Cdr::get_encoding_flag ( ) const

Returns the EncodingAlgorithmFlag set in the encapsulation when the CDR type is CdrVersion::DDS_CDR, CdrVersion::XCDRv1 or CdrVersion::XCDRv2.

Returns
The specified flag in the encapsulation.

Definition at line 353 of file Cdr.cpp.

◆ get_long_lc()

uint32_t eprosima::fastcdr::Cdr::get_long_lc ( SerializedMemberSizeForNextInt  serialized_member_size)
inlineprivate

Definition at line 50 of file Cdr.cpp.

◆ get_serialized_data_length()

size_t eprosima::fastcdr::Cdr::get_serialized_data_length ( ) const

This function returns the length of the serialized data inside the stream.

Returns
The length of the serialized data.

Definition at line 445 of file Cdr.cpp.

◆ get_serialized_member_size()

template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
constexpr SerializedMemberSizeForNextInt eprosima::fastcdr::Cdr::get_serialized_member_size ( ) const
inlineconstexprprivate

Definition at line 3537 of file Cdr.h.

◆ get_short_lc()

uint32_t eprosima::fastcdr::Cdr::get_short_lc ( size_t  member_serialized_size)
inlineprivate

Definition at line 73 of file Cdr.cpp.

◆ get_state()

Cdr::state eprosima::fastcdr::Cdr::get_state ( ) const

Returns the current state of the CDR serialization process.

Returns
The current state of the CDR serialization process.

Definition at line 450 of file Cdr.cpp.

◆ jump()

bool eprosima::fastcdr::Cdr::jump ( size_t  num_bytes)

This function skips a number of bytes in the CDR stream buffer.

Parameters
num_bytesThe number of bytes that will be jumped.
Returns
True is returned when it works successfully. Otherwise, false is returned.

Definition at line 420 of file Cdr.cpp.

◆ make_alignment()

void eprosima::fastcdr::Cdr::make_alignment ( size_t  align)
inlineprivate

This function jumps the number of bytes of the alignment. These bytes should be calculated with the function eprosima::fastcdr::Cdr::alignment.

Parameters
alignThe number of bytes to be skipped.

Definition at line 3022 of file Cdr.h.

◆ move_alignment_forward()

bool eprosima::fastcdr::Cdr::move_alignment_forward ( size_t  num_bytes)

This function moves the alignment forward.

Parameters
num_bytesThe number of bytes the alignment should advance.
Returns
True If alignment was moved successfully.

Definition at line 478 of file Cdr.cpp.

◆ operator<<() [1/2]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::operator<< ( const _T &  value)
inline

Encodes the value into the buffer.

If previously a MemberId was set using operator<<, this operator will encode the value as a member of a type consistent with the set member identifier and according to the encoding algorithm used.

In other case, the operator will simply encode the value.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 326 of file Cdr.h.

◆ operator<<() [2/2]

Cdr & eprosima::fastcdr::Cdr::operator<< ( const MemberId member_id)

Tells the encoder the member identifier for the next member to be encoded.

Parameters
[in]member_idMember identifier.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::BadParamExceptionThis exception is thrown when a member id is already set without being encoded.

Definition at line 2254 of file Cdr.cpp.

◆ operator=()

Cdr & eprosima::fastcdr::Cdr::operator= ( const Cdr )
privatedelete

◆ operator>>()

template<class _T >
Cdr & eprosima::fastcdr::Cdr::operator>> ( _T &  value)
inline

Decodes the value from the buffer.

If this operator is called while decoding members of a type, this operator will decode the value as a member according to the encoding algorithm used.

In other case, the operator will simply decode the value.

Parameters
[out]valueReference to the variable where the value will be stored after decoding from the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a position that exceeds the internal memory size.

Definition at line 356 of file Cdr.h.

◆ read_encapsulation()

Cdr & eprosima::fastcdr::Cdr::read_encapsulation ( )

This function reads the encapsulation of the CDR stream. If the CDR stream contains an encapsulation, then this function should be called before starting to deserialize. CdrVersion and EncodingAlgorithmFlag internal values will be changed to the ones specified by the encapsulation.

Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to deserialize a position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to deserialize an invalid value.

Definition at line 198 of file Cdr.cpp.

◆ read_string()

const char * eprosima::fastcdr::Cdr::read_string ( uint32_t &  length)
private

Definition at line 1735 of file Cdr.cpp.

◆ read_wstring()

const std::wstring eprosima::fastcdr::Cdr::read_wstring ( uint32_t &  length)
private

Definition at line 1766 of file Cdr.cpp.

◆ reset()

void eprosima::fastcdr::Cdr::reset ( )

This function resets the current position in the buffer to the beginning.

Definition at line 465 of file Cdr.cpp.

◆ reset_alignment()

void eprosima::fastcdr::Cdr::reset_alignment ( )
inline

This function resets the alignment to the current position in the buffer.

Definition at line 306 of file Cdr.h.

◆ reset_callbacks()

void eprosima::fastcdr::Cdr::reset_callbacks ( )
private

Resets the internal callbacks depending on the current selected Cdr version.

Definition at line 164 of file Cdr.cpp.

◆ resize()

bool eprosima::fastcdr::Cdr::resize ( size_t  min_size_inc)
private

This function resizes the internal buffer. It only applies if the FastBuffer object was created with the default constructor.

Parameters
min_size_incMinimun size increase for the internal buffer
Returns
True if the resize was succesful, false if it was not

Definition at line 493 of file Cdr.cpp.

◆ serialize() [1/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( char *  string_t)

This function serializes a string.

Parameters
string_tThe pointer to the string that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 851 of file Cdr.cpp.

◆ serialize() [2/40]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value >::type * = nullptr, typename = void>
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value)
inline

Encodes the value of a type into the buffer.

To do that, the encoder expects a function serialize to be provided by the type.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 381 of file Cdr.h.

◆ serialize() [3/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int32_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value)
inline

Encodes the value of a enumerator into the buffer.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 431 of file Cdr.h.

◆ serialize() [4/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint32_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value)
inline

Encodes the value of a enumerator into the buffer.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 449 of file Cdr.h.

◆ serialize() [5/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int16_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value)
inline

Encodes the value of a enumerator into the buffer.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 467 of file Cdr.h.

◆ serialize() [6/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint16_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value)
inline

Encodes the value of a enumerator into the buffer.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 485 of file Cdr.h.

◆ serialize() [7/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, int8_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value)
inline

Encodes the value of a enumerator into the buffer.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 503 of file Cdr.h.

◆ serialize() [8/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value >::type * = nullptr, typename std::enable_if< std::is_same< typename std::underlying_type< _T >::type, uint8_t >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value)
inline

Encodes the value of a enumerator into the buffer.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 521 of file Cdr.h.

◆ serialize() [9/40]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize ( const _T &  value,
Endianness  endianness 
)
inline

Encodes the value of a type with a different endianness.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
endiannessEndianness that will be used in the serialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 397 of file Cdr.h.

◆ serialize() [10/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const bool  bool_t)

This function serializes a boolean.

Parameters
bool_tThe value of the boolean that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 828 of file Cdr.cpp.

◆ serialize() [11/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const char *  string_t)

This function serializes a string.

Parameters
string_tThe pointer to the string that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 857 of file Cdr.cpp.

◆ serialize() [12/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const char  char_t)

This function serializes a character.

Parameters
char_tThe value of the character that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 513 of file Cdr.cpp.

◆ serialize() [13/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const double  double_t)

This function serializes a double.

Parameters
double_tThe value of the double that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 700 of file Cdr.cpp.

◆ serialize() [14/40]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize ( const external< _T > &  value)
inline

Encodes an external in the buffer.

Parameters
[in]valueA reference to the external which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::BadParamExceptionThis exception is thrown when external is null.
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2813 of file Cdr.h.

◆ serialize() [15/40]

template<size_t MAX_CHARS>
Cdr & eprosima::fastcdr::Cdr::serialize ( const fixed_string< MAX_CHARS > &  value)
inline

Encodes a eprosima::fastcdr::fixed_string in the buffer.

Parameters
[in]valueA reference to the fixed string which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 724 of file Cdr.h.

◆ serialize() [16/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const float  float_t)

This function serializes a float.

Parameters
float_tThe value of the float that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 665 of file Cdr.cpp.

◆ serialize() [17/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const int16_t  short_t)

This function serializes a short.

Parameters
short_tThe value of the short that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 540 of file Cdr.cpp.

◆ serialize() [18/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const int32_t  long_t)

This function serializes a long.

Parameters
long_tThe value of the long that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 579 of file Cdr.cpp.

◆ serialize() [19/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const int64_t  longlong_t)

This function serializes a long long.

Parameters
longlong_tThe value of the long long that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 626 of file Cdr.cpp.

◆ serialize() [20/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const int8_t  int8)

This function serializes an int8_t.

Parameters
int8The value of the int8_t that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 528 of file Cdr.cpp.

◆ serialize() [21/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const long double  ldouble_t)

This function serializes a long double.

Parameters
ldouble_tThe value of the long double that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis 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.

Definition at line 739 of file Cdr.cpp.

◆ serialize() [22/40]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize ( const optional< _T > &  value)
inline

Encodes an optional in the buffer.

Parameters
[in]valueA reference to the optional which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2789 of file Cdr.h.

◆ serialize() [23/40]

template<class _T , size_t _Size>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::array< _T, _Size > &  array_t)
inline

This function template serializes an array.

Parameters
array_tThe array that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 737 of file Cdr.h.

◆ serialize() [24/40]

template<size_t N, typename std::enable_if<(N< 9) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::bitset< N > &  value)
inline

Encodes the value of a bitset into the buffer.

Parameters
[in]valueA reference to the value which will be encoded in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 907 of file Cdr.h.

◆ serialize() [25/40]

template<size_t N, typename std::enable_if<(8< N &&N< 17) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::bitset< N > &  value)
inline

Definition at line 914 of file Cdr.h.

◆ serialize() [26/40]

template<size_t N, typename std::enable_if<(16< N &&N< 33) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::bitset< N > &  value)
inline

Definition at line 921 of file Cdr.h.

◆ serialize() [27/40]

template<size_t N, typename std::enable_if<(32< N &&N< 65) > ::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::bitset< N > &  value)
inline

Definition at line 928 of file Cdr.h.

◆ serialize() [28/40]

template<class _K , class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::map< _K, _T > &  map_t)
inline

This function template serializes a map of non-primitive.

Parameters
map_tThe map that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 840 of file Cdr.h.

◆ serialize() [29/40]

template<class _K , class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::map< _K, _T > &  map_t)
inline

This function template serializes a map of primitive.

Parameters
map_tThe map that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 874 of file Cdr.h.

◆ serialize() [30/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize ( const std::string string_t)
inline

This function serializes a std::string.

Parameters
string_tThe string that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to serialize a string with null characters.

Definition at line 689 of file Cdr.h.

◆ serialize() [31/40]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::vector< _T > &  vector_t)
inline

This function template serializes a sequence of non-primitive.

Parameters
vector_tThe sequence that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 764 of file Cdr.h.

◆ serialize() [32/40]

template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize ( const std::vector< _T > &  vector_t)
inline

This function template serializes a sequence of primitive.

Parameters
vector_tThe sequence that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 794 of file Cdr.h.

◆ serialize() [33/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize ( const std::vector< bool > &  vector_t)
inline

This function template serializes a sequence of booleans.

Parameters
vector_tThe sequence that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 826 of file Cdr.h.

◆ serialize() [34/40]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize ( const std::wstring string_t)
inline

This function serializes a std::wstring.

Parameters
string_tThe wstring that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 710 of file Cdr.h.

◆ serialize() [35/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const uint16_t  ushort_t)

This function serializes an unsigned short.

Parameters
ushort_tThe value of the unsigned short that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 534 of file Cdr.cpp.

◆ serialize() [36/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const uint32_t  ulong_t)

This function serializes an unsigned long.

Parameters
ulong_tThe value of the unsigned long that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 573 of file Cdr.cpp.

◆ serialize() [37/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const uint64_t  ulonglong_t)

This function serializes an unsigned long long.

Parameters
ulonglong_tThe value of the unsigned long long that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 620 of file Cdr.cpp.

◆ serialize() [38/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const uint8_t &  octet_t)

This function serializes an octet.

Parameters
octet_tThe value of the octet that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 507 of file Cdr.cpp.

◆ serialize() [39/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const wchar_t *  string_t)

This function serializes a wstring.

Parameters
string_tThe pointer to the wstring that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 896 of file Cdr.cpp.

◆ serialize() [40/40]

Cdr & eprosima::fastcdr::Cdr::serialize ( const wchar_t  wchar)

This function serializes a wide-char.

Parameters
wcharThe value of the wide-char that will be serialized in the buffer.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 614 of file Cdr.cpp.

◆ serialize_array() [1/24]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize_array ( const _T *  type_t,
size_t  num_elements,
Endianness  endianness 
)
inline

This function template serializes an array of non-basic objects with a different endianness.

Parameters
type_tThe array of objects that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
endiannessEndianness that will be used in the serialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 966 of file Cdr.h.

◆ serialize_array() [2/24]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize_array ( const _T *  value,
size_t  num_elements 
)
inline

Encodes an array of a type not managed by this encoder into the buffer.

To do that, the encoder expects a function serialize to be provided by the type.

Parameters
[in]valueArray which will be encoded in the buffer.
[in]num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 946 of file Cdr.h.

◆ serialize_array() [3/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const bool *  bool_t,
size_t  num_elements 
)

This function serializes an array of booleans.

Parameters
bool_tThe array of booleans that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 931 of file Cdr.cpp.

◆ serialize_array() [4/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const char *  char_t,
size_t  num_elements 
)

This function serializes an array of characters.

Parameters
char_tThe array of characters that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 959 of file Cdr.cpp.

◆ serialize_array() [5/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const double *  double_t,
size_t  num_elements 
)

This function serializes an array of doubles.

Parameters
double_tThe array of doubles that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1192 of file Cdr.cpp.

◆ serialize_array() [6/24]

template<size_t MAX_CHARS>
Cdr & eprosima::fastcdr::Cdr::serialize_array ( const fixed_string< MAX_CHARS > *  value,
size_t  num_elements 
)
inline

Encodes an array of fixed strings.

Parameters
[in]valueArray of fixed strings which will be encoded in the buffer.
[in]num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 1211 of file Cdr.h.

◆ serialize_array() [7/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const float *  float_t,
size_t  num_elements 
)

This function serializes an array of floats.

Parameters
float_tThe array of floats that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1143 of file Cdr.cpp.

◆ serialize_array() [8/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const int16_t *  short_t,
size_t  num_elements 
)

This function serializes an array of shorts.

Parameters
short_tThe array of shorts that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 978 of file Cdr.cpp.

◆ serialize_array() [9/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const int32_t *  long_t,
size_t  num_elements 
)

This function serializes an array of longs.

Parameters
long_tThe array of longs that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1025 of file Cdr.cpp.

◆ serialize_array() [10/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const int64_t *  longlong_t,
size_t  num_elements 
)

This function serializes an array of long longs.

Parameters
longlong_tThe array of long longs that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1090 of file Cdr.cpp.

◆ serialize_array() [11/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const int8_t *  int8,
size_t  num_elements 
)
inline

This function serializes an array of int8_t.

Parameters
int8The sequence of int8_t that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1023 of file Cdr.h.

◆ serialize_array() [12/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const long double *  ldouble_t,
size_t  num_elements 
)

This function serializes an array of long doubles.

Parameters
ldouble_tThe array of long doubles that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis 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.

Definition at line 1245 of file Cdr.cpp.

◆ serialize_array() [13/24]

template<class _T , size_t _Size>
Cdr & eprosima::fastcdr::Cdr::serialize_array ( const std::array< _T, _Size > *  array_t,
size_t  num_elements 
)
inlineprivate

This function template detects the content type of the STD container array and serializes the array.

Parameters
array_tThe array that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 2967 of file Cdr.h.

◆ serialize_array() [14/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const std::string string_t,
size_t  num_elements 
)
inline

This function serializes an array of strings.

Parameters
string_tThe array of strings that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1172 of file Cdr.h.

◆ serialize_array() [15/24]

template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize_array ( const std::vector< _T > &  value)
inline

Encodes an std::vector of primitives as an array.

Parameters
[in]valueReference to a std::vector.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 1231 of file Cdr.h.

◆ serialize_array() [16/24]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize_array ( const std::vector< _T > &  value)
inline

Encodes an std::vector of non-primitives as an array.

Parameters
[in]valueReference to a std::vector.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 1248 of file Cdr.h.

◆ serialize_array() [17/24]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize_array ( const std::vector< _T > &  value,
Endianness  endianness 
)
inline

Encodes an std::vector as an array with a different endianness.

Parameters
[in]valueReference to a std::vector.
[in]endiannessEndianness that will be used in the serialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 1269 of file Cdr.h.

◆ serialize_array() [18/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const std::vector< bool > &  value)
inline

Encodes an std::vector of booleans as an array.

Parameters
[in]valueReference to a std::vector.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 1299 of file Cdr.h.

◆ serialize_array() [19/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const std::wstring string_t,
size_t  num_elements 
)
inline

This function serializes an array of wide-strings.

Parameters
string_tThe array of wide-strings that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1191 of file Cdr.h.

◆ serialize_array() [20/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const uint16_t *  ushort_t,
size_t  num_elements 
)
inline

This function serializes an array of unsigned shorts.

Parameters
ushort_tThe array of unsigned shorts that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1038 of file Cdr.h.

◆ serialize_array() [21/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const uint32_t *  ulong_t,
size_t  num_elements 
)
inline

This function serializes an array of unsigned longs.

Parameters
ulong_tThe array of unsigned longs that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1064 of file Cdr.h.

◆ serialize_array() [22/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const uint64_t *  ulonglong_t,
size_t  num_elements 
)
inline

This function serializes an array of unsigned long longs.

Parameters
ulonglong_tThe array of unsigned long longs that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1101 of file Cdr.h.

◆ serialize_array() [23/24]

TEMPLATE_SPEC Cdr & eprosima::fastcdr::Cdr::serialize_array ( const uint8_t *  octet_t,
size_t  num_elements 
)
inline

This function serializes an array of octets.

Parameters
octet_tThe sequence of octets that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 997 of file Cdr.h.

◆ serialize_array() [24/24]

Cdr & eprosima::fastcdr::Cdr::serialize_array ( const wchar_t *  wchar,
size_t  num_elements 
)

This function serializes an array of wide-chars.

Parameters
wcharThe array of wide-chars that will be serialized in the buffer.
num_elementsNumber of the elements in the array.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1074 of file Cdr.cpp.

◆ serialize_bool_array()

Cdr & eprosima::fastcdr::Cdr::serialize_bool_array ( const std::vector< bool > &  vector_t)
private

Definition at line 2266 of file Cdr.cpp.

◆ serialize_bool_sequence()

Cdr & eprosima::fastcdr::Cdr::serialize_bool_sequence ( const std::vector< bool > &  vector_t)
private

Definition at line 2304 of file Cdr.cpp.

◆ serialize_encapsulation()

Cdr & eprosima::fastcdr::Cdr::serialize_encapsulation ( )

This function writes the encapsulation of the CDR stream. If the CDR stream should contain an encapsulation, then this function should be called before starting to serialize.

Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 302 of file Cdr.cpp.

◆ serialize_member() [1/2]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize_member ( const MemberId member_id,
const _T &  member_value,
XCdrHeaderSelection  header_selection = XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT 
)
inline

XCDR extensions.

Encodes a member of a type according to the encoding algorithm used.

Parameters
[in]member_idMember identifier.
[in]member_valueMember value.
[in]header_selectionSelects which member header will be used to allocate space. Default: XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2666 of file Cdr.h.

◆ serialize_member() [2/2]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize_member ( const MemberId member_id,
const optional< _T > &  member_value,
XCdrHeaderSelection  header_selection = XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT 
)
inline

Encodes an optional member of a type according to the encoding algorithm used.

Parameters
[in]member_idMember identifier.
[in]member_valueOptional member value.
[in]header_selectionSelects which member header will be used to allocate space. Default: XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2688 of file Cdr.h.

◆ serialize_sequence() [1/3]

template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize_sequence ( const _T *  sequence_t,
size_t  num_elements 
)
inline

This function template serializes a raw sequence of non-primitives.

Parameters
sequence_tPointer to the sequence that will be serialized in the buffer.
num_elementsThe number of elements contained in the sequence.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1316 of file Cdr.h.

◆ serialize_sequence() [2/3]

template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr>
Cdr & eprosima::fastcdr::Cdr::serialize_sequence ( const _T *  sequence_t,
size_t  num_elements 
)
inline

This function template serializes a raw sequence of primitives.

Parameters
sequence_tPointer to the sequence that will be serialized in the buffer.
num_elementsThe number of elements contained in the sequence.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1348 of file Cdr.h.

◆ serialize_sequence() [3/3]

template<class _T >
Cdr & eprosima::fastcdr::Cdr::serialize_sequence ( const _T *  sequence_t,
size_t  num_elements,
Endianness  endianness 
)
inline

This function template serializes a raw sequence with a different endianness.

Parameters
sequence_tPointer to the sequence that will be serialized in the buffer.
num_elementsThe number of elements contained in the sequence.
endiannessEndianness that will be used in the serialization of this value.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to serialize a position that exceeds the internal memory size.

Definition at line 1383 of file Cdr.h.

◆ set_dds_cdr_options()

void eprosima::fastcdr::Cdr::set_dds_cdr_options ( const std::array< uint8_t, 2 > &  options)

This function sets the option flags when the CDR type is eprosima::fastcdr::DDS_CDR.

Parameters
optionsNew value for the option flags.

Definition at line 380 of file Cdr.cpp.

◆ set_encoding_flag()

bool eprosima::fastcdr::Cdr::set_encoding_flag ( EncodingAlgorithmFlag  encoding_flag)

Sets the EncodingAlgorithmFlag for the encapsulation when the CDR type is CdrVersion::DDS_CDR, CdrVersion::XCDRv1 or CdrVersion::XCDRv2. This function only works when is called before starting the encoding/decoding.

Parameters
[in]encoding_flagValue to be used in the encapsulation.
Returns
Indicates whether the setting was successful.

Definition at line 358 of file Cdr.cpp.

◆ set_state()

void eprosima::fastcdr::Cdr::set_state ( const state state)

Sets a previous state of the CDR serialization process;.

Parameters
statePrevious state that will be set.

Definition at line 455 of file Cdr.cpp.

◆ set_xcdrv2_dheader()

void eprosima::fastcdr::Cdr::set_xcdrv2_dheader ( const state state)

Uses the state to calculate the member's type size and serialize the value in the previous allocated DHEADER.

Parameters
[in]statestate used to calculate the member's type size.

Definition at line 3513 of file Cdr.cpp.

◆ xcdr1_begin_serialize_member()

Cdr & eprosima::fastcdr::Cdr::xcdr1_begin_serialize_member ( const MemberId member_id,
bool  is_present,
Cdr::state current_state,
Cdr::XCdrHeaderSelection  header_selection 
)
private

Tells to the encoder a member starts to be encoded according to XCDRv1.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier cannot be MEMBER_ID_INVALID and next_member_id_ must be equal to the member identifier or MEMBER_ID_INVALID.
Parameters
[in]is_presentIf the member is present.
Precondition
When XCDRv1, is_present must be always true.
Parameters
[in,out]current_stateState of the encoder previous to call this function.
Precondition
Current encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR or EncodingAlgorithmFlag::PL_CDR.
Parameters
[in]header_selectionSelects which member header will be used to allocate space.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER.

Definition at line 2792 of file Cdr.cpp.

◆ xcdr1_begin_serialize_opt_member()

Cdr & eprosima::fastcdr::Cdr::xcdr1_begin_serialize_opt_member ( const MemberId member_id,
bool  is_present,
Cdr::state current_state,
Cdr::XCdrHeaderSelection  header_selection 
)
private

Tells to the encoder a member starts to be encoded according to XCDRv1.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier cannot be MEMBER_ID_INVALID and next_member_id_ must be equal to the member identifier or MEMBER_ID_INVALID.
Parameters
[in]is_presentIf the member is present.
[in,out]current_stateState of the encoder previous to call this function.
Precondition
Current encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR or EncodingAlgorithmFlag::PL_CDR.
Parameters
[in]header_selectionSelects which member header will be used to allocate space.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER.

Definition at line 2917 of file Cdr.cpp.

◆ xcdr1_begin_serialize_type()

Cdr & eprosima::fastcdr::Cdr::xcdr1_begin_serialize_type ( Cdr::state current_state,
EncodingAlgorithmFlag  type_encoding 
)
privatenoexcept

Tells to the encoder a new type and its members start to be encoded according to XCDRv1.

Parameters
[in,out]current_stateState of the encoder previous to call this function.
Precondition
Current encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR or EncodingAlgorithmFlag::PL_CDR.
Parameters
[in]type_encodingEncoding algorithm used to encode the type and its members.
Precondition
Type encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR or EncodingAlgorithmFlag::PL_CDR.
If it is the beginning of the whole encoding, current encoding must be equal to type encoding.
Returns
Reference to the eprosima::fastcdr::Cdr object.

Definition at line 3231 of file Cdr.cpp.

◆ xcdr1_change_to_long_member_header()

void eprosima::fastcdr::Cdr::xcdr1_change_to_long_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Changes the previous encoded short header to a long header according to XCDRv1.

Parameters
[in]member_idMember identifier.
[in]member_serialized_sizeSize of the serialized member.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2624 of file Cdr.cpp.

◆ xcdr1_change_to_short_member_header()

void eprosima::fastcdr::Cdr::xcdr1_change_to_short_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Changes the previous encoded long header to a short header according to XCDRv1.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x3F00.
Parameters
[in]member_serialized_sizeSize of the serialized member.
Precondition
Serialized size equal or less than 0xFFFF.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2609 of file Cdr.cpp.

◆ xcdr1_deserialize_member_header()

bool eprosima::fastcdr::Cdr::xcdr1_deserialize_member_header ( MemberId member_id,
Cdr::state current_state 
)
private

Decodes a member header according to XCDRv1.

Parameters
[out]member_idMember identifier.
[in,out]current_stateState of the encoder previous to call this function.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to decode an invalid value.

Definition at line 2647 of file Cdr.cpp.

◆ xcdr1_deserialize_type()

Cdr & eprosima::fastcdr::Cdr::xcdr1_deserialize_type ( EncodingAlgorithmFlag  type_encoding,
std::function< bool(Cdr &, const MemberId &)>  functor 
)
private

Tells to the encoder a new type and its members start to be decoded according to XCDRv1.

Parameters
[in]type_encodingEncoding algorithm used to encode the type and its members.
Precondition
Type encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR or EncodingAlgorithmFlag::PL_CDR.
If it is the beginning of the whole encoding, current encoding must be equal to type encoding.
Parameters
[in]functorFunctor called each time a member has to be decoded.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when an incorrect behaviour happens when trying to decode.

Definition at line 3304 of file Cdr.cpp.

◆ xcdr1_end_long_member_header()

void eprosima::fastcdr::Cdr::xcdr1_end_long_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Finish the encoding of a long member header of a member according to XCDRv1.

Parameters
[in]member_idMember identifier.
[in]member_serialized_sizeSize of the serialized member.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2600 of file Cdr.cpp.

◆ xcdr1_end_serialize_member()

Cdr & eprosima::fastcdr::Cdr::xcdr1_end_serialize_member ( const Cdr::state current_state)
private

Tells to the encoder to finish the encoding of the member.

Parameters
[in]current_stateState of the encoder previous to call xcdr1_begin_serialize_member function.
Precondition
next_member_id_ cannot be MEMBER_ID_INVALID.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER.

Definition at line 2847 of file Cdr.cpp.

◆ xcdr1_end_serialize_opt_member()

Cdr & eprosima::fastcdr::Cdr::xcdr1_end_serialize_opt_member ( const Cdr::state current_state)
private

Tells to the encoder to finish the encoding of the member.

Parameters
[in]current_stateState of the encoder previous to call xcdr1_begin_serialize_opt_member function.
Precondition
next_member_id_ cannot be MEMBER_ID_INVALID.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER.

Definition at line 2971 of file Cdr.cpp.

◆ xcdr1_end_serialize_type()

Cdr & eprosima::fastcdr::Cdr::xcdr1_end_serialize_type ( const Cdr::state current_state)
private

Tells to the encoder to finish the encoding of the type.

Parameters
[in]current_stateState of the encoder previous to call xcdr1_begin_serialize_type function.
Precondition
Current encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR or EncodingAlgorithmFlag::PL_CDR.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 3245 of file Cdr.cpp.

◆ xcdr1_end_short_member_header()

void eprosima::fastcdr::Cdr::xcdr1_end_short_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Finish the encoding of a short member header of a member according to XCDRv1.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x3F00.
Parameters
[in]member_serialized_sizeSize of the serialized member.
Precondition
Serialized size equal or less than 0xFFFF.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2570 of file Cdr.cpp.

◆ xcdr1_serialize_long_member_header()

void eprosima::fastcdr::Cdr::xcdr1_serialize_long_member_header ( const MemberId member_id)
private

Encodes a long member header of a member according to XCDRv1.

Parameters
[in]member_idMember identifier.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2583 of file Cdr.cpp.

◆ xcdr1_serialize_short_member_header()

void eprosima::fastcdr::Cdr::xcdr1_serialize_short_member_header ( const MemberId member_id)
private

XCDR extensions.

Encodes a short member header of a member according to XCDRv1.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x3F00.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2555 of file Cdr.cpp.

◆ xcdr2_begin_serialize_member()

Cdr & eprosima::fastcdr::Cdr::xcdr2_begin_serialize_member ( const MemberId member_id,
bool  is_present,
Cdr::state current_state,
XCdrHeaderSelection  header_selection 
)
private

Tells to the encoder a member starts to be encoded according to XCDRv2.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier cannot be MEMBER_ID_INVALID and next_member_id_ must be equal to the member identifier or MEMBER_ID_INVALID.
Parameters
[in]is_presentIf the member is present.
[in,out]current_stateState of the encoder previous to call this function.
Precondition
Current encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR2, EncodingAlgorithmFlag::DELIMIT_CDR2 or EncodingAlgorithmFlag::PL_CDR2.
Parameters
[in]header_selectionSelects which member header will be used to allocate space.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to encode member identifier equal or greater than 0x10000000.

Definition at line 3041 of file Cdr.cpp.

◆ xcdr2_begin_serialize_type()

Cdr & eprosima::fastcdr::Cdr::xcdr2_begin_serialize_type ( Cdr::state current_state,
EncodingAlgorithmFlag  type_encoding 
)
private

Tells to the encoder a new type and its members start to be encoded according to XCDRv2.

Parameters
[in,out]current_stateState of the encoder previous to call this function.
Precondition
Current encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR2, EncodingAlgorithmFlag::DELIMIT_CDR2 or EncodingAlgorithmFlag::PL_CDR2.
Parameters
[in]type_encodingEncoding algorithm used to encode the type and its members.
Precondition
Type encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR2, EncodingAlgorithmFlag::DELIMIT_CDR2 or EncodingAlgorithmFlag::PL_CDR2.
If it is the beginning of the whole encoding, current encoding must be equal to type encoding.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 3263 of file Cdr.cpp.

◆ xcdr2_change_to_long_member_header()

void eprosima::fastcdr::Cdr::xcdr2_change_to_long_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Changes the previous encoded long header to a short header according to XCDRv2.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x10000000.
Parameters
[in]member_serialized_sizeSize of the serialized member.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2759 of file Cdr.cpp.

◆ xcdr2_change_to_short_member_header()

void eprosima::fastcdr::Cdr::xcdr2_change_to_short_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Changes the previous encoded long header to a short header according to XCDRv2.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x10000000.
Parameters
[in]member_serialized_sizeSize of the serialized member.
Precondition
Serialized size equal or less than 8.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2746 of file Cdr.cpp.

◆ xcdr2_deserialize_member_header()

void eprosima::fastcdr::Cdr::xcdr2_deserialize_member_header ( MemberId member_id,
Cdr::state current_state 
)
private

Decodes a member header according to XCDRv2.

Parameters
[out]member_idMember identifier.
[in,out]current_stateState of the encoder previous to call this function.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to decode from a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to decode an invalid value.

Definition at line 3181 of file Cdr.cpp.

◆ xcdr2_deserialize_type()

Cdr & eprosima::fastcdr::Cdr::xcdr2_deserialize_type ( EncodingAlgorithmFlag  type_encoding,
std::function< bool(Cdr &, const MemberId &)>  functor 
)
private

Tells to the encoder a new type and its members start to be decoded according to XCDRv2.

Parameters
[in]type_encodingEncoding algorithm used to encode the type and its members.
Precondition
Type encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR2, EncodingAlgorithmFlag::DELIMIT_CDR2 or EncodingAlgorithmFlag::PL_CDR2.
If it is the beginning of the whole encoding, current encoding must be equal to type encoding.
Parameters
[in]functorFunctor called each time a member has to be decoded.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when an incorrect behaviour happens when trying to decode.

Definition at line 3355 of file Cdr.cpp.

◆ xcdr2_end_long_member_header()

void eprosima::fastcdr::Cdr::xcdr2_end_long_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Finish the encoding of a long member header of a member according to XCDRv2.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x10000000.
Parameters
[in]member_serialized_sizeSize of the serialized member.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2730 of file Cdr.cpp.

◆ xcdr2_end_serialize_member()

Cdr & eprosima::fastcdr::Cdr::xcdr2_end_serialize_member ( const Cdr::state current_state)
private

Tells to the encoder to finish the encoding of the member.

Parameters
[in]current_stateState of the encoder previous to call xcdr2_begin_serialize_member function.
Precondition
next_member_id_ cannot be MEMBER_ID_INVALID.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.
exception::BadParamExceptionThis exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER.

Definition at line 3084 of file Cdr.cpp.

◆ xcdr2_end_serialize_type()

Cdr & eprosima::fastcdr::Cdr::xcdr2_end_serialize_type ( const Cdr::state current_state)
private

Tells to the encoder to finish the encoding of the type.

Parameters
[in]current_stateState of the encoder previous to call xcdr2_begin_serialize_type function.
Precondition
Current encoding algorithm must be EncodingAlgorithmFlag::PLAIN_CDR2, EncodingAlgorithmFlag::DELIMIT_CDR2 or EncodingAlgorithmFlag::PL_CDR2.
Returns
Reference to the eprosima::fastcdr::Cdr object.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 3285 of file Cdr.cpp.

◆ xcdr2_end_short_member_header()

void eprosima::fastcdr::Cdr::xcdr2_end_short_member_header ( const MemberId member_id,
size_t  member_serialized_size 
)
private

Finish the encoding of a short member header of a member according to XCDRv2.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x10000000.
Parameters
[in]member_serialized_sizeSize of the serialized member.
Precondition
Serialized size equal or less than 0x8.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2707 of file Cdr.cpp.

◆ xcdr2_serialize_long_member_header()

void eprosima::fastcdr::Cdr::xcdr2_serialize_long_member_header ( const MemberId member_id)
private

Encodes a long member header of a member according to XCDRv2.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x10000000.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2719 of file Cdr.cpp.

◆ xcdr2_serialize_short_member_header()

void eprosima::fastcdr::Cdr::xcdr2_serialize_short_member_header ( const MemberId member_id)
private

Encodes a short member header of a member according to XCDRv2.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x10000000.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2698 of file Cdr.cpp.

◆ xcdr2_shrink_to_long_member_header()

void eprosima::fastcdr::Cdr::xcdr2_shrink_to_long_member_header ( const MemberId member_id,
const FastBuffer::iterator offset 
)
private

Join the previous encoded long header with the next DHEADER which was serialized after.

Parameters
[in]member_idMember identifier.
Precondition
Member identifier less than 0x10000000.
Parameters
[in]offsetThe last offset of the buffer previous to call this function.
Exceptions
exception::NotEnoughMemoryExceptionThis exception is thrown when trying to encode into a buffer position that exceeds the internal memory size.

Definition at line 2780 of file Cdr.cpp.

Member Data Documentation

◆ align64_

size_t eprosima::fastcdr::Cdr::align64_ {4}
private

Align for types equal or greater than 64bits.

Definition at line 3506 of file Cdr.h.

◆ begin_serialize_member_

begin_serialize_member_functor eprosima::fastcdr::Cdr::begin_serialize_member_ { nullptr }
private

Definition at line 3438 of file Cdr.h.

◆ begin_serialize_opt_member_

begin_serialize_opt_member_functor eprosima::fastcdr::Cdr::begin_serialize_opt_member_ { nullptr }
private

Definition at line 3449 of file Cdr.h.

◆ begin_serialize_type_

begin_serialize_type_functor eprosima::fastcdr::Cdr::begin_serialize_type_ { nullptr }
private

Definition at line 3458 of file Cdr.h.

◆ cdr_buffer_

FastBuffer& eprosima::fastcdr::Cdr::cdr_buffer_
private

Reference to the buffer that will be serialized/deserialized.

Definition at line 3470 of file Cdr.h.

◆ cdr_version_

CdrVersion eprosima::fastcdr::Cdr::cdr_version_ {CdrVersion::XCDRv2}
private

The type of CDR that will be use in serialization/deserialization.

Definition at line 3473 of file Cdr.h.

◆ current_encoding_

EncodingAlgorithmFlag eprosima::fastcdr::Cdr::current_encoding_ {EncodingAlgorithmFlag::PLAIN_CDR2}
private

Stores the current encoding algorithm.

Definition at line 3479 of file Cdr.h.

◆ DEFAULT_ENDIAN

const Cdr::Endianness eprosima::fastcdr::Cdr::DEFAULT_ENDIAN = LITTLE_ENDIANNESS
static

Default endianess in the system.

Definition at line 84 of file Cdr.h.

◆ deserialize_type_

deserialize_type_functor eprosima::fastcdr::Cdr::deserialize_type_ { nullptr }
private

Definition at line 3467 of file Cdr.h.

◆ encapsulation_serialized_

bool eprosima::fastcdr::Cdr::encapsulation_serialized_ {false}
private

Whether the encapsulation was serialized.

Definition at line 3526 of file Cdr.h.

◆ encoding_flag_

EncodingAlgorithmFlag eprosima::fastcdr::Cdr::encoding_flag_ {EncodingAlgorithmFlag::PLAIN_CDR2}
private

Stores the main encoding algorithm.

Definition at line 3476 of file Cdr.h.

◆ end_

FastBuffer::iterator eprosima::fastcdr::Cdr::end_
private

The last position in the buffer;.

Definition at line 3500 of file Cdr.h.

◆ end_serialize_member_

end_serialize_member_functor eprosima::fastcdr::Cdr::end_serialize_member_ { nullptr }
private

Definition at line 3442 of file Cdr.h.

◆ end_serialize_opt_member_

end_serialize_member_functor eprosima::fastcdr::Cdr::end_serialize_opt_member_ { nullptr }
private

Definition at line 3453 of file Cdr.h.

◆ end_serialize_type_

end_serialize_type_functor eprosima::fastcdr::Cdr::end_serialize_type_ { nullptr }
private

Definition at line 3462 of file Cdr.h.

◆ endianness_

uint8_t eprosima::fastcdr::Cdr::endianness_ {Endianness::LITTLE_ENDIANNESS}
private

The endianness that will be applied over the buffer.

Definition at line 3485 of file Cdr.h.

◆ initial_state_

state eprosima::fastcdr::Cdr::initial_state_
private

Stores the initial state.

Definition at line 3523 of file Cdr.h.

◆ last_data_size_

size_t eprosima::fastcdr::Cdr::last_data_size_ {0}
private

Stores the last datasize serialized/deserialized. It's used to optimize.

Definition at line 3491 of file Cdr.h.

◆ next_member_id_

MemberId eprosima::fastcdr::Cdr::next_member_id_
private

Next member identifier to be processed.

Definition at line 3503 of file Cdr.h.

◆ NO_SERIALIZED_MEMBER_SIZE

enum eprosima::fastcdr::Cdr::SerializedMemberSizeForNextInt eprosima::fastcdr::Cdr::NO_SERIALIZED_MEMBER_SIZE
private

Specifies if a DHEADER was serialized. Used to optimize XCDRv2 member headers.

◆ offset_

FastBuffer::iterator eprosima::fastcdr::Cdr::offset_
private

The current position in the serialization/deserialization process.

Definition at line 3494 of file Cdr.h.

◆ options_

std::array<uint8_t, 2> eprosima::fastcdr::Cdr::options_ {{0}}
private

This attribute stores the option flags when the CDR type is DDS_CDR;.

Definition at line 3482 of file Cdr.h.

◆ origin_

FastBuffer::iterator eprosima::fastcdr::Cdr::origin_
private

The position from where the alignment is calculated.

Definition at line 3497 of file Cdr.h.

◆ swap_bytes_

bool eprosima::fastcdr::Cdr::swap_bytes_ {false}
private

This attribute specifies if it is needed to swap the bytes.

Definition at line 3488 of file Cdr.h.


The documentation for this class was generated from the following files: