.. _program_listing_file__tmp_ws_src_fastrtps_include_fastdds_dds_topic_TopicDataType.hpp: Program Listing for File TopicDataType.hpp ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/fastrtps/include/fastdds/dds/topic/TopicDataType.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef _FASTDDS_TOPICDATATYPE_HPP_ #define _FASTDDS_TOPICDATATYPE_HPP_ #include #include #include #include #include #include #include #include // This version of TypeSupport has `is_bounded()` #define TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED // This version of TypeSupport has `is_plain()` #define TOPIC_DATA_TYPE_API_HAS_IS_PLAIN // This version of TypeSupport has `construct_sample()` #define TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE namespace eprosima { namespace fastrtps { namespace rtps { struct SerializedPayload_t; struct InstanceHandle_t; } // namespace rtps } // namespace fastrtps namespace fastdds { namespace dds { class TypeSupport; class TopicDataType { public: RTPS_DllAPI TopicDataType() : m_typeSize(0) , m_isGetKeyDefined(false) , auto_fill_type_object_(true) , auto_fill_type_information_(true) { } RTPS_DllAPI virtual ~TopicDataType() { } RTPS_DllAPI virtual bool serialize( void* data, fastrtps::rtps::SerializedPayload_t* payload) = 0; RTPS_DllAPI virtual bool deserialize( fastrtps::rtps::SerializedPayload_t* payload, void* data) = 0; RTPS_DllAPI virtual std::function getSerializedSizeProvider( void* data) = 0; RTPS_DllAPI virtual void* createData() = 0; RTPS_DllAPI virtual void deleteData( void* data) = 0; RTPS_DllAPI virtual bool getKey( void* data, fastrtps::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) = 0; RTPS_DllAPI inline void setName( const char* nam) { m_topicDataTypeName = std::string(nam); } RTPS_DllAPI inline const char* getName() const { return m_topicDataTypeName.c_str(); } RTPS_DllAPI inline bool auto_fill_type_object() const { return auto_fill_type_object_; } RTPS_DllAPI inline void auto_fill_type_object( bool auto_fill_type_object) { auto_fill_type_object_ = auto_fill_type_object; } RTPS_DllAPI inline bool auto_fill_type_information() const { return auto_fill_type_information_; } RTPS_DllAPI inline void auto_fill_type_information( bool auto_fill_type_information) { auto_fill_type_information_ = auto_fill_type_information; } RTPS_DllAPI inline const std::shared_ptr type_identifier() const { return type_identifier_; } RTPS_DllAPI inline void type_identifier( const TypeIdV1& id) { type_identifier_ = std::make_shared(id); } RTPS_DllAPI inline void type_identifier( const std::shared_ptr id) { type_identifier_ = std::move(id); } RTPS_DllAPI inline const std::shared_ptr type_object() const { return type_object_; } RTPS_DllAPI inline void type_object( const TypeObjectV1& object) { type_object_ = std::make_shared(object); } RTPS_DllAPI inline void type_object( std::shared_ptr object) { type_object_ = std::move(object); } RTPS_DllAPI inline const std::shared_ptr type_information() const { return type_information_; } RTPS_DllAPI inline void type_information( const xtypes::TypeInformation& info) { type_information_ = std::make_shared(info); } RTPS_DllAPI inline void type_information( std::shared_ptr info) { type_information_ = std::move(info); } RTPS_DllAPI virtual inline bool is_bounded() const { return false; } RTPS_DllAPI virtual inline bool is_plain() const { return false; } RTPS_DllAPI virtual inline bool construct_sample( void* memory) const { static_cast(memory); return false; } uint32_t m_typeSize; bool m_isGetKeyDefined; protected: std::shared_ptr type_identifier_; std::shared_ptr type_object_; std::shared_ptr type_information_; private: std::string m_topicDataTypeName; bool auto_fill_type_object_; bool auto_fill_type_information_; friend class fastdds::dds::TypeSupport; }; } /* namespace dds */ } /* namespace fastdds */ } /* namespace eprosima */ #endif /* _FASTDDS_TOPICDATATYPE_HPP_ */