22 #include <fastcdr/FastBuffer.h> 23 #include <fastcdr/Cdr.h> 35 setName(
"sensor_msgs::msg::dds_::Imu_");
37 type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4);
38 m_typeSize =
static_cast<uint32_t
>(type_size) + 4;
42 m_keyBuffer =
reinterpret_cast<unsigned char*
>(malloc(keyLength));
58 Imu* p_type =
static_cast<Imu*
>(data);
61 eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size);
63 eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR);
64 payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
66 ser.serialize_encapsulation();
73 catch (eprosima::fastcdr::exception::NotEnoughMemoryException& )
79 payload->length =
static_cast<uint32_t
>(ser.getSerializedDataLength());
90 Imu* p_type =
static_cast<Imu*
>(data);
93 eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->length);
96 eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR);
99 deser.read_encapsulation();
100 payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
105 catch (eprosima::fastcdr::exception::NotEnoughMemoryException& )
116 return [data]() -> uint32_t
125 return reinterpret_cast<void*
>(
new Imu());
131 delete(
reinterpret_cast<Imu*
>(data));
139 if (!m_isGetKeyDefined)
144 Imu* p_type =
static_cast<Imu*
>(data);
147 eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(
m_keyBuffer),
151 eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS);
156 m_md5.update(
m_keyBuffer, static_cast<unsigned int>(ser.getSerializedDataLength()));
158 for (uint8_t i = 0; i < 16; ++i)
160 handle->value[i] =
m_md5.digest[i];
165 for (uint8_t i = 0; i < 16; ++i)
virtual eProsima_user_DllExport void * createData() override
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
unsigned char * m_keyBuffer
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
eprosima::fastrtps::rtps::InstanceHandle_t InstanceHandle_t
virtual eProsima_user_DllExport void deleteData(void *data) override
eprosima::fastrtps::rtps::SerializedPayload_t SerializedPayload_t
static eProsima_user_DllExport size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of the Key of an object depending on the buffer ali...
This class represents the structure Imu defined by the user in the IDL file.
virtual eProsima_user_DllExport std::function< uint32_t()> getSerializedSizeProvider(void *data) override
eProsima_user_DllExport ImuPubSubType()
eprosima::fastrtps::rtps::SerializedPayload_t SerializedPayload_t
virtual eProsima_user_DllExport ~ImuPubSubType() override
static eProsima_user_DllExport size_t getMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of an object depending on the buffer alignment...
static eProsima_user_DllExport size_t getCdrSerializedSize(const sensor_msgs::msg::Imu &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
eprosima::fastrtps::rtps::InstanceHandle_t InstanceHandle_t
virtual eProsima_user_DllExport bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload) override
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
virtual eProsima_user_DllExport bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false) override
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
virtual eProsima_user_DllExport bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data) override