17.1.5.1. 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

inline TopicDataType()

Constructor.

inline virtual ~TopicDataType()

Destructor.

virtual 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.

Parameters
  • data[in] Pointer to the data

  • payload[out] Pointer to the payload

Returns

True if correct.

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

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

Parameters
  • payload[in] Pointer to the payload

  • data[out] Pointer to the data

Returns

True if correct.

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

Gets the SerializedSizeProvider function.

Parameters

data – Pointer

Returns

function

virtual void *createData() = 0

Create a Data Type.

Returns

Void pointer to the created object.

virtual void deleteData(void *data) = 0

Remove a previously created object.

Parameters

data – Pointer to the created Data.

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

Get the key associated with the data.

Parameters
  • data[in] Pointer to the data.

  • ihandle[out] Pointer to the Handle.

  • force_md5[in] Force MD5 checking.

Returns

True if correct.

inline void setName(const char *nam)

Set topic data type name

Parameters

namTopic data type name

inline const char *getName() const

Get topic data type name

Returns

Topic data type name

inline bool auto_fill_type_object() const

Get the type object auto-fill configuration

Returns

true if the type object should be auto-filled

inline 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

inline bool auto_fill_type_information() const

Get the type information auto-fill configuration

Returns

true if the type information should be auto-filled

inline 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

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

Get the type identifier

Returns

TypeIdV1

inline void type_identifier(const TypeIdV1 &id)

Set type identifier

Parameters

id – new value for TypeIdV1

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

Set type identifier

Parameters

id – shared pointer to TypeIdV1

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

Get the type object

Returns

TypeObjectV1

inline void type_object(const TypeObjectV1 &object)

Set type object

Parameters

object – new value for TypeObjectV1

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

Set type object

Parameters

object – shared pointer to TypeObjectV1

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

Get the type information

Returns

TypeInformation

inline void type_information(const xtypes::TypeInformation &info)

Set type information

Parameters

info – new value for TypeInformation

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

Set type information

Parameters

info – shared pointer to TypeInformation

inline virtual bool is_bounded() const

Checks if the type is bounded.

inline virtual bool is_plain() const

Checks if the type is plain.

inline virtual bool construct_sample(void *memory) const

Construct a sample on a memory location.

Parameters

memory – Pointer to the memory location where the sample should be constructed.

Returns

whether this type supports in-place construction or not.

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.