19#ifndef FASTDDS_DDS_TOPIC__TOPICDATATYPE_HPP
20#define FASTDDS_DDS_TOPIC__TOPICDATATYPE_HPP
26#include <fastdds/dds/core/policy/QosPolicies.hpp>
27#include <fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp>
28#include <fastdds/fastdds_dll.hpp>
29#include <fastdds/rtps/common/CdrSerialization.hpp>
30#include <fastdds/rtps/common/InstanceHandle.hpp>
31#include <fastdds/rtps/common/SerializedPayload.hpp>
32#include <fastdds/utils/md5.hpp>
35#define TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
38#define TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
41#define TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
96 const void*
const data,
113 const std::shared_ptr<Context>& context,
114 const void*
const data,
118 static_cast<void>(context);
119 return serialize(data, payload, data_representation);
144 const std::shared_ptr<Context>& context,
148 static_cast<void>(context);
160 const void*
const data,
174 const std::shared_ptr<Context>& context,
175 const void*
const data,
178 static_cast<void>(context);
198 const std::shared_ptr<Context>& context)
200 static_cast<void>(context);
221 const std::shared_ptr<Context>& context,
224 static_cast<void>(context);
239 bool force_md5 =
false) = 0;
253 const std::shared_ptr<Context>& context,
256 bool force_md5 =
false)
258 static_cast<void>(context);
271 const void*
const data,
273 bool force_md5 =
false) = 0;
287 const std::shared_ptr<Context>& context,
288 const void*
const data,
290 bool force_md5 =
false)
292 static_cast<void>(context);
302 const std::string& nam)
304 topic_data_typename_ = nam;
315 topic_data_typename_ = std::move(nam);
323 FASTDDS_EXPORTED_API
inline const std::string&
get_name()
const
325 return topic_data_typename_;
354 const std::shared_ptr<Context>& context)
const
356 static_cast<void>(context);
378 const std::shared_ptr<Context>& context,
381 static_cast<void>(context);
395 static_cast<void>(memory);
410 const std::shared_ptr<Context>& context,
413 static_cast<void>(context);
432 const std::shared_ptr<Context>& context)
434 static_cast<void>(context);
447 const std::shared_ptr<Context>& context)
449 static_cast<void>(context);
467 std::string topic_data_typename_;
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.
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 t...
Definition TopicDataType.hpp:377
virtual FASTDDS_EXPORTED_API bool construct_sample(void *memory) const
Construct a sample on a memory location.
Definition TopicDataType.hpp:392
FASTDDS_EXPORTED_API const xtypes::TypeIdentifierPair & type_identifiers() const
Get the type identifiers.
Definition TopicDataType.hpp:333
FASTDDS_EXPORTED_API void set_name(std::string &&nam)
Set topic data type name.
Definition TopicDataType.hpp:312
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 deserializatio...
Definition TopicDataType.hpp:143
virtual FASTDDS_EXPORTED_API void register_type_object_representation()
Register TypeObject type representation.
Definition TopicDataType.hpp:420
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.
Definition TopicDataType.hpp:252
virtual FASTDDS_EXPORTED_API bool is_bounded_ctx(const std::shared_ptr< Context > &context) const
Checks if the type is bounded with context.
Definition TopicDataType.hpp:353
virtual FASTDDS_EXPORTED_API void delete_data(void *data)=0
Remove a previously created object.
virtual FASTDDS_EXPORTED_API ~TopicDataType()=default
Destructor.
FASTDDS_EXPORTED_API const std::string & get_name() const
Get topic data type name.
Definition TopicDataType.hpp:323
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.
Definition TopicDataType.hpp:409
virtual FASTDDS_EXPORTED_API void delete_data_ctx(const std::shared_ptr< Context > &context, void *data)
Remove a previously created object with context.
Definition TopicDataType.hpp:220
bool is_compute_key_provided
Indicates whether the method to obtain the key has been implemented.
Definition TopicDataType.hpp:458
virtual FASTDDS_EXPORTED_API void * create_data_ctx(const std::shared_ptr< Context > &context)
Create a Data Type with context.
Definition TopicDataType.hpp:197
uint32_t max_serialized_type_size
Maximum serialized size of the type in bytes.
Definition TopicDataType.hpp:455
FASTDDS_EXPORTED_API TopicDataType()=default
Constructor.
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 registr...
Definition TopicDataType.hpp:431
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.
Definition TopicDataType.hpp:173
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 pe...
Definition TopicDataType.hpp:446
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.
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.
Definition TopicDataType.hpp:286
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 de...
Definition TopicDataType.hpp:112
xtypes::TypeIdentifierPair type_identifiers_
Definition TopicDataType.hpp:462
virtual FASTDDS_EXPORTED_API bool is_plain(DataRepresentationId_t) const
Checks if the type is plain when using a specific encoding.
Definition TopicDataType.hpp:363
virtual FASTDDS_EXPORTED_API void * create_data()=0
Create a Data Type.
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.
virtual FASTDDS_EXPORTED_API bool is_bounded() const
Checks if the type is bounded.
Definition TopicDataType.hpp:341
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.
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.
FASTDDS_EXPORTED_API void set_name(const std::string &nam)
Set topic data type name.
Definition TopicDataType.hpp:301
Class TypeSupport used to provide the DomainRTPSParticipant with the methods to serialize,...
Definition TypeSupport.hpp:47
This class represents the structure TypeIdentifierPair defined by the user in the IDL file.
Definition dds_xtypes_typeobject.hpp:24033
Definition BuiltinTopicKey.hpp:26
enum eprosima::fastdds::dds::DataRepresentationId DataRepresentationId_t
Enum DataRepresentationId, different kinds of topic data representation.
Contains the RTPS protocol implementation.
An interface to provide the user with a context when serializing and deserializing data.
Definition TopicDataType.hpp:71
virtual ~Context()=default
Struct InstanceHandle_t, used to contain the key for WITH_KEY topics.
Definition InstanceHandle.hpp:154
Structure SerializedPayload_t.
Definition SerializedPayload.hpp:59