19.1.5.2. TopicDataType

class fastdds.TopicDataType(*args, **kwargs)

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.

auto_fill_type_information(*args)

Overload 1:

Get the type information auto-fill configuration

Return type

boolean

Returns

true if the type information should be auto-filled


Overload 2:

Set type information auto-fill configuration

Parameters

auto_fill_type_information (boolean) – new value to set

auto_fill_type_object(*args)

Overload 1:

Get the type object auto-fill configuration

Return type

boolean

Returns

true if the type object should be auto-filled


Overload 2:

Set the type object auto-fill configuration

Parameters

auto_fill_type_object (boolean) – new value to set

construct_sample(memory)

Construct a sample on a memory location.

Parameters

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

Return type

boolean

Returns

whether this type supports in-place construction or not.

createData()

Create a Data Type.

Return type

void

Returns

Void pointer to the created object.

deleteData(data)

Remove a previously created object.

Parameters

data (void) – Pointer to the created Data.

deserialize(payload, data)

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

payload Pointer to the payload data Pointer to the data :rtype: boolean :return: True if correct.

getKey(data, ihandle, force_md5=False)

Get the key associated with the data.

data Pointer to the data. ihandle Pointer to the Handle. force_md5 Force MD5 checking. :rtype: boolean :return: True if correct.

getName()

Get topic data type name

Return type

string

Returns

Topic data type name

getSerializedSizeProvider(*args)

Overload 1:

Returns a function which can be used to calculate the serialized size of the provided data.

data Pointer to data. :rtype: std::function< uint32_t () > :return: Functor which calculates the serialized size of the data.


Overload 2:

Returns a function which can be used to calculate the serialized size of the provided data.

data Pointer to data. data_representation Representation that should be used for calculating the serialized size. :rtype: std::function< uint32_t () > :return: Functor which calculates the serialized size of the data.

is_bounded()

Checks if the type is bounded.

is_plain(*args)

Overload 1:

Checks if the type is plain when using default encoding.


Overload 2:

Checks if the type is plain when using a specific encoding.

property m_isGetKeyDefined

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

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

serialize(*args)

Overload 1:

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.

data Pointer to the data payload Pointer to the payload :rtype: boolean :return: True if correct.


Overload 2:

Serialize method, it should be implemented by the user, since it is abstract. If not implemented, this method will call the serialize method in which the topic data representation is not considered. It is VERY IMPORTANT that the user sets the SerializedPayload length correctly.

data Pointer to the data payload Pointer to the payload data_representation Representation that should be used to encode the data into the payload. :rtype: boolean :return: True if correct.

setName(nam)

Set topic data type name

Parameters

nam (string) – Topic data type name

property thisown

The membership flag

type_identifier(*args)

Overload 1:

Get the type identifier

Return type

std::shared_ptr< eprosima::fastdds::dds::TypeIdV1 >

Returns

TypeIdV1


Overload 2:

Set type identifier

Parameters

id (TypeIdV1) – new value for TypeIdV1


Overload 3:

Set type identifier

Parameters

id (std::shared_ptr< eprosima::fastdds::dds::TypeIdV1 >) – shared pointer to TypeIdV1

type_information(*args)

Overload 1:

Get the type information

Return type

std::shared_ptr< eprosima::fastdds::dds::xtypes::TypeInformation >

Returns

TypeInformation


Overload 2:

Set type information

Parameters

info (TypeInformation) – new value for TypeInformation


Overload 3:

Set type information

Parameters

info (std::shared_ptr< eprosima::fastdds::dds::xtypes::TypeInformation >) – shared pointer to TypeInformation

type_object(*args)

Overload 1:

Get the type object

Return type

std::shared_ptr< eprosima::fastdds::dds::TypeObjectV1 >

Returns

TypeObjectV1


Overload 2:

Set type object

Parameters

object (TypeObjectV1) – new value for TypeObjectV1


Overload 3:

Set type object

Parameters

object (std::shared_ptr< eprosima::fastdds::dds::TypeObjectV1 >) – shared pointer to TypeObjectV1