Class TypeSupport
Defined in File TypeSupport.hpp
Inheritance Relationships
Base Type
public std::shared_ptr< fastdds::dds::TopicDataType >
Derived Types
public eprosima::fastdds::dds::builtin::TypeLookup_ReplyTypeSupport
(Class TypeLookup_ReplyTypeSupport)public eprosima::fastdds::dds::builtin::TypeLookup_RequestTypeSupport
(Class TypeLookup_RequestTypeSupport)
Class Documentation
-
class 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 Types
-
using ReturnCode_t = eprosima::fastrtps::types::ReturnCode_t
-
using Base = std::shared_ptr<fastdds::dds::TopicDataType>
Public Functions
-
RTPS_DllAPI TypeSupport() noexcept = default
Constructor.
-
RTPS_DllAPI TypeSupport(const TypeSupport &type) noexcept = default
Copy Constructor.
- Parameters:
type – Another instance of TypeSupport
-
RTPS_DllAPI TypeSupport(TypeSupport &&type) noexcept = default
Move Constructor.
- Parameters:
type – Another instance of TypeSupport
- RTPS_DllAPI TypeSupport & operator= (const TypeSupport &type) noexcept=default
Copy Assignment.
- Parameters:
type – Another instance of TypeSupport
- RTPS_DllAPI TypeSupport & operator= (TypeSupport &&type) noexcept=default
Move Assignment.
- Parameters:
type – Another instance of TypeSupport
-
inline explicit RTPS_DllAPI 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 –
-
inline RTPS_DllAPI 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 –
- virtual RTPS_DllAPI ReturnCode_t register_type (DomainParticipant *participant) const
Registers the type on a participant.
- Parameters:
participant – DomainParticipant where the type is going to be registered
- 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
- virtual RTPS_DllAPI ReturnCode_t register_type (DomainParticipant *participant, std::string type_name) const
Registers the type on a participant.
- Parameters:
participant – DomainParticipant where the type is going to be registered
type_name – Name of the type to register
- 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
- inline virtual RTPS_DllAPI const std::string & get_type_name () const
Getter for the type name.
- Returns:
name of the data type
- inline virtual RTPS_DllAPI bool serialize (void *data, fastrtps::rtps::SerializedPayload_t *payload)
Serializes the data.
- Parameters:
data – Pointer to data
payload – Pointer to payload
- Returns:
true if it is serialized correctly, false if not
- virtual RTPS_DllAPI bool serialize (void *data, fastrtps::rtps::SerializedPayload_t *payload, DataRepresentationId_t data_representation)
Serializes the data.
- Parameters:
data – Pointer to data
payload – Pointer to payload
data_representation – [in] Representation that should be used to encode the data into the payload.
- Returns:
true if it is serialized correctly, false if not
- virtual RTPS_DllAPI bool deserialize (fastrtps::rtps::SerializedPayload_t *payload, void *data)
Deserializes the data.
- Parameters:
payload – Pointer to payload
data – Pointer to data
- Returns:
true if it is deserialized correctly, false if not
- inline virtual RTPS_DllAPI std::function< uint32_t()> get_serialized_size_provider (void *data)
Returns a function which can be used to calculate the serialized size of the provided data.
- Parameters:
data – [in] Pointer to data.
- Returns:
Functor which calculates the serialized size of the data.
- inline virtual RTPS_DllAPI std::function< uint32_t()> get_serialized_size_provider (void *data, DataRepresentationId_t data_representation)
Returns a function which can be used to calculate the serialized size of the provided data.
- Parameters:
data – [in] Pointer to data.
data_representation – [in] Representation that should be used for calculating the serialized size.
- Returns:
Functor which calculates the serialized size of the data.
- inline virtual RTPS_DllAPI void * create_data ()
Creates new data.
- Returns:
Pointer to the data
- inline virtual RTPS_DllAPI void delete_data (void *data)
Deletes data.
- Parameters:
data – Pointer to the data to delete
- inline virtual RTPS_DllAPI bool get_key (void *data, InstanceHandle_t *i_handle, bool force_md5=false)
Getter for the data key.
- Parameters:
data – Pointer to data
i_handle – InstanceHandle pointer to store the key
force_md5 – boolean to force md5 (default: false)
- Returns:
true if the key is returned, false if not
- inline virtual RTPS_DllAPI bool operator== (const TypeSupport &type_support)
- inline RTPS_DllAPI bool empty () const
Check if the TypeSupport is empty.
- Returns:
true if empty, false if not
- inline virtual RTPS_DllAPI bool is_bounded () const
Checks if the type is bounded.
- inline virtual RTPS_DllAPI bool is_plain () const
Checks if the type is plain when using default encoding.
- inline virtual RTPS_DllAPI bool is_plain (DataRepresentationId_t data_representation) const
Checks if the type is plain when using a specific encoding.
- inline RTPS_DllAPI bool operator!= (std::nullptr_t) const
- inline RTPS_DllAPI bool operator== (std::nullptr_t) const
-
using ReturnCode_t = eprosima::fastrtps::types::ReturnCode_t