14.1.5.2. TopicDataType

class eprosima::fastdds::dds::TopicDataType

Class TopicDataType used to provide the DomainRTPSParticipant with the methods to serialize, deserialize and get the key of a specific data type. The user should created a class that inherits from this one, where Serialize and deserialize methods MUST be implemented. ,

Subclassed by eprosima::fastdds::dds::builtin::TypeLookup_ReplyPubSubType, eprosima::fastdds::dds::builtin::TypeLookup_RequestPubSubType

Public Functions

TopicDataType()

Constructor.

~TopicDataType()

Destructor.

bool serialize(void *data, fastrtps::rtps::SerializedPayload_t *payload) = 0

Serialize method, it should be implemented by the user, since it is abstract. It is VERY IMPORTANT that the user sets the SerializedPayload length correctly.

Return

True if correct.

Parameters
  • [in] data: Pointer to the data

  • [out] payload: Pointer to the payload

bool deserialize(fastrtps::rtps::SerializedPayload_t *payload, void *data) = 0

Deserialize method, it should be implemented by the user, since it is abstract.

Return

True if correct.

Parameters
  • [in] payload: Pointer to the payload

  • [out] data: Pointer to the data

std::function<uint32_t()> getSerializedSizeProvider(void *data) = 0

Gets the SerializedSizeProvider function.

Return

function

Parameters
  • data: Pointer

void *createData() = 0

Create a Data Type.

Return

Void pointer to the created object.

void deleteData(void *data) = 0

Remove a previously created object.

Parameters
  • data: Pointer to the created Data.

bool getKey(void *data, fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5 = false) = 0

Get the key associated with the data.

Return

True if correct.

Parameters
  • [in] data: Pointer to the data.

  • [out] ihandle: Pointer to the Handle.

  • [in] force_md5: Force MD5 checking.

void setName(const char *nam)

Set topic data type name

Parameters
  • nam: Topic data type name

const char *getName() const

Get topic data type name

Return

Topic data type name

bool auto_fill_type_object() const

Get the type object auto-fill configuration

Return

true if the type object should be auto-filled

void auto_fill_type_object(bool auto_fill_type_object)

Set the type object auto-fill configuration

Parameters
  • auto_fill_type_object: new value to set

bool auto_fill_type_information() const

Get the type information auto-fill configuration

Return

true if the type information should be auto-filled

void auto_fill_type_information(bool auto_fill_type_information)

Set type information auto-fill configuration

Parameters
  • auto_fill_type_information: new value to set

const std::shared_ptr<TypeIdV1> type_identifier() const

Get the type identifier

Return

TypeIdV1

void type_identifier(const TypeIdV1 &id)

Set type identifier

Parameters

void type_identifier(const std::shared_ptr<TypeIdV1> id)

Set type identifier

Parameters

const std::shared_ptr<TypeObjectV1> type_object() const

Get the type object

Return

TypeObjectV1

void type_object(const TypeObjectV1 &object)

Set type object

Parameters

void type_object(std::shared_ptr<TypeObjectV1> object)

Set type object

Parameters

const std::shared_ptr<xtypes::TypeInformation> type_information() const

Get the type information

Return

TypeInformation

void type_information(const xtypes::TypeInformation &info)

Set type information

Parameters
  • info: new value for TypeInformation

void type_information(std::shared_ptr<xtypes::TypeInformation> info)

Set type information

Parameters
  • info: shared pointer to TypeInformation

Public Members

uint32_t m_typeSize

Maximum serialized size of the type in bytes. If the type has unbounded fields, and therefore cannot have a maximum size, use 0.

bool m_isGetKeyDefined

Indicates whether the method to obtain the key has been implemented.