This class offers an interface to serialize/deserialize some basic types using CDR protocol inside an eprosima::fastcdr::FastBuffer. More...
#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 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. More... | |
Cdr_DllAPI Cdr & | begin_serialize_type (Cdr::state ¤t_state, EncodingAlgorithmFlag type_encoding) |
Tells to the encoder a new type and its members starts to be encoded. More... | |
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. More... | |
Cdr_DllAPI void | change_endianness (Endianness endianness) |
This function sets the current endianness used by the CDR type. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value >::type * = nullptr, typename = void> | |
Cdr & | deserialize (_T &value) |
Decodes the value of a type from the buffer. More... | |
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 & | deserialize (_T &value) |
Decodes an enumeration from the buffer. More... | |
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 & | deserialize (_T &value) |
Decodes an enumeration from the buffer. More... | |
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 & | deserialize (_T &value) |
Decodes an enumeration from the buffer. More... | |
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 & | deserialize (_T &value) |
Decodes an enumeration from the buffer. More... | |
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 & | deserialize (_T &value) |
Decodes an enumeration from the buffer. More... | |
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 & | deserialize (_T &value) |
Decodes an enumeration from the buffer. More... | |
template<class _T > | |
Cdr & | deserialize (_T &value, Endianness endianness) |
Decodes the value of a type with a different endianness. More... | |
Cdr_DllAPI Cdr & | deserialize (bool &bool_t) |
This function deserializes a boolean. More... | |
Cdr_DllAPI Cdr & | deserialize (char &char_t) |
This function deserializes a character. More... | |
Cdr_DllAPI 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() More... | |
Cdr_DllAPI Cdr & | deserialize (double &double_t) |
This function deserializes a double. More... | |
template<class _T > | |
Cdr & | deserialize (external< _T > &value) |
Decodes an external from the buffer. More... | |
template<size_t MAX_CHARS> | |
Cdr & | deserialize (fixed_string< MAX_CHARS > &value) |
Decodes a fixed string. More... | |
Cdr_DllAPI Cdr & | deserialize (float &float_t) |
This function deserializes a float. More... | |
Cdr_DllAPI Cdr & | deserialize (int16_t &short_t) |
This function deserializes a short. More... | |
Cdr_DllAPI Cdr & | deserialize (int32_t &long_t) |
This function deserializes a long. More... | |
Cdr_DllAPI Cdr & | deserialize (int64_t &longlong_t) |
This function deserializes a long long. More... | |
TEMPLATE_SPEC Cdr & | deserialize (int8_t &int8) |
This function deserializes an int8_t. More... | |
Cdr_DllAPI Cdr & | deserialize (long double &ldouble_t) |
This function deserializes a long double. More... | |
template<class _T > | |
Cdr & | deserialize (optional< _T > &value) |
Decodes an optional from the buffer. More... | |
template<class _T > | |
Cdr & | deserialize (optional< external< _T >> &value) |
Decodes an optional of an external from the buffer. More... | |
template<class _T , size_t _Size> | |
Cdr & | deserialize (std::array< _T, _Size > &array_t) |
This function template deserializes an array. More... | |
template<size_t N, typename std::enable_if<(N< 9) > ::type * = nullptr> | |
Cdr & | deserialize (std::bitset< N > &value) |
Decodes a bitset from the buffer. More... | |
template<size_t N, typename std::enable_if<(8< N &&N< 17) > ::type * = nullptr> | |
Cdr & | deserialize (std::bitset< N > &value) |
template<size_t N, typename std::enable_if<(16< N &&N< 33) > ::type * = nullptr> | |
Cdr & | deserialize (std::bitset< N > &value) |
template<size_t N, typename std::enable_if<(32< N &&N< 65) > ::type * = nullptr> | |
Cdr & | deserialize (std::bitset< N > &value) |
template<class _K , class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize (std::map< _K, _T > &map_t) |
This function template deserializes a map of non-primitive. More... | |
template<class _K , class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize (std::map< _K, _T > &map_t) |
This function template deserializes a map of primitive. More... | |
TEMPLATE_SPEC Cdr & | deserialize (std::string &string_t) |
This function deserializes a std::string. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize (std::vector< _T > &vector_t) |
This function template deserializes a sequence of non-primitive. More... | |
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize (std::vector< _T > &vector_t) |
This function template deserializes a sequence of primitive. More... | |
TEMPLATE_SPEC Cdr & | deserialize (std::vector< bool > &vector_t) |
This function template deserializes a sequence. More... | |
TEMPLATE_SPEC Cdr & | deserialize (std::wstring &string_t) |
This function deserializes a std::wstring. More... | |
TEMPLATE_SPEC Cdr & | deserialize (uint16_t &ushort_t) |
This function deserializes an unsigned short. More... | |
TEMPLATE_SPEC Cdr & | deserialize (uint32_t &ulong_t) |
This function deserializes an unsigned long. More... | |
TEMPLATE_SPEC Cdr & | deserialize (uint64_t &ulonglong_t) |
This function deserializes an unsigned long long. More... | |
TEMPLATE_SPEC Cdr & | deserialize (uint8_t &octet_t) |
This function deserializes an octet. More... | |
TEMPLATE_SPEC Cdr & | deserialize (wchar_t &wchar) |
This function deserializes a wide-char. More... | |
Cdr_DllAPI 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() More... | |
template<class _T > | |
Cdr & | deserialize_array (_T *type_t, size_t num_elements, Endianness endianness) |
This function template deserializes an array of non-basic objects with a different endianness. More... | |
template<class _T > | |
Cdr & | deserialize_array (_T *value, size_t num_elements) |
Decodes an array of a type not managed by this encoder from the buffer. More... | |
Cdr_DllAPI Cdr & | deserialize_array (bool *bool_t, size_t num_elements) |
This function deserializes an array of booleans. More... | |
Cdr_DllAPI Cdr & | deserialize_array (char *char_t, size_t num_elements) |
This function deserializes an array of characters. More... | |
Cdr_DllAPI Cdr & | deserialize_array (double *double_t, size_t num_elements) |
This function deserializes an array of doubles. More... | |
Cdr_DllAPI Cdr & | deserialize_array (float *float_t, size_t num_elements) |
This function deserializes an array of floats. More... | |
Cdr_DllAPI Cdr & | deserialize_array (int16_t *short_t, size_t num_elements) |
This function deserializes an array of shorts. More... | |
Cdr_DllAPI Cdr & | deserialize_array (int32_t *long_t, size_t num_elements) |
This function deserializes an array of longs. More... | |
Cdr_DllAPI Cdr & | deserialize_array (int64_t *longlong_t, size_t num_elements) |
This function deserializes an array of long longs. More... | |
TEMPLATE_SPEC Cdr & | deserialize_array (int8_t *int8, size_t num_elements) |
This function deserializes an array of int8_t. More... | |
Cdr_DllAPI Cdr & | deserialize_array (long double *ldouble_t, size_t num_elements) |
This function deserializes an array of long doubles. More... | |
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize_array (std::vector< _T > &value) |
Decodes an array of primitives on a std::vector. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize_array (std::vector< _T > &value) |
Decodes an array of non-primitives on a std::vector. More... | |
template<class _T > | |
Cdr & | deserialize_array (std::vector< _T > &value, Endianness endianness) |
Decodes an array of non-primitives on a std::vector with a different endianness. More... | |
TEMPLATE_SPEC Cdr & | deserialize_array (std::vector< bool > &value) |
Decodes an array of booleans on a std::vector. More... | |
TEMPLATE_SPEC Cdr & | deserialize_array (uint16_t *ushort_t, size_t num_elements) |
This function deserializes an array of unsigned shorts. More... | |
TEMPLATE_SPEC Cdr & | deserialize_array (uint32_t *ulong_t, size_t num_elements) |
This function deserializes an array of unsigned longs. More... | |
TEMPLATE_SPEC Cdr & | deserialize_array (uint64_t *ulonglong_t, size_t num_elements) |
This function deserializes an array of unsigned long longs. More... | |
TEMPLATE_SPEC Cdr & | deserialize_array (uint8_t *octet_t, size_t num_elements) |
This function deserializes an array of octets. More... | |
Cdr_DllAPI Cdr & | deserialize_array (wchar_t *wchar, size_t num_elements) |
This function deserializes an array of wide-chars. More... | |
template<class _T > | |
Cdr & | deserialize_member (_T &member_value) |
Decodes a member of a type according to the encoding algorithm used. More... | |
template<class _T > | |
Cdr & | deserialize_member (optional< _T > &member_value) |
Decodes an optional member of a type according to the encoding algorithm used. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize_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() More... | |
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | deserialize_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() More... | |
template<class _T > | |
Cdr & | deserialize_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() More... | |
TEMPLATE_SPEC Cdr & | deserialize_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() More... | |
TEMPLATE_SPEC Cdr & | deserialize_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() More... | |
Cdr_DllAPI 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. More... | |
Cdr_DllAPI Cdr & | end_serialize_type (Cdr::state ¤t_state) |
Tells to the encoder the encoding of the type finishes. More... | |
Cdr_DllAPI Endianness | endianness () const |
This function returns the current endianness used by the CDR type. More... | |
Cdr_DllAPI char * | get_buffer_pointer () |
This function returns the pointer to the current used buffer. More... | |
Cdr_DllAPI CdrVersion | get_cdr_version () const |
Retrieves the CdrVersion used by the instance. More... | |
Cdr_DllAPI char * | get_current_position () |
This function returns the current position in the CDR stream. More... | |
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. More... | |
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. More... | |
Cdr_DllAPI size_t | get_serialized_data_length () const |
This function returns the length of the serialized data inside the stream. More... | |
Cdr_DllAPI state | get_state () const |
Returns the current state of the CDR serialization process. More... | |
Cdr_DllAPI bool | jump (size_t num_bytes) |
This function skips a number of bytes in the CDR stream buffer. More... | |
Cdr_DllAPI bool | move_alignment_forward (size_t num_bytes) |
This function moves the alignment forward. More... | |
template<class _T > | |
Cdr & | operator<< (const _T &value) |
Encodes the value into the buffer. More... | |
Cdr_DllAPI Cdr & | operator<< (const MemberId &member_id) |
Tells the encoder the member identifier for the next member to be encoded. More... | |
template<class _T > | |
Cdr & | operator>> (_T &value) |
Decodes the value from the buffer. More... | |
Cdr_DllAPI 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. More... | |
Cdr_DllAPI void | reset () |
This function resets the current position in the buffer to the beginning. More... | |
void | reset_alignment () |
This function resets the alignment to the current position in the buffer. More... | |
Cdr_DllAPI Cdr & | serialize (char *string_t) |
This function serializes a string. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value >::type * = nullptr, typename = void> | |
Cdr & | serialize (const _T &value) |
Encodes the value of a type into the buffer. More... | |
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 & | serialize (const _T &value) |
Encodes the value of a enumerator into the buffer. More... | |
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 & | serialize (const _T &value) |
Encodes the value of a enumerator into the buffer. More... | |
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 & | serialize (const _T &value) |
Encodes the value of a enumerator into the buffer. More... | |
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 & | serialize (const _T &value) |
Encodes the value of a enumerator into the buffer. More... | |
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 & | serialize (const _T &value) |
Encodes the value of a enumerator into the buffer. More... | |
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 & | serialize (const _T &value) |
Encodes the value of a enumerator into the buffer. More... | |
template<class _T > | |
Cdr & | serialize (const _T &value, Endianness endianness) |
Encodes the value of a type with a different endianness. More... | |
Cdr_DllAPI Cdr & | serialize (const bool bool_t) |
This function serializes a boolean. More... | |
Cdr_DllAPI Cdr & | serialize (const char *string_t) |
This function serializes a string. More... | |
Cdr_DllAPI Cdr & | serialize (const char char_t) |
This function serializes a character. More... | |
Cdr_DllAPI Cdr & | serialize (const double double_t) |
This function serializes a double. More... | |
template<class _T > | |
Cdr & | serialize (const external< _T > &value) |
Encodes an external in the buffer. More... | |
template<size_t MAX_CHARS> | |
Cdr & | serialize (const fixed_string< MAX_CHARS > &value) |
Encodes a eprosima::fastcdr::fixed_string in the buffer. More... | |
Cdr_DllAPI Cdr & | serialize (const float float_t) |
This function serializes a float. More... | |
Cdr_DllAPI Cdr & | serialize (const int16_t short_t) |
This function serializes a short. More... | |
Cdr_DllAPI Cdr & | serialize (const int32_t long_t) |
This function serializes a long. More... | |
Cdr_DllAPI Cdr & | serialize (const int64_t longlong_t) |
This function serializes a long long. More... | |
Cdr_DllAPI Cdr & | serialize (const int8_t int8) |
This function serializes an int8_t. More... | |
Cdr_DllAPI Cdr & | serialize (const long double ldouble_t) |
This function serializes a long double. More... | |
template<class _T > | |
Cdr & | serialize (const optional< _T > &value) |
Encodes an optional in the buffer. More... | |
template<class _T , size_t _Size> | |
Cdr & | serialize (const std::array< _T, _Size > &array_t) |
This function template serializes an array. More... | |
template<size_t N, typename std::enable_if<(N< 9) > ::type * = nullptr> | |
Cdr & | serialize (const std::bitset< N > &value) |
Encodes the value of a bitset into the buffer. More... | |
template<size_t N, typename std::enable_if<(8< N &&N< 17) > ::type * = nullptr> | |
Cdr & | serialize (const std::bitset< N > &value) |
template<size_t N, typename std::enable_if<(16< N &&N< 33) > ::type * = nullptr> | |
Cdr & | serialize (const std::bitset< N > &value) |
template<size_t N, typename std::enable_if<(32< N &&N< 65) > ::type * = nullptr> | |
Cdr & | serialize (const std::bitset< N > &value) |
template<class _K , class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize (const std::map< _K, _T > &map_t) |
This function template serializes a map of non-primitive. More... | |
template<class _K , class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize (const std::map< _K, _T > &map_t) |
This function template serializes a map of primitive. More... | |
TEMPLATE_SPEC Cdr & | serialize (const std::string &string_t) |
This function serializes a std::string. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize (const std::vector< _T > &vector_t) |
This function template serializes a sequence of non-primitive. More... | |
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize (const std::vector< _T > &vector_t) |
This function template serializes a sequence of primitive. More... | |
TEMPLATE_SPEC Cdr & | serialize (const std::vector< bool > &vector_t) |
This function template serializes a sequence of booleans. More... | |
TEMPLATE_SPEC Cdr & | serialize (const std::wstring &string_t) |
This function serializes a std::wstring. More... | |
Cdr_DllAPI Cdr & | serialize (const uint16_t ushort_t) |
This function serializes an unsigned short. More... | |
Cdr_DllAPI Cdr & | serialize (const uint32_t ulong_t) |
This function serializes an unsigned long. More... | |
Cdr_DllAPI Cdr & | serialize (const uint64_t ulonglong_t) |
This function serializes an unsigned long long. More... | |
Cdr_DllAPI Cdr & | serialize (const uint8_t &octet_t) |
This function serializes an octet. More... | |
Cdr_DllAPI Cdr & | serialize (const wchar_t *string_t) |
This function serializes a wstring. More... | |
Cdr_DllAPI Cdr & | serialize (const wchar_t wchar) |
This function serializes a wide-char. More... | |
template<class _T > | |
Cdr & | serialize_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. More... | |
template<class _T > | |
Cdr & | serialize_array (const _T *value, size_t num_elements) |
Encodes an array of a type not managed by this encoder into the buffer. More... | |
Cdr_DllAPI Cdr & | serialize_array (const bool *bool_t, size_t num_elements) |
This function serializes an array of booleans. More... | |
Cdr_DllAPI Cdr & | serialize_array (const char *char_t, size_t num_elements) |
This function serializes an array of characters. More... | |
Cdr_DllAPI Cdr & | serialize_array (const double *double_t, size_t num_elements) |
This function serializes an array of doubles. More... | |
template<size_t MAX_CHARS> | |
Cdr & | serialize_array (const fixed_string< MAX_CHARS > *value, size_t num_elements) |
Encodes an array of fixed strings. More... | |
Cdr_DllAPI Cdr & | serialize_array (const float *float_t, size_t num_elements) |
This function serializes an array of floats. More... | |
Cdr_DllAPI Cdr & | serialize_array (const int16_t *short_t, size_t num_elements) |
This function serializes an array of shorts. More... | |
Cdr_DllAPI Cdr & | serialize_array (const int32_t *long_t, size_t num_elements) |
This function serializes an array of longs. More... | |
Cdr_DllAPI Cdr & | serialize_array (const int64_t *longlong_t, size_t num_elements) |
This function serializes an array of long longs. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const int8_t *int8, size_t num_elements) |
This function serializes an array of int8_t. More... | |
Cdr_DllAPI Cdr & | serialize_array (const long double *ldouble_t, size_t num_elements) |
This function serializes an array of long doubles. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const std::string *string_t, size_t num_elements) |
This function serializes an array of strings. More... | |
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize_array (const std::vector< _T > &value) |
Encodes an std::vector of primitives as an array. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize_array (const std::vector< _T > &value) |
Encodes an std::vector of non-primitives as an array. More... | |
template<class _T > | |
Cdr & | serialize_array (const std::vector< _T > &value, Endianness endianness) |
Encodes an std::vector as an array with a different endianness. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const std::vector< bool > &value) |
Encodes an std::vector of booleans as an array. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const std::wstring *string_t, size_t num_elements) |
This function serializes an array of wide-strings. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const uint16_t *ushort_t, size_t num_elements) |
This function serializes an array of unsigned shorts. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const uint32_t *ulong_t, size_t num_elements) |
This function serializes an array of unsigned longs. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const uint64_t *ulonglong_t, size_t num_elements) |
This function serializes an array of unsigned long longs. More... | |
TEMPLATE_SPEC Cdr & | serialize_array (const uint8_t *octet_t, size_t num_elements) |
This function serializes an array of octets. More... | |
Cdr_DllAPI Cdr & | serialize_array (const wchar_t *wchar, size_t num_elements) |
This function serializes an array of wide-chars. More... | |
Cdr_DllAPI 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. More... | |
template<class _T > | |
Cdr & | serialize_member (const MemberId &member_id, const _T &member_value, XCdrHeaderSelection header_selection=XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT) |
XCDR extensions. More... | |
template<class _T > | |
Cdr & | serialize_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. More... | |
template<class _T , typename std::enable_if<!std::is_enum< _T >::value &&!std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize_sequence (const _T *sequence_t, size_t num_elements) |
This function template serializes a raw sequence of non-primitives. More... | |
template<class _T , typename std::enable_if< std::is_enum< _T >::value||std::is_arithmetic< _T >::value >::type * = nullptr> | |
Cdr & | serialize_sequence (const _T *sequence_t, size_t num_elements) |
This function template serializes a raw sequence of primitives. More... | |
template<class _T > | |
Cdr & | serialize_sequence (const _T *sequence_t, size_t num_elements, Endianness endianness) |
This function template serializes a raw sequence with a different endianness. More... | |
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. More... | |
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. More... | |
Cdr_DllAPI void | set_state (const state &state) |
Sets a previous state of the CDR serialization process;. More... | |
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. More... | |
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. More... | |
Static Public Attributes | |
static const Cdr_DllAPI Endianness | DEFAULT_ENDIAN = LITTLE_ENDIANNESS |
Default endianess in the system. More... | |
Private Types | |
using | begin_serialize_member_functor = Cdr &(Cdr::*)(const MemberId &, bool, Cdr::state &, XCdrHeaderSelection) |
using | begin_serialize_opt_member_functor = Cdr &(Cdr::*)(const MemberId &, bool, Cdr::state &, XCdrHeaderSelection) |
using | begin_serialize_type_functor = Cdr &(Cdr::*)(Cdr::state &, EncodingAlgorithmFlag) |
using | deserialize_type_functor = Cdr &(Cdr::*)(EncodingAlgorithmFlag, std::function< bool(Cdr &, const MemberId &)>) |
using | end_serialize_member_functor = Cdr &(Cdr::*)(const Cdr::state &) |
using | end_serialize_memberopt__functor = Cdr &(Cdr::*)(const Cdr::state &) |
using | end_serialize_type_functor = Cdr &(Cdr::*)(const Cdr::state &) |
enum | SerializedMemberSizeForNextInt { NO_SERIALIZED_MEMBER_SIZE, SERIALIZED_MEMBER_SIZE, SERIALIZED_MEMBER_SIZE_4, SERIALIZED_MEMBER_SIZE_8 } |
Private Member Functions | |
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. More... | |
Cdr (const Cdr &)=delete | |
Cdr & | cdr_begin_serialize_member (const MemberId &member_id, bool is_present, Cdr::state ¤t_state, XCdrHeaderSelection header_selection) |
Cdr & | cdr_begin_serialize_type (Cdr::state ¤t_state, EncodingAlgorithmFlag type_encoding) |
Cdr & | cdr_deserialize_type (EncodingAlgorithmFlag type_encoding, std::function< bool(Cdr &, const MemberId &)> functor) |
Cdr & | cdr_end_serialize_member (const Cdr::state ¤t_state) |
Cdr & | cdr_end_serialize_type (const Cdr::state ¤t_state) |
template<class _T , size_t _Size> | |
Cdr & | deserialize_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. More... | |
template<class _T , size_t _Size> | |
Cdr & | deserialize_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. More... | |
Cdr_DllAPI Cdr & | deserialize_bool_array (std::vector< bool > &vector_t) |
Cdr_DllAPI Cdr & | deserialize_bool_sequence (std::vector< bool > &vector_t) |
Cdr_DllAPI Cdr & | deserialize_string_sequence (std::string *&sequence_t, size_t &num_elements) |
Cdr_DllAPI Cdr & | deserialize_wstring_sequence (std::wstring *&sequence_t, size_t &num_elements) |
uint32_t | get_long_lc (SerializedMemberSizeForNextInt serialized_member_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 |
uint32_t | get_short_lc (size_t member_serialized_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. More... | |
Cdr & | operator= (const Cdr &)=delete |
const Cdr_DllAPI char * | read_string (uint32_t &length) |
const Cdr_DllAPI std::wstring | read_wstring (uint32_t &length) |
void | reset_callbacks () |
Resets the internal callbacks depending on the current selected Cdr version. More... | |
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. More... | |
template<class _T , size_t _Size> | |
Cdr & | serialize_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. More... | |
Cdr_DllAPI Cdr & | serialize_bool_array (const std::vector< bool > &vector_t) |
Cdr_DllAPI Cdr & | serialize_bool_sequence (const std::vector< bool > &vector_t) |
Cdr & | xcdr1_begin_serialize_member (const MemberId &member_id, bool is_present, Cdr::state ¤t_state, XCdrHeaderSelection header_selection) |
Tells to the encoder a member starts to be encoded according to XCDRv1. More... | |
Cdr & | xcdr1_begin_serialize_opt_member (const MemberId &member_id, bool is_present, Cdr::state ¤t_state, XCdrHeaderSelection header_selection) |
Tells to the encoder a member starts to be encoded according to XCDRv1. More... | |
Cdr & | xcdr1_begin_serialize_type (Cdr::state ¤t_state, EncodingAlgorithmFlag type_encoding) noexcept |
Tells to the encoder a new type and its members start to be encoded according to XCDRv1. More... | |
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. More... | |
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. More... | |
Cdr_DllAPI bool | xcdr1_deserialize_member_header (MemberId &member_id, Cdr::state ¤t_state) |
Decodes a member header according to XCDRv1. More... | |
Cdr & | xcdr1_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. More... | |
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. More... | |
Cdr & | xcdr1_end_serialize_member (const Cdr::state ¤t_state) |
Tells to the encoder to finish the encoding of the member. More... | |
Cdr & | xcdr1_end_serialize_opt_member (const Cdr::state ¤t_state) |
Tells to the encoder to finish the encoding of the member. More... | |
Cdr & | xcdr1_end_serialize_type (const Cdr::state ¤t_state) |
Tells to the encoder to finish the encoding of the type. More... | |
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. More... | |
void | xcdr1_serialize_long_member_header (const MemberId &member_id) |
Encodes a long member header of a member according to XCDRv1. More... | |
void | xcdr1_serialize_short_member_header (const MemberId &member_id) |
XCDR extensions. More... | |
Cdr & | xcdr2_begin_serialize_member (const MemberId &member_id, bool is_present, Cdr::state ¤t_state, XCdrHeaderSelection header_selection) |
Tells to the encoder a member starts to be encoded according to XCDRv2. More... | |
Cdr & | xcdr2_begin_serialize_type (Cdr::state ¤t_state, EncodingAlgorithmFlag type_encoding) |
Tells to the encoder a new type and its members start to be encoded according to XCDRv2. More... | |
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. More... | |
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. More... | |
void | xcdr2_deserialize_member_header (MemberId &member_id, Cdr::state ¤t_state) |
Decodes a member header according to XCDRv2. More... | |
Cdr & | xcdr2_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. More... | |
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. More... | |
Cdr & | xcdr2_end_serialize_member (const Cdr::state ¤t_state) |
Tells to the encoder to finish the encoding of the member. More... | |
Cdr & | xcdr2_end_serialize_type (const Cdr::state ¤t_state) |
Tells to the encoder to finish the encoding of the type. More... | |
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. More... | |
void | xcdr2_serialize_long_member_header (const MemberId &member_id) |
Encodes a long member header of a member according to XCDRv2. More... | |
void | xcdr2_serialize_short_member_header (const MemberId &member_id) |
Encodes a short member header of a member according to XCDRv2. More... | |
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. More... | |
Private Attributes | |
size_t | align64_ {4} |
Align for types equal or greater than 64bits. More... | |
begin_serialize_member_functor | begin_serialize_member_ { nullptr } |
begin_serialize_opt_member_functor | begin_serialize_opt_member_ { nullptr } |
begin_serialize_type_functor | begin_serialize_type_ { nullptr } |
FastBuffer & | cdr_buffer_ |
Reference to the buffer that will be serialized/deserialized. More... | |
CdrVersion | cdr_version_ {CdrVersion::XCDRv2} |
The type of CDR that will be use in serialization/deserialization. More... | |
EncodingAlgorithmFlag | current_encoding_ {EncodingAlgorithmFlag::PLAIN_CDR2} |
Stores the current encoding algorithm. More... | |
deserialize_type_functor | deserialize_type_ { nullptr } |
EncodingAlgorithmFlag | encoding_flag_ {EncodingAlgorithmFlag::PLAIN_CDR2} |
Stores the main encoding algorithm. More... | |
FastBuffer::iterator | end_ |
The last position in the buffer;. More... | |
end_serialize_member_functor | end_serialize_member_ { nullptr } |
end_serialize_member_functor | end_serialize_opt_member_ { nullptr } |
end_serialize_type_functor | end_serialize_type_ { nullptr } |
uint8_t | endianness_ {Endianness::LITTLE_ENDIANNESS} |
The endianness that will be applied over the buffer. More... | |
size_t | last_data_size_ {0} |
Stores the last datasize serialized/deserialized. It's used to optimize. More... | |
MemberId | next_member_id_ |
Next member identifier to be processed. More... | |
enum eprosima::fastcdr::Cdr::SerializedMemberSizeForNextInt | NO_SERIALIZED_MEMBER_SIZE |
Specifies if a DHEADER was serialized. Used to optimize XCDRv2 member headers. More... | |
FastBuffer::iterator | offset_ |
The current position in the serialization/deserialization process. More... | |
std::array< uint8_t, 2 > | options_ {{0}} |
This attribute stores the option flags when the CDR type is DDS_CDR;. More... | |
FastBuffer::iterator | origin_ |
The position from where the alignment is calculated. More... | |
bool | swap_bytes_ {false} |
This attribute specifies if it is needed to swap the bytes. More... | |
This class offers an interface to serialize/deserialize some basic types using CDR protocol inside an eprosima::fastcdr::FastBuffer.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
enum eprosima::fastcdr::Cdr::Endianness : uint8_t |
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.
Used to decide, in encoding algorithms where member headers support a short header version and a long header version, which one will be used.
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.
cdr_buffer | A reference to the buffer that contains (or will contain) the CDR representation. |
endianness | The initial endianness that will be used. The default value is the endianness of the system. |
cdr_version | Represents the type of encoding algorithm that will be used for the encoding. The default value is CdrVersion::XCDRv2. |
|
privatedelete |
|
inlinestatic |
|
inlineprivate |
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.
|
inline |
Tells to the encoder a new type and its members starts to be encoded.
[in,out] | current_state | State of the encoder previous of calling this function. |
[in] | type_encoding | The encoding algorithm used to encode the type and its members. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
private |
|
private |
|
private |
|
private |
|
private |
void eprosima::fastcdr::Cdr::change_endianness | ( | Endianness | endianness | ) |
|
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.
[out] | value | Reference to the variable where the value will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an enumeration from the buffer.
[out] | value | Reference to the variable where the enumeration will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an enumeration from the buffer.
[out] | value | Reference to the variable where the enumeration will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an enumeration from the buffer.
[out] | value | Reference to the variable where the enumeration will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an enumeration from the buffer.
[out] | value | Reference to the variable where the enumeration will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an enumeration from the buffer.
[out] | value | Reference to the variable where the enumeration will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an enumeration from the buffer.
[out] | value | Reference to the variable where the enumeration will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes the value of a type with a different endianness.
[out] | value | Reference to the variable where the value will be stored after decoding from the buffer. |
endianness | Endianness that will be used in the deserialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | bool & | bool_t | ) |
This function deserializes a boolean.
bool_t | The variable that will store the boolean read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to deserialize an invalid value. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | char & | char_t | ) |
This function deserializes a character.
char_t | The variable that will store the character read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
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()
string_t | The pointer that will point to the string read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | double & | double_t | ) |
This function deserializes a double.
double_t | The variable that will store the double read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Decodes an external from the buffer.
[out] | value | A reference to the variable where the external will be stored. |
exception::BadParamException | This exception is thrown when the external is locked. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes a fixed string.
[out] | value | Reference to the variable where the fixed string will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | float & | float_t | ) |
This function deserializes a float.
float_t | The variable that will store the float read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | int16_t & | short_t | ) |
This function deserializes a short.
short_t | The variable that will store the short read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | int32_t & | long_t | ) |
This function deserializes a long.
long_t | The variable that will store the long read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | int64_t & | longlong_t | ) |
This function deserializes a long long.
longlong_t | The variable that will store the long long read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an int8_t.
int8 | The variable that will store the int8_t read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize | ( | long double & | ldouble_t | ) |
This function deserializes a long double.
ldouble_t | The variable that will store the long double read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Decodes an optional from the buffer.
[out] | value | A reference to the variable where the optional will be stored. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an optional of an external from the buffer.
[out] | value | A reference to the variable where the optional will be stored. |
exception::BadParamException | This exception is thrown when the external is locked. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
This function template deserializes an array.
array_t | The variable that will store the array read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
Decodes a bitset from the buffer.
[out] | value | Reference to the variable where the bitset will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
|
inline |
|
inline |
|
inline |
This function template deserializes a map of non-primitive.
map_t | The variable that will store the map read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function template deserializes a map of primitive.
map_t | The variable that will store the map read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes a std::string.
string_t | The variable that will store the string read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function template deserializes a sequence of non-primitive.
vector_t | The variable that will store the sequence read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function template deserializes a sequence of primitive.
vector_t | The variable that will store the sequence read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function template deserializes a sequence.
vector_t | The variable that will store the sequence read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes a std::wstring.
string_t | The variable that will store the string read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an unsigned short.
ushort_t | The variable that will store the unsigned short read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an unsigned long.
ulong_t | The variable that will store the unsigned long read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an unsigned long long.
ulonglong_t | The variable that will store the unsigned long long read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an octet.
octet_t | The variable that will store the octet read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes a wide-char.
wchar | The variable that will store the wide-char read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
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()
string_t | The pointer that will point to the wide string read from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function template deserializes an array of non-basic objects with a different endianness.
type_t | The variable that will store the array of objects read from the buffer. |
num_elements | Number of the elements in the array. |
endianness | Endianness that will be used in the deserialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
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.
[out] | value | Reference to the variable where the array will be stored after decoding from the buffer. |
[in] | num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | bool * | bool_t, |
size_t | num_elements | ||
) |
This function deserializes an array of booleans.
bool_t | The variable that will store the array of booleans read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | char * | char_t, |
size_t | num_elements | ||
) |
This function deserializes an array of characters.
char_t | The variable that will store the array of characters read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | double * | double_t, |
size_t | num_elements | ||
) |
This function deserializes an array of doubles.
double_t | The variable that will store the array of doubles read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | float * | float_t, |
size_t | num_elements | ||
) |
This function deserializes an array of floats.
float_t | The variable that will store the array of floats read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | int16_t * | short_t, |
size_t | num_elements | ||
) |
This function deserializes an array of shorts.
short_t | The variable that will store the array of shorts read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | int32_t * | long_t, |
size_t | num_elements | ||
) |
This function deserializes an array of longs.
long_t | The variable that will store the array of longs read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | int64_t * | longlong_t, |
size_t | num_elements | ||
) |
This function deserializes an array of long longs.
longlong_t | The variable that will store the array of long longs read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an array of int8_t.
int8 | The variable that will store the array of int8_t read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | long double * | ldouble_t, |
size_t | num_elements | ||
) |
This function deserializes an array of long doubles.
ldouble_t | The variable that will store the array of long doubles read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inlineprivate |
This function template detects the content type of the STD container array and deserializes the array.
array_t | The variable that will store the array read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inlineprivate |
This function template detects the content type of STD container array and deserializes the array with a different endianness.
array_t | The variable that will store the array read from the buffer. |
num_elements | Number of the elements in the array. |
endianness | Endianness that will be used in the deserialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
Decodes an array of primitives on a std::vector.
std::vector must have allocated the number of element of the array.
[out] | value | Reference to the std::vector where the array will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an array of non-primitives on a std::vector.
std::vector must have allocated the number of element of the array.
[out] | value | Reference to the std::vector where the array will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
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.
[out] | value | Reference to the std::vector where the array will be stored after decoding from the buffer. |
[in] | endianness | Endianness that will be used in the serialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an array of booleans on a std::vector.
std::vector must have allocated the number of element of the array.
[out] | value | Reference to the std::vector where the array will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
This function deserializes an array of unsigned shorts.
ushort_t | The variable that will store the array of unsigned shorts read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an array of unsigned longs.
ulong_t | The variable that will store the array of unsigned longs read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an array of unsigned long longs.
ulonglong_t | The variable that will store the array of unsigned long longs read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
inline |
This function deserializes an array of octets.
octet_t | The variable that will store the array of octets read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::deserialize_array | ( | wchar_t * | wchar, |
size_t | num_elements | ||
) |
This function deserializes an array of wide-chars.
wchar | The variable that will store the array of wide-chars read from the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
private |
|
private |
|
inline |
Decodes a member of a type according to the encoding algorithm used.
[out] | member_value | A reference of the variable where the member value will be stored. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
inline |
Decodes an optional member of a type according to the encoding algorithm used.
[out] | member_value | A reference of the variable where the optional member value will be stored. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
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()
sequence_t | The pointer that will store the sequence read from the buffer. |
num_elements | This variable return the number of elements of the sequence. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
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()
sequence_t | The pointer that will store the sequence read from the buffer. |
num_elements | This variable return the number of elements of the sequence. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
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()
sequence_t | The pointer that will store the sequence read from the buffer. |
num_elements | This variable return the number of elements of the sequence. |
endianness | Endianness that will be used in the deserialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
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()
sequence_t | The pointer that will store the sequence read from the buffer. |
num_elements | This variable return the number of elements of the sequence. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
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()
sequence_t | The pointer that will store the sequence read from the buffer. |
num_elements | This variable return the number of elements of the sequence. |
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
|
private |
|
inline |
Tells to the encoder a new type and its members starts to be decoded.
[in] | type_encoding | The encoding algorithm used to decode the type and its members. |
[in] | functor | Functor called each time a member has to be decoded. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
|
private |
|
inline |
Tells to the encoder the encoding of the type finishes.
[in] | current_state | State of the encoder previous of calling the function begin_serialize_type. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
Cdr::Endianness eprosima::fastcdr::Cdr::endianness | ( | ) | const |
char * eprosima::fastcdr::Cdr::get_buffer_pointer | ( | ) |
CdrVersion eprosima::fastcdr::Cdr::get_cdr_version | ( | ) | const |
char * eprosima::fastcdr::Cdr::get_current_position | ( | ) |
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.
EncodingAlgorithmFlag eprosima::fastcdr::Cdr::get_encoding_flag | ( | ) | const |
|
inlineprivate |
size_t eprosima::fastcdr::Cdr::get_serialized_data_length | ( | ) | const |
|
inlineconstexprprivate |
|
inlineprivate |
Cdr::state eprosima::fastcdr::Cdr::get_state | ( | ) | const |
bool eprosima::fastcdr::Cdr::jump | ( | size_t | num_bytes | ) |
|
inlineprivate |
This function jumps the number of bytes of the alignment. These bytes should be calculated with the function eprosima::fastcdr::Cdr::alignment.
align | The number of bytes to be skipped. |
bool eprosima::fastcdr::Cdr::move_alignment_forward | ( | size_t | num_bytes | ) |
|
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.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Tells the encoder the member identifier for the next member to be encoded.
[in] | member_id | Member identifier. |
exception::BadParamException | This exception is thrown when a member id is already set without being encoded. |
|
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.
[out] | value | Reference to the variable where the value will be stored after decoding from the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a position that exceeds the internal memory size. |
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.
exception::NotEnoughMemoryException | This exception is thrown when trying to deserialize a position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to deserialize an invalid value. |
|
private |
|
private |
void eprosima::fastcdr::Cdr::reset | ( | ) |
|
inline |
|
private |
|
private |
This function resizes the internal buffer. It only applies if the FastBuffer object was created with the default constructor.
min_size_inc | Minimun size increase for the internal buffer |
|
inline |
This function serializes a string.
string_t | The pointer to the string that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
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.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes the value of a enumerator into the buffer.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes the value of a enumerator into the buffer.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes the value of a enumerator into the buffer.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes the value of a enumerator into the buffer.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes the value of a enumerator into the buffer.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes the value of a enumerator into the buffer.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes the value of a type with a different endianness.
[in] | value | A reference to the value which will be encoded in the buffer. |
endianness | Endianness that will be used in the serialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const bool | bool_t | ) |
This function serializes a boolean.
bool_t | The value of the boolean that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const char * | string_t | ) |
This function serializes a string.
string_t | The pointer to the string that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const char | char_t | ) |
This function serializes a character.
char_t | The value of the character that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const double | double_t | ) |
This function serializes a double.
double_t | The value of the double that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Encodes an external in the buffer.
[in] | value | A reference to the external which will be encoded in the buffer. |
exception::BadParamException | This exception is thrown when external is null. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes a eprosima::fastcdr::fixed_string in the buffer.
[in] | value | A reference to the fixed string which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const float | float_t | ) |
This function serializes a float.
float_t | The value of the float that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const int16_t | short_t | ) |
This function serializes a short.
short_t | The value of the short that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const int32_t | long_t | ) |
This function serializes a long.
long_t | The value of the long that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const int64_t | longlong_t | ) |
This function serializes a long long.
longlong_t | The value of the long long that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an int8_t.
int8 | The value of the int8_t that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const long double | ldouble_t | ) |
This function serializes a long double.
ldouble_t | The value of the long double that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Encodes an optional in the buffer.
[in] | value | A reference to the optional which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
This function template serializes an array.
array_t | The array that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
Encodes the value of a bitset into the buffer.
[in] | value | A reference to the value which will be encoded in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
|
inline |
|
inline |
|
inline |
This function template serializes a map of non-primitive.
map_t | The map that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function template serializes a map of primitive.
map_t | The map that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes a std::string.
string_t | The string that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function template serializes a sequence of non-primitive.
vector_t | The sequence that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function template serializes a sequence of primitive.
vector_t | The sequence that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function template serializes a sequence of booleans.
vector_t | The sequence that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes a std::wstring.
string_t | The wstring that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an unsigned short.
ushort_t | The value of the unsigned short that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an unsigned long.
ulong_t | The value of the unsigned long that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an unsigned long long.
ulonglong_t | The value of the unsigned long long that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an octet.
octet_t | The value of the octet that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize | ( | const wchar_t * | string_t | ) |
This function serializes a wstring.
string_t | The pointer to the wstring that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes a wide-char.
wchar | The value of the wide-char that will be serialized in the buffer. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function template serializes an array of non-basic objects with a different endianness.
type_t | The array of objects that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
endianness | Endianness that will be used in the serialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
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.
[in] | value | Array which will be encoded in the buffer. |
[in] | num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const bool * | bool_t, |
size_t | num_elements | ||
) |
This function serializes an array of booleans.
bool_t | The array of booleans that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const char * | char_t, |
size_t | num_elements | ||
) |
This function serializes an array of characters.
char_t | The array of characters that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const double * | double_t, |
size_t | num_elements | ||
) |
This function serializes an array of doubles.
double_t | The array of doubles that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
Encodes an array of fixed strings.
[in] | value | Array of fixed strings which will be encoded in the buffer. |
[in] | num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const float * | float_t, |
size_t | num_elements | ||
) |
This function serializes an array of floats.
float_t | The array of floats that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const int16_t * | short_t, |
size_t | num_elements | ||
) |
This function serializes an array of shorts.
short_t | The array of shorts that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const int32_t * | long_t, |
size_t | num_elements | ||
) |
This function serializes an array of longs.
long_t | The array of longs that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const int64_t * | longlong_t, |
size_t | num_elements | ||
) |
This function serializes an array of long longs.
longlong_t | The array of long longs that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an array of int8_t.
int8 | The sequence of int8_t that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const long double * | ldouble_t, |
size_t | num_elements | ||
) |
This function serializes an array of long doubles.
ldouble_t | The array of long doubles that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inlineprivate |
This function template detects the content type of the STD container array and serializes the array.
array_t | The array that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an array of strings.
string_t | The array of strings that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
Encodes an std::vector of primitives as an array.
[in] | value | Reference to a std::vector. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes an std::vector of non-primitives as an array.
[in] | value | Reference to a std::vector. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes an std::vector as an array with a different endianness.
[in] | value | Reference to a std::vector. |
[in] | endianness | Endianness that will be used in the serialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes an std::vector of booleans as an array.
[in] | value | Reference to a std::vector. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
This function serializes an array of wide-strings.
string_t | The array of wide-strings that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an array of unsigned shorts.
ushort_t | The array of unsigned shorts that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an array of unsigned longs.
ulong_t | The array of unsigned longs that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an array of unsigned long longs.
ulonglong_t | The array of unsigned long longs that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function serializes an array of octets.
octet_t | The sequence of octets that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
Cdr & eprosima::fastcdr::Cdr::serialize_array | ( | const wchar_t * | wchar, |
size_t | num_elements | ||
) |
This function serializes an array of wide-chars.
wchar | The array of wide-chars that will be serialized in the buffer. |
num_elements | Number of the elements in the array. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
private |
|
private |
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.
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
XCDR extensions.
Encodes a member of a type according to the encoding algorithm used.
[in] | member_id | Member identifier. |
[in] | member_value | Member value. |
[in] | header_selection | Selects which member header will be used to allocate space. Default: XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
Encodes an optional member of a type according to the encoding algorithm used.
[in] | member_id | Member identifier. |
[in] | member_value | Optional member value. |
[in] | header_selection | Selects which member header will be used to allocate space. Default: XCdrHeaderSelection::AUTO_WITH_SHORT_HEADER_BY_DEFAULT. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
inline |
This function template serializes a raw sequence of non-primitives.
sequence_t | Pointer to the sequence that will be serialized in the buffer. |
num_elements | The number of elements contained in the sequence. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function template serializes a raw sequence of primitives.
sequence_t | Pointer to the sequence that will be serialized in the buffer. |
num_elements | The number of elements contained in the sequence. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
|
inline |
This function template serializes a raw sequence with a different endianness.
sequence_t | Pointer to the sequence that will be serialized in the buffer. |
num_elements | The number of elements contained in the sequence. |
endianness | Endianness that will be used in the serialization of this value. |
exception::NotEnoughMemoryException | This exception is thrown when trying to serialize a position that exceeds the internal memory size. |
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.
options | New value for the option flags. |
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.
[in] | encoding_flag | Value to be used in the encapsulation. |
void eprosima::fastcdr::Cdr::set_state | ( | const state & | state | ) |
void eprosima::fastcdr::Cdr::set_xcdrv2_dheader | ( | const state & | state | ) |
|
private |
Tells to the encoder a member starts to be encoded according to XCDRv1.
[in] | member_id | Member identifier. |
[in] | is_present | If the member is present. |
[in,out] | current_state | State of the encoder previous to call this function. |
[in] | header_selection | Selects which member header will be used to allocate space. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER. |
|
private |
Tells to the encoder a member starts to be encoded according to XCDRv1.
[in] | member_id | Member identifier. |
[in] | is_present | If the member is present. |
[in,out] | current_state | State of the encoder previous to call this function. |
[in] | header_selection | Selects which member header will be used to allocate space. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER. |
|
privatenoexcept |
Tells to the encoder a new type and its members start to be encoded according to XCDRv1.
[in,out] | current_state | State of the encoder previous to call this function. |
[in] | type_encoding | Encoding algorithm used to encode the type and its members. |
|
private |
Changes the previous encoded short header to a long header according to XCDRv1.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Changes the previous encoded long header to a short header according to XCDRv1.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Decodes a member header according to XCDRv1.
[out] | member_id | Member identifier. |
[in,out] | current_state | State of the encoder previous to call this function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to decode an invalid value. |
|
private |
Tells to the encoder a new type and its members start to be decoded according to XCDRv1.
[in] | type_encoding | Encoding algorithm used to encode the type and its members. |
[in] | functor | Functor called each time a member has to be decoded. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when an incorrect behaviour happens when trying to decode. |
|
private |
Finish the encoding of a long member header of a member according to XCDRv1.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Tells to the encoder to finish the encoding of the member.
[in] | current_state | State of the encoder previous to call xcdr1_begin_serialize_member function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER. |
|
private |
Tells to the encoder to finish the encoding of the member.
[in] | current_state | State of the encoder previous to call xcdr1_begin_serialize_opt_member function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER. |
|
private |
Tells to the encoder to finish the encoding of the type.
[in] | current_state | State of the encoder previous to call xcdr1_begin_serialize_type function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Finish the encoding of a short member header of a member according to XCDRv1.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Encodes a long member header of a member according to XCDRv1.
[in] | member_id | Member identifier. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
XCDR extensions.
Encodes a short member header of a member according to XCDRv1.
[in] | member_id | Member identifier. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Tells to the encoder a member starts to be encoded according to XCDRv2.
[in] | member_id | Member identifier. |
[in] | is_present | If the member is present. |
[in,out] | current_state | State of the encoder previous to call this function. |
[in] | header_selection | Selects which member header will be used to allocate space. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to encode member identifier equal or greater than 0x10000000. |
|
private |
Tells to the encoder a new type and its members start to be encoded according to XCDRv2.
[in,out] | current_state | State of the encoder previous to call this function. |
[in] | type_encoding | Encoding algorithm used to encode the type and its members. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Changes the previous encoded long header to a short header according to XCDRv2.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Changes the previous encoded long header to a short header according to XCDRv2.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Decodes a member header according to XCDRv2.
[out] | member_id | Member identifier. |
[in,out] | current_state | State of the encoder previous to call this function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to decode from a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to decode an invalid value. |
|
private |
Tells to the encoder a new type and its members start to be decoded according to XCDRv2.
[in] | type_encoding | Encoding algorithm used to encode the type and its members. |
[in] | functor | Functor called each time a member has to be decoded. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when an incorrect behaviour happens when trying to decode. |
|
private |
Finish the encoding of a long member header of a member according to XCDRv2.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Tells to the encoder to finish the encoding of the member.
[in] | current_state | State of the encoder previous to call xcdr2_begin_serialize_member function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
exception::BadParamException | This exception is thrown when trying to encode a long header when header_selection is XCdrHeaderSelection::SHORT_HEADER. |
|
private |
Tells to the encoder to finish the encoding of the type.
[in] | current_state | State of the encoder previous to call xcdr2_begin_serialize_type function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Finish the encoding of a short member header of a member according to XCDRv2.
[in] | member_id | Member identifier. |
[in] | member_serialized_size | Size of the serialized member. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Encodes a long member header of a member according to XCDRv2.
[in] | member_id | Member identifier. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Encodes a short member header of a member according to XCDRv2.
[in] | member_id | Member identifier. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
Join the previous encoded long header with the next DHEADER which was serialized after.
[in] | member_id | Member identifier. |
[in] | offset | The last offset of the buffer previous to call this function. |
exception::NotEnoughMemoryException | This exception is thrown when trying to encode into a buffer position that exceeds the internal memory size. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Specifies if a DHEADER was serialized. Used to optimize XCDRv2 member headers.
|
private |
|
private |
|
private |
|
private |