Fast DDS  Version 3.6.1.0
Fast DDS
DynamicPubSubType Class Reference

#include <DynamicPubSubType.hpp>

Inheritance diagram for DynamicPubSubType:
TopicDataType

Public Member Functions

FASTDDS_EXPORTED_API DynamicPubSubType ()=default
 
FASTDDS_EXPORTED_API DynamicPubSubType (traits< DynamicType >::ref_type type)
 Constructs a DynamicPubSubType from a DynamicType. More...
 
FASTDDS_EXPORTED_API DynamicPubSubType (traits< DynamicType >::ref_type type, const xtypes::TypeInformation &type_information)
 Constructs a DynamicPubSubType from a DynamicType and a xtypes::TypeInformation. More...
 
virtual FASTDDS_EXPORTED_API ~DynamicPubSubType ()
 
FASTDDS_EXPORTED_API void * create_data () override
 Create a new data object of the specified type. More...
 
FASTDDS_EXPORTED_API void delete_data (void *data) override
 Deletes an object previously allocated via create_data. More...
 
FASTDDS_EXPORTED_API bool deserialize (eprosima::fastdds::rtps::SerializedPayload_t &payload, void *data) override
 Deserialize an object from the given payload. More...
 
FASTDDS_EXPORTED_API traits< DynamicType >::ref_type get_dynamic_type () const noexcept
 Returns a copy of the internal DynamicType object. More...
 
FASTDDS_EXPORTED_API 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. More...
 
FASTDDS_EXPORTED_API 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. More...
 
FASTDDS_EXPORTED_API uint32_t calculate_serialized_size (const void *const data, DataRepresentationId_t data_representation) override
 Provide a functor that calculates a specified object serialized size. More...
 
FASTDDS_EXPORTED_API 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. More...
 
FASTDDS_EXPORTED_API ReturnCode_t set_dynamic_type (traits< DynamicType >::ref_type type)
 Sets up the internal DynamicType object. More...
 
FASTDDS_EXPORTED_API void register_type_object_representation () override
 Register TypeObject representation in Fast DDS TypeObjectRegistry. More...
 
- Public Member Functions inherited from TopicDataType
FASTDDS_EXPORTED_API TopicDataType ()=default
 Constructor. More...
 
virtual FASTDDS_EXPORTED_API ~TopicDataType ()=default
 Destructor. More...
 
virtual FASTDDS_EXPORTED_API bool serialize (const void *const data, rtps::SerializedPayload_t &payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation)=0
 Serialize method, it should be implemented by the user, since it is abstract. More...
 
virtual FASTDDS_EXPORTED_API bool serialize_ctx (const std::shared_ptr< Context > &context, const void *const data, rtps::SerializedPayload_t &payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation)
 Serialize method with context, it can be reimplemented by the user to perform custom serialization depending on the context received. More...
 
virtual FASTDDS_EXPORTED_API bool deserialize (rtps::SerializedPayload_t &payload, void *data)=0
 Deserialize method, it should be implemented by the user, since it is abstract. More...
 
virtual FASTDDS_EXPORTED_API bool deserialize_ctx (const std::shared_ptr< Context > &context, rtps::SerializedPayload_t &payload, void *data)
 Deserialize method with context, it can be reimplemented by the user to perform custom deserialization depending on the context received. More...
 
virtual FASTDDS_EXPORTED_API uint32_t calculate_serialized_size (const void *const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation)=0
 Calculates the serialized size of the provided data. More...
 
virtual FASTDDS_EXPORTED_API uint32_t calculate_serialized_size_ctx (const std::shared_ptr< Context > &context, const void *const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation)
 Calculates the serialized size of the provided data with context. More...
 
virtual FASTDDS_EXPORTED_API void * create_data ()=0
 Create a Data Type. More...
 
virtual FASTDDS_EXPORTED_API void * create_data_ctx (const std::shared_ptr< Context > &context)
 Create a Data Type with context. More...
 
virtual FASTDDS_EXPORTED_API void delete_data (void *data)=0
 Remove a previously created object. More...
 
virtual FASTDDS_EXPORTED_API void delete_data_ctx (const std::shared_ptr< Context > &context, void *data)
 Remove a previously created object with context. More...
 
virtual FASTDDS_EXPORTED_API bool compute_key (rtps::SerializedPayload_t &payload, rtps::InstanceHandle_t &ihandle, bool force_md5=false)=0
 Get the key associated with the data. More...
 
virtual FASTDDS_EXPORTED_API bool compute_key_ctx (const std::shared_ptr< Context > &context, rtps::SerializedPayload_t &payload, rtps::InstanceHandle_t &ihandle, bool force_md5=false)
 Get the key associated with the data with context. More...
 
virtual FASTDDS_EXPORTED_API bool compute_key (const void *const data, rtps::InstanceHandle_t &ihandle, bool force_md5=false)=0
 Get the key associated with the data. More...
 
virtual FASTDDS_EXPORTED_API bool compute_key_ctx (const std::shared_ptr< Context > &context, const void *const data, rtps::InstanceHandle_t &ihandle, bool force_md5=false)
 Get the key associated with the data with context. More...
 
FASTDDS_EXPORTED_API void set_name (const std::string &nam)
 Set topic data type name. More...
 
FASTDDS_EXPORTED_API void set_name (std::string &&nam)
 Set topic data type name. More...
 
FASTDDS_EXPORTED_API const std::string & get_name () const
 Get topic data type name. More...
 
FASTDDS_EXPORTED_API const xtypes::TypeIdentifierPairtype_identifiers () const
 Get the type identifiers. More...
 
virtual FASTDDS_EXPORTED_API bool is_bounded () const
 Checks if the type is bounded. More...
 
virtual FASTDDS_EXPORTED_API bool is_bounded_ctx (const std::shared_ptr< Context > &context) const
 Checks if the type is bounded with context. More...
 
virtual FASTDDS_EXPORTED_API bool is_plain (DataRepresentationId_t) const
 Checks if the type is plain when using a specific encoding. More...
 
virtual FASTDDS_EXPORTED_API bool is_plain_ctx (const std::shared_ptr< Context > &context, DataRepresentationId_t representation) const
 Checks if the type is plain when using a specific encoding and a context It can be reimplemented by the user to perform custom checks depending on the context received. More...
 
virtual FASTDDS_EXPORTED_API bool construct_sample (void *memory) const
 Construct a sample on a memory location. More...
 
virtual FASTDDS_EXPORTED_API bool construct_sample_ctx (const std::shared_ptr< Context > &context, void *memory) const
 Construct a sample on a memory location using a context. More...
 
virtual FASTDDS_EXPORTED_API void register_type_object_representation ()
 Register TypeObject type representation. More...
 
virtual FASTDDS_EXPORTED_API void register_type_object_representation_ctx (const std::shared_ptr< Context > &context)
 Register TypeObject type representation It can be reimplemented by the user to perform custom registration depending on the context received. More...
 
virtual FASTDDS_EXPORTED_API uint32_t get_max_serialized_size_ctx (const std::shared_ptr< Context > &context)
 Get the maximum serialized size of the type using a context It can be reimplemented by the user to perform custom calculations depending on the context received. More...
 

Additional Inherited Members

- Public Attributes inherited from TopicDataType
uint32_t max_serialized_type_size {0}
 Maximum serialized size of the type in bytes. More...
 
bool is_compute_key_provided {false}
 Indicates whether the method to obtain the key has been implemented. More...
 
- Protected Attributes inherited from TopicDataType
xtypes::TypeIdentifierPair type_identifiers_
 

Constructor & Destructor Documentation

◆ DynamicPubSubType() [1/3]

FASTDDS_EXPORTED_API DynamicPubSubType ( )
default

◆ DynamicPubSubType() [2/3]

FASTDDS_EXPORTED_API DynamicPubSubType ( traits< DynamicType >::ref_type  type)

Constructs a DynamicPubSubType from a DynamicType.

Parameters
typeDynamicType object associated to the data
Remarks
Ownership is not transferred.

◆ DynamicPubSubType() [3/3]

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

Parameters
typeDynamicType object associated to the data
type_informationxtypes::TypeInformation object associated to the data
Remarks
Ownership is not transferred.

◆ ~DynamicPubSubType()

virtual FASTDDS_EXPORTED_API ~DynamicPubSubType ( )
virtual

Member Function Documentation

◆ calculate_serialized_size()

FASTDDS_EXPORTED_API uint32_t calculate_serialized_size ( const void *const  data,
DataRepresentationId_t  data_representation 
)
overridevirtual

Provide a functor that calculates a specified object serialized size.

Parameters
[in]dataobject whose payload footprint to calculate
[in]data_representationRepresentation that should be used for calculating the serialized size.
Returns
functor that calculates the size

Implements TopicDataType.

◆ compute_key() [1/2]

FASTDDS_EXPORTED_API bool compute_key ( const void *const  data,
eprosima::fastdds::rtps::InstanceHandle_t ihandle,
bool  force_md5 = false 
)
overridevirtual

Calculate the key associated to a given object.

Parameters
dataobject which key is calculated
ihandlertps::InstanceHandle_t to fill in
force_md5use always md5 even if key payload footprint is smaller than the hash
Returns
bool specifying success

Implements TopicDataType.

◆ compute_key() [2/2]

FASTDDS_EXPORTED_API bool compute_key ( eprosima::fastdds::rtps::SerializedPayload_t payload,
eprosima::fastdds::rtps::InstanceHandle_t ihandle,
bool  force_md5 = false 
)
overridevirtual

Calculate the key associated to a given object.

Parameters
payloadrtps::SerializedPayload_t containing the serialized object which key is calculated
ihandlertps::InstanceHandle_t to fill in
force_md5use always md5 even if key payload footprint is smaller than the hash
Returns
bool specifying success

Implements TopicDataType.

◆ create_data()

FASTDDS_EXPORTED_API void * create_data ( )
overridevirtual

Create a new data object of the specified type.

Returns
pointer to the new object
Remarks
Ownership is transferred. This object must be removed using delete_data

Implements TopicDataType.

◆ delete_data()

FASTDDS_EXPORTED_API void delete_data ( void *  data)
overridevirtual

Deletes an object previously allocated via create_data.

Parameters
datapointer to the object to be deleted
Remarks
Ownership is transferred. This object must be allocated using create_data

Implements TopicDataType.

◆ deserialize()

FASTDDS_EXPORTED_API bool deserialize ( eprosima::fastdds::rtps::SerializedPayload_t payload,
void *  data 
)
overridevirtual

Deserialize an object from the given payload.

Parameters
payloadrtps::SerializedPayload_t to parse
dataobject to fill in with payload data
Returns
bool specifying success

Implements TopicDataType.

◆ get_dynamic_type()

FASTDDS_EXPORTED_API traits< DynamicType >::ref_type get_dynamic_type ( ) const
noexcept

Returns a copy of the internal DynamicType object.

Returns
pointer to the new object

◆ register_type_object_representation()

FASTDDS_EXPORTED_API void register_type_object_representation ( )
overridevirtual

Register TypeObject representation in Fast DDS TypeObjectRegistry.

Reimplemented from TopicDataType.

◆ serialize()

FASTDDS_EXPORTED_API bool serialize ( const void *const  data,
eprosima::fastdds::rtps::SerializedPayload_t payload,
fastdds::dds::DataRepresentationId_t  data_representation 
)
overridevirtual

Serialize an object into a given payload.

Parameters
[in]dataobject to serialize
[out]payloadrtps::SerializedPayload_t to fill in
[in]data_representationRepresentation that should be used to encode the data into the payload.
Returns
bool specifying success

Implements TopicDataType.

◆ set_dynamic_type()

FASTDDS_EXPORTED_API ReturnCode_t set_dynamic_type ( traits< DynamicType >::ref_type  type)

Sets up the internal DynamicType object.

Parameters
typeDynamicType to copy
Returns
ReturnCode_t with operation status
Remarks
Ownership is not transferred.

The documentation for this class was generated from the following file: