15.1.5.9. TypeSupport¶
-
class
eprosima::fastdds::dds
::
TypeSupport
: public std::shared_ptr<fastdds::dds::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.
- Note
This class inherits from std::shared_ptr<TopicDataType>.
Subclassed by eprosima::fastdds::dds::builtin::TypeLookup_ReplyTypeSupport, eprosima::fastdds::dds::builtin::TypeLookup_RequestTypeSupport
Public Functions
-
TypeSupport
()¶ Constructor.
-
TypeSupport
(const TypeSupport &type)¶ Copy Constructor.
- Parameters
type
: Another instance of TypeSupport
-
TypeSupport
(fastdds::dds::TopicDataType *ptr)¶ TypeSupport constructor that receives a TopicDataType pointer.
The passed pointer will be managed by the TypeSupport object, so creating two TypeSupport from the same pointer or deleting the passed pointer will produce a runtime error.
- Parameters
ptr
:
-
TypeSupport
(fastrtps::types::DynamicPubSubType ptr)¶ TypeSupport constructor that receives a DynamicPubSubType.
It will copy the instance so the user will keep the ownership of his object.
- Parameters
ptr
:
-
ReturnCode_t
register_type
(DomainParticipant *participant) const¶ Registers the type on a participant.
- Return
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
- Parameters
participant
: DomainParticipant where the type is going to be registered
-
ReturnCode_t
register_type
(DomainParticipant *participant, std::string type_name) const¶ Registers the type on a participant.
- Return
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
- Parameters
participant
: DomainParticipant where the type is going to be registeredtype_name
: Name of the type to register
-
const std::string &
get_type_name
() const¶ Getter for the type name.
- Return
name of the data type
-
bool
serialize
(void *data, fastrtps::rtps::SerializedPayload_t *payload)¶ Serializes the data.
- Return
true if it is serialized correctly, false if not
- Parameters
data
: Pointer to datapayload
: Pointer to payload
-
bool
deserialize
(fastrtps::rtps::SerializedPayload_t *payload, void *data)¶ Deserializes the data.
- Return
true if it is deserialized correctly, false if not
- Parameters
payload
: Pointer to payloaddata
: Pointer to data
-
std::function<uint32_t()>
get_serialized_size_provider
(void *data)¶ Getter for the SerializedSizeProvider.
- Return
function
- Parameters
data
: Pointer to data
-
void *
create_data
()¶ Creates new data.
- Return
Pointer to the data
-
void
delete_data
(void *data)¶ Deletes data.
- Parameters
data
: Pointer to the data to delete
-
bool
get_key
(void *data, InstanceHandle_t *i_handle, bool force_md5 = false)¶ Getter for the data key.
- Return
true if the key is returned, false if not
- Parameters
data
: Pointer to datai_handle
: InstanceHandle pointer to store the keyforce_md5
: boolean to force md5 (default: false)
-
bool
empty
() const¶ Check if the TypeSupport is empty.
- Return
true if empty, false if not