Go to the documentation of this file.
12 #include <fastcdr/FastBuffer.h>
13 #include <fastcdr/Cdr.h>
23 setName(
"udds::blob");
25 type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4);
26 m_typeSize =
static_cast<uint32_t>(type_size) + 4;
30 m_keyBuffer =
reinterpret_cast<unsigned char*
>(malloc(keyLength));
49 eprosima::fastcdr::FastBuffer fastbuffer(
reinterpret_cast<char*
>(payload->data), payload->max_size);
51 eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR);
52 payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
54 ser.serialize_encapsulation();
61 catch (eprosima::fastcdr::exception::NotEnoughMemoryException& )
67 payload->length =
static_cast<uint32_t>(ser.getSerializedDataLength());
81 eprosima::fastcdr::FastBuffer fastbuffer(
reinterpret_cast<char*
>(payload->data), payload->length);
84 eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR);
87 deser.read_encapsulation();
88 payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
93 catch (eprosima::fastcdr::exception::NotEnoughMemoryException& )
113 return reinterpret_cast<void*
>(
new blob());
119 delete(
reinterpret_cast<blob*
>(
data));
127 if (!m_isGetKeyDefined)
135 eprosima::fastcdr::FastBuffer fastbuffer(
reinterpret_cast<char*
>(
m_keyBuffer),
139 eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS);
144 m_md5.update(
m_keyBuffer,
static_cast<unsigned int>(ser.getSerializedDataLength()));
eProsima_user_DllExport blobPubSubType()
unsigned char * m_keyBuffer
virtual eProsima_user_DllExport void deleteData(void *data) override
virtual eProsima_user_DllExport ~blobPubSubType() override
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...
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.
virtual eProsima_user_DllExport bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data) override
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
virtual eProsima_user_DllExport void * createData() override
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
virtual eProsima_user_DllExport bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload) override
This class represents the structure blob defined by the user in the IDL file.
eprosima::fastrtps::rtps::SerializedPayload_t SerializedPayload_t
virtual eProsima_user_DllExport bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false) override
static eProsima_user_DllExport size_t getCdrSerializedSize(const udds::blob &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
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
virtual eProsima_user_DllExport std::function< uint32_t()> getSerializedSizeProvider(void *data) override
librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01