.. _program_listing_file__tmp_ws_src_fastrtps_include_fastdds_dds_topic_TypeSupport.hpp: Program Listing for File TypeSupport.hpp ======================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/fastrtps/include/fastdds/dds/topic/TypeSupport.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_TYPE_SUPPORT_HPP_ #define _FASTDDS_TYPE_SUPPORT_HPP_ #include #include #include #include #include #include #include namespace eprosima { namespace fastdds { namespace dds { class DomainParticipant; class TypeSupport : public std::shared_ptr { public: using ReturnCode_t = eprosima::fastrtps::types::ReturnCode_t; using Base = std::shared_ptr; RTPS_DllAPI TypeSupport() noexcept = default; RTPS_DllAPI TypeSupport( const TypeSupport& type) noexcept = default; RTPS_DllAPI TypeSupport( TypeSupport&& type) noexcept = default; RTPS_DllAPI TypeSupport& operator = ( const TypeSupport& type) noexcept = default; RTPS_DllAPI TypeSupport& operator = ( TypeSupport&& type) noexcept = default; RTPS_DllAPI explicit TypeSupport( fastdds::dds::TopicDataType* ptr) : std::shared_ptr(ptr) { } RTPS_DllAPI TypeSupport( fastrtps::types::DynamicPubSubType ptr) : std::shared_ptr(std::make_shared(std::move( ptr))) { } RTPS_DllAPI virtual ReturnCode_t register_type( DomainParticipant* participant) const; RTPS_DllAPI virtual ReturnCode_t register_type( DomainParticipant* participant, std::string type_name) const; RTPS_DllAPI virtual const std::string& get_type_name() const { return get()->m_topicDataTypeName; } RTPS_DllAPI virtual bool serialize( void* data, fastrtps::rtps::SerializedPayload_t* payload); RTPS_DllAPI virtual bool deserialize( fastrtps::rtps::SerializedPayload_t* payload, void* data); RTPS_DllAPI virtual std::function get_serialized_size_provider( void* data) { return get()->getSerializedSizeProvider(data); } RTPS_DllAPI virtual void* create_data() { return get()->createData(); } RTPS_DllAPI virtual void delete_data( void* data) { return get()->deleteData(data); } RTPS_DllAPI virtual bool get_key( void* data, InstanceHandle_t* i_handle, bool force_md5 = false) { return get()->getKey(data, i_handle, force_md5); } RTPS_DllAPI virtual bool operator ==( const TypeSupport& type_support) { return get()->m_typeSize == type_support->m_typeSize && get()->m_isGetKeyDefined == type_support->m_isGetKeyDefined && get()->m_topicDataTypeName == type_support->m_topicDataTypeName && get()->type_identifier() == type_support->type_identifier() && get()->type_information() == type_support->type_information() && get()->type_object() == type_support->type_object(); } RTPS_DllAPI bool empty() const { return get() == nullptr; } RTPS_DllAPI virtual inline bool is_bounded() const { return get()->is_bounded(); } RTPS_DllAPI virtual inline bool is_plain() const { return get()->is_plain(); } RTPS_DllAPI bool operator !=( std::nullptr_t) const { return bool(*this); } RTPS_DllAPI bool operator ==( std::nullptr_t) const { return !*this; } }; } /* namespace dds */ } /* namespace fastdds */ } /* namespace eprosima */ #endif /* _FASTDDS_TYPE_SUPPORT_HPP_ */