19.1.6.1.4. DynamicPubSubType
-
class DynamicPubSubType : public virtual eprosima::fastdds::dds::TopicDataType
Public Functions
-
DynamicPubSubType(traits<DynamicType>::ref_type type)
Constructs a DynamicPubSubType from a DynamicType.
Remark
Ownership is not transferred.
- Parameters:
type – DynamicType object associated to the data
-
DynamicPubSubType(traits<DynamicType>::ref_type type, const xtypes::TypeInformation &type_information)
Constructs a DynamicPubSubType from a DynamicType and a xtypes::TypeInformation.
This constructor is only meant to be used when the registration of the corresponding TypeSupport in the participant is meant to avoid registering the xtypes::TypeObject in the xtypes::TypeObjectRegistry; that is, when the xtypes::TypeObject registration has already been performed. This is for instance the case when the DynamicType is created from a xtypes::TypeObject obtained from a remote xtypes::TypeInformation that only has the minimal type identifiers but not the complete ones.
Remark
Ownership is not transferred.
- Parameters:
type – DynamicType object associated to the data
type_information – xtypes::TypeInformation object associated to the data
-
virtual void *create_data() override
Create a new data object of the specified type.
Remark
Ownership is transferred. This object must be removed using delete_data
- Returns:
pointer to the new object
-
virtual void delete_data(void *data) override
Deletes an object previously allocated via create_data.
Remark
Ownership is transferred. This object must be allocated using create_data
- Parameters:
data – pointer to the object to be deleted
-
virtual bool deserialize(eprosima::fastdds::rtps::SerializedPayload_t &payload, void *data) override
Deserialize an object from the given payload.
- Parameters:
payload – rtps::SerializedPayload_t to parse
data – object to fill in with payload data
- Returns:
bool specifying success
-
traits<DynamicType>::ref_type get_dynamic_type() const noexcept
Returns a copy of the internal DynamicType object.
- Returns:
pointer to the new object
-
virtual bool compute_key(eprosima::fastdds::rtps::SerializedPayload_t &payload, eprosima::fastdds::rtps::InstanceHandle_t &ihandle, bool force_md5 = false) override
Calculate the key associated to a given object.
- Parameters:
payload – rtps::SerializedPayload_t containing the serialized object which key is calculated
ihandle – rtps::InstanceHandle_t to fill in
force_md5 – use always md5 even if key payload footprint is smaller than the hash
- Returns:
bool specifying success
-
virtual bool compute_key(const void *const data, eprosima::fastdds::rtps::InstanceHandle_t &ihandle, bool force_md5 = false) override
Calculate the key associated to a given object.
- Parameters:
data – object which key is calculated
ihandle – rtps::InstanceHandle_t to fill in
force_md5 – use always md5 even if key payload footprint is smaller than the hash
- Returns:
bool specifying success
-
virtual uint32_t calculate_serialized_size(const void *const data, DataRepresentationId_t data_representation) override
Provide a functor that calculates a specified object serialized size.
- Parameters:
data – [in] object whose payload footprint to calculate
data_representation – [in] Representation that should be used for calculating the serialized size.
- Returns:
functor that calculates the size
-
virtual bool serialize(const void *const data, eprosima::fastdds::rtps::SerializedPayload_t &payload, fastdds::dds::DataRepresentationId_t data_representation) override
Serialize an object into a given payload.
- Parameters:
data – [in] object to serialize
payload – [out] rtps::SerializedPayload_t to fill in
data_representation – [in] Representation that should be used to encode the data into the payload.
- Returns:
bool specifying success
-
ReturnCode_t set_dynamic_type(traits<DynamicType>::ref_type type)
Sets up the internal DynamicType object.
Remark
Ownership is not transferred.
- Parameters:
type – DynamicType to copy
- Returns:
ReturnCode_t with operation status
-
virtual void register_type_object_representation() override
Register TypeObject representation in Fast DDS TypeObjectRegistry.
-
DynamicPubSubType(traits<DynamicType>::ref_type type)