.. _program_listing_file_include_rmw_fastrtps_dynamic_cpp_MessageTypeSupport_impl.hpp: Program Listing for File MessageTypeSupport_impl.hpp ==================================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/rmw_fastrtps_dynamic_cpp/MessageTypeSupport_impl.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2016-2018 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 RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_IMPL_HPP_ #define RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_IMPL_HPP_ #include #include #include #include #include "fastcdr/FastBuffer.h" #include "fastcdr/Cdr.h" #include "rcpputils/find_and_replace.hpp" #include "rmw_fastrtps_dynamic_cpp/MessageTypeSupport.hpp" #include "rosidl_typesupport_introspection_cpp/field_types.hpp" namespace rmw_fastrtps_dynamic_cpp { template MessageTypeSupport::MessageTypeSupport( const MembersType * members, const void * ros_type_support) : TypeSupport(ros_type_support) { assert(members); this->members_ = members; std::ostringstream ss; std::string message_namespace(this->members_->message_namespace_); std::string message_name(this->members_->message_name_); if (!message_namespace.empty()) { // Find and replace C namespace separator with C++, in case this is using C typesupport message_namespace = rcpputils::find_and_replace(message_namespace, "__", "::"); ss << message_namespace << "::"; } ss << "dds_::" << message_name << "_"; this->setName(ss.str().c_str()); // Fully bound and plain by default this->max_size_bound_ = true; this->is_plain_ = true; // Encapsulation size this->m_typeSize = 4; if (this->members_->member_count_ != 0) { this->m_typeSize += static_cast(this->calculateMaxSerializedSize(members, 0)); } else { this->m_typeSize++; } // Account for RTPS submessage alignment this->m_typeSize = (this->m_typeSize + 3) & ~3; } } // namespace rmw_fastrtps_dynamic_cpp #endif // RMW_FASTRTPS_DYNAMIC_CPP__MESSAGETYPESUPPORT_IMPL_HPP_