Skip to content

Commit

Permalink
Fix type_name between c and c++ type support
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González <[email protected]>
  • Loading branch information
richiware authored and MiguelCompany committed Oct 4, 2024
1 parent ca7aeab commit 81ad0af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion rmw_fastrtps_cpp/src/type_support_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <sstream>
#include <string>

#include "rcpputils/find_and_replace.hpp"

#include "rmw/error_handling.h"

#include "rmw_fastrtps_shared_cpp/TypeSupport.hpp"
Expand Down Expand Up @@ -46,7 +48,9 @@ _create_type_name(
{
std::ostringstream ss;
if (!message_namespace.empty()) {
ss << message_namespace << "::";
// Find and replace C namespace separator with C++, in case this is using C typesupport
std::string message_namespace_new = rcpputils::find_and_replace(message_namespace, "__", "::");
ss << message_namespace_new << "::";
}
ss << "dds_::" << message_name << "_";
return ss.str();
Expand Down
8 changes: 6 additions & 2 deletions rmw_fastrtps_shared_cpp/src/TypeSupport_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#include "fastdds/dds/xtypes/dynamic_types/DynamicData.hpp"
#include "fastdds/dds/xtypes/dynamic_types/DynamicPubSubType.hpp"
#include "fastdds/dds/xtypes/type_representation/ITypeObjectRegistry.hpp"
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>
#include <fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp>
#include "fastdds/dds/xtypes/type_representation/TypeObject.hpp"
#include "fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp"

#include "rcpputils/find_and_replace.hpp"

#include "rmw_fastrtps_shared_cpp/TypeSupport.hpp"
#include "rmw/error_handling.h"
Expand Down Expand Up @@ -246,6 +248,8 @@ _create_type_name(const MembersType * members)
std::string message_namespace(members->message_namespace_);
std::string message_name(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 << "_";
Expand Down

0 comments on commit 81ad0af

Please sign in to comment.