Fast DDS  Version 3.1.2
Fast DDS
Loading...
Searching...
No Matches
TypeSupport Class Reference

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

#include <TypeSupport.hpp>

Inheritance diagram for TypeSupport:

Public Types

using Base = std::shared_ptr<TopicDataType>
 

Public Member Functions

FASTDDS_EXPORTED_API TypeSupport () noexcept=default
 Constructor.
 
FASTDDS_EXPORTED_API TypeSupport (const TypeSupport &type) noexcept=default
 Copy Constructor.
 
FASTDDS_EXPORTED_API TypeSupport (TypeSupport &&type) noexcept=default
 Move Constructor.
 
FASTDDS_EXPORTED_API TypeSupportoperator= (const TypeSupport &type) noexcept=default
 Copy Assignment.
 
FASTDDS_EXPORTED_API TypeSupportoperator= (TypeSupport &&type) noexcept=default
 Move Assignment.
 
FASTDDS_EXPORTED_API TypeSupport (TopicDataType *ptr)
 TypeSupport constructor that receives a TopicDataType pointer.
 
virtual FASTDDS_EXPORTED_API ReturnCode_t register_type (DomainParticipant *participant) const
 Registers the type on a participant.
 
virtual FASTDDS_EXPORTED_API ReturnCode_t register_type (DomainParticipant *participant, std::string type_name) const
 Registers the type on a participant.
 
virtual FASTDDS_EXPORTED_API const std::string & get_type_name () const
 Getter for the type name.
 
virtual FASTDDS_EXPORTED_API bool serialize (const void *const data, fastdds::rtps::SerializedPayload_t &payload, DataRepresentationId_t data_representation)
 Serializes the data.
 
virtual FASTDDS_EXPORTED_API bool deserialize (fastdds::rtps::SerializedPayload_t &payload, void *data)
 Deserializes the data.
 
virtual FASTDDS_EXPORTED_API uint32_t calculate_serialized_size (const void *const data, DataRepresentationId_t data_representation)
 Returns a function which can be used to calculate the serialized size of the provided data.
 
virtual FASTDDS_EXPORTED_API void * create_data ()
 Creates new data.
 
virtual FASTDDS_EXPORTED_API void delete_data (void *data)
 Deletes data.
 
virtual FASTDDS_EXPORTED_API bool compute_key (const void *const data, InstanceHandle_t &i_handle, bool force_md5=false)
 Getter for the data key.
 
virtual FASTDDS_EXPORTED_API bool compute_key (fastdds::rtps::SerializedPayload_t &payload, InstanceHandle_t &i_handle, bool force_md5=false)
 Getter for the data key.
 
virtual FASTDDS_EXPORTED_API bool operator== (const TypeSupport &type_support)
 
FASTDDS_EXPORTED_API bool empty () const
 Check if the TypeSupport is empty.
 
virtual FASTDDS_EXPORTED_API bool is_bounded () const
 Checks if the type is bounded.
 
virtual FASTDDS_EXPORTED_API bool is_plain (DataRepresentationId_t data_representation) const
 Checks if the type is plain when using a specific encoding.
 
FASTDDS_EXPORTED_API bool operator!= (std::nullptr_t) const
 
FASTDDS_EXPORTED_API bool operator== (std::nullptr_t) const
 

Detailed Description

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

Member Typedef Documentation

◆ Base

using Base = std::shared_ptr<TopicDataType>

Constructor & Destructor Documentation

◆ TypeSupport() [1/4]

FASTDDS_EXPORTED_API TypeSupport ( )
defaultnoexcept

Constructor.

◆ TypeSupport() [2/4]

FASTDDS_EXPORTED_API TypeSupport ( const TypeSupport & type)
defaultnoexcept

Copy Constructor.

Parameters
typeAnother instance of TypeSupport

◆ TypeSupport() [3/4]

FASTDDS_EXPORTED_API TypeSupport ( TypeSupport && type)
defaultnoexcept

Move Constructor.

Parameters
typeAnother instance of TypeSupport

◆ TypeSupport() [4/4]

FASTDDS_EXPORTED_API TypeSupport ( TopicDataType * ptr)
inlineexplicit

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

Member Function Documentation

◆ calculate_serialized_size()

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

Returns a function which can be used to calculate the serialized size of the provided data.

Parameters
[in]dataPointer to data.
[in]data_representationRepresentation that should be used for calculating the serialized size.
Returns
Functor which calculates the serialized size of the data.

◆ compute_key() [1/2]

virtual FASTDDS_EXPORTED_API bool compute_key ( const void *const data,
InstanceHandle_t & i_handle,
bool force_md5 = false )
inlinevirtual

Getter for the data key.

Parameters
dataPointer to serialized payload containing the data.
i_handleInstanceHandle pointer to store the key
force_md5boolean to force md5 (default: false)
Returns
true if the key is returned, false if not

◆ compute_key() [2/2]

virtual FASTDDS_EXPORTED_API bool compute_key ( fastdds::rtps::SerializedPayload_t & payload,
InstanceHandle_t & i_handle,
bool force_md5 = false )
inlinevirtual

Getter for the data key.

Parameters
payloadPointer to data
i_handleInstanceHandle pointer to store the key
force_md5boolean to force md5 (default: false)
Returns
true if the key is returned, false if not

◆ create_data()

virtual FASTDDS_EXPORTED_API void * create_data ( )
inlinevirtual

Creates new data.

Returns
Pointer to the data

◆ delete_data()

virtual FASTDDS_EXPORTED_API void delete_data ( void * data)
inlinevirtual

Deletes data.

Parameters
dataPointer to the data to delete

◆ deserialize()

virtual FASTDDS_EXPORTED_API bool deserialize ( fastdds::rtps::SerializedPayload_t & payload,
void * data )
virtual

Deserializes the data.

Parameters
payloadPointer to payload
dataPointer to data
Returns
true if it is deserialized correctly, false if not

◆ empty()

FASTDDS_EXPORTED_API bool empty ( ) const
inline

Check if the TypeSupport is empty.

Returns
true if empty, false if not

◆ get_type_name()

virtual FASTDDS_EXPORTED_API const std::string & get_type_name ( ) const
inlinevirtual

Getter for the type name.

Returns
name of the data type

◆ is_bounded()

virtual FASTDDS_EXPORTED_API bool is_bounded ( ) const
inlinevirtual

Checks if the type is bounded.

◆ is_plain()

virtual FASTDDS_EXPORTED_API bool is_plain ( DataRepresentationId_t data_representation) const
inlinevirtual

Checks if the type is plain when using a specific encoding.

◆ operator!=()

FASTDDS_EXPORTED_API bool operator!= ( std::nullptr_t ) const
inline

◆ operator=() [1/2]

FASTDDS_EXPORTED_API TypeSupport & operator= ( const TypeSupport & type)
defaultnoexcept

Copy Assignment.

Parameters
typeAnother instance of TypeSupport

◆ operator=() [2/2]

FASTDDS_EXPORTED_API TypeSupport & operator= ( TypeSupport && type)
defaultnoexcept

Move Assignment.

Parameters
typeAnother instance of TypeSupport

◆ operator==() [1/2]

virtual FASTDDS_EXPORTED_API bool operator== ( const TypeSupport & type_support)
inlinevirtual

◆ operator==() [2/2]

FASTDDS_EXPORTED_API bool operator== ( std::nullptr_t ) const
inline

◆ register_type() [1/2]

virtual FASTDDS_EXPORTED_API ReturnCode_t register_type ( DomainParticipant * participant) const
virtual

Registers the type on a participant.

Parameters
participantDomainParticipant 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

◆ register_type() [2/2]

virtual FASTDDS_EXPORTED_API ReturnCode_t register_type ( DomainParticipant * participant,
std::string type_name ) const
virtual

Registers the type on a participant.

Parameters
participantDomainParticipant where the type is going to be registered
type_nameName 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

◆ serialize()

virtual FASTDDS_EXPORTED_API bool serialize ( const void *const data,
fastdds::rtps::SerializedPayload_t & payload,
DataRepresentationId_t data_representation )
virtual

Serializes the data.

Parameters
dataPointer to data
payloadPointer to payload
[in]data_representationRepresentation that should be used to encode the data into the payload.
Returns
true if it is serialized correctly, false if not

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