19.1.5.9. TypeSupport

class fastdds.TypeSupport(*args)

Notes: This class inherits from std::shared_ptr<TopicDataType>. Class TypeSupport 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.

create_data()

Creates new data

Return type

void

Returns

Pointer to the data

delete_data(data)

Deletes data

Parameters

data (void) – Pointer to the data to delete

deserialize(payload, data)

Deserializes the data

Parameters
  • payload (eprosima::fastrtps::rtps::SerializedPayload_t) – Pointer to payload

  • data (void) – Pointer to data

Return type

boolean

Returns

true if it is deserialized correctly, false if not

empty()

Check if the TypeSupport is empty

Return type

boolean

Returns

true if empty, false if not

get_key(data, i_handle, force_md5=False)

Getter for the data key

Parameters
  • data (void) – Pointer to data

  • i_handle (InstanceHandle_t) – InstanceHandle pointer to store the key

  • force_md5 (boolean) – boolean to force md5 (default: false)

Return type

boolean

Returns

true if the key is returned, false if not

get_serialized_size_provider(*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.

get_type_name()

Getter for the type name

Return type

string

Returns

name of the data type

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.

register_type(*args)

Overload 1:

Registers the type on a participant

Parameters

participant (DomainParticipant) – DomainParticipant where the type is going to be registered

Return type

ReturnCode_t

Returns

RETCODE_BAD_PARAMETER if the type name is empty, RETCODE_PRECONDITION_NOT_MET if there is another type with the same name registered on the DomainParticipant and RETCODE_OK if it is registered correctly


Overload 2:

Registers the type on a participant

Parameters
  • participant (DomainParticipant) – DomainParticipant where the type is going to be registered

  • type_name (string) – Name of the type to register

Return type

ReturnCode_t

Returns

RETCODE_BAD_PARAMETER if the type name is empty, RETCODE_PRECONDITION_NOT_MET if there is another type with the same name registered on the DomainParticipant and RETCODE_OK if it is registered correctly

serialize(*args)

Overload 1:

Serializes the data

Parameters
  • data (void) – Pointer to data

  • payload (eprosima::fastrtps::rtps::SerializedPayload_t) – Pointer to payload

Return type

boolean

Returns

true if it is serialized correctly, false if not


Overload 2:

Serializes the data

Parameters
  • data (void) – Pointer to data

  • payload (eprosima::fastrtps::rtps::SerializedPayload_t) – Pointer to payload data_representation Representation that should be used to encode the data into the payload.

Return type

boolean

Returns

true if it is serialized correctly, false if not

set(ptr)
property thisown

The membership flag