From 2b866d6d7e27c344aba519cf97a66be38f206df0 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Thu, 28 Apr 2022 07:45:01 +0200 Subject: [PATCH] Deprecate CPP typesupport Signed-off-by: Pablo Garrido --- .../CMakeLists.txt | 118 ---- ...microxrcedds_cpp_generate_interfaces.cmake | 244 --------- .../identifier.h | 20 - .../identifier.hpp | 29 - .../message_type_support_decl.hpp | 33 -- .../service_type_support_decl.hpp | 33 -- .../visibility_control.h | 56 -- .../main/rosidl_typesupport_microxrcedds_cpp | 47 -- .../package.xml | 33 -- ...rosidl_typesupport_microxrcedds_cpp.hpp.em | 95 ---- .../resource/idl__type_support_cpp.cpp.em | 95 ---- ...rosidl_typesupport_microxrcedds_cpp.hpp.em | 102 ---- .../resource/msg__type_support_cpp.cpp.em | 504 ------------------ ..._microxrcedds_cpp__visibility_control.h.in | 43 -- ...rosidl_typesupport_microxrcedds_cpp.hpp.em | 49 -- .../resource/srv__type_support_cpp.cpp.em | 97 ---- ...pesupport_microxrcedds_cpp-extras.cmake.in | 30 -- .../__init__.py | 24 - .../src/identifier.cpp | 24 - test/cpp/CMakeLists.txt | 62 --- test/cpp/package.xml | 25 - test/cpp/src/test_typesupport.cpp | 310 ----------- 22 files changed, 2073 deletions(-) delete mode 100644 rosidl_typesupport_microxrcedds_cpp/CMakeLists.txt delete mode 100644 rosidl_typesupport_microxrcedds_cpp/cmake/rosidl_typesupport_microxrcedds_cpp_generate_interfaces.cmake delete mode 100644 rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.h delete mode 100644 rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.hpp delete mode 100644 rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/message_type_support_decl.hpp delete mode 100644 rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/service_type_support_decl.hpp delete mode 100644 rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/visibility_control.h delete mode 100644 rosidl_typesupport_microxrcedds_cpp/main/rosidl_typesupport_microxrcedds_cpp delete mode 100644 rosidl_typesupport_microxrcedds_cpp/package.xml delete mode 100644 rosidl_typesupport_microxrcedds_cpp/resource/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em delete mode 100644 rosidl_typesupport_microxrcedds_cpp/resource/idl__type_support_cpp.cpp.em delete mode 100644 rosidl_typesupport_microxrcedds_cpp/resource/msg__rosidl_typesupport_microxrcedds_cpp.hpp.em delete mode 100644 rosidl_typesupport_microxrcedds_cpp/resource/msg__type_support_cpp.cpp.em delete mode 100644 rosidl_typesupport_microxrcedds_cpp/resource/rosidl_typesupport_microxrcedds_cpp__visibility_control.h.in delete mode 100644 rosidl_typesupport_microxrcedds_cpp/resource/srv__rosidl_typesupport_microxrcedds_cpp.hpp.em delete mode 100644 rosidl_typesupport_microxrcedds_cpp/resource/srv__type_support_cpp.cpp.em delete mode 100644 rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp-extras.cmake.in delete mode 100644 rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp/__init__.py delete mode 100644 rosidl_typesupport_microxrcedds_cpp/src/identifier.cpp delete mode 100644 test/cpp/CMakeLists.txt delete mode 100644 test/cpp/package.xml delete mode 100644 test/cpp/src/test_typesupport.cpp diff --git a/rosidl_typesupport_microxrcedds_cpp/CMakeLists.txt b/rosidl_typesupport_microxrcedds_cpp/CMakeLists.txt deleted file mode 100644 index 88607b3..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/CMakeLists.txt +++ /dev/null @@ -1,118 +0,0 @@ -# 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. - -cmake_minimum_required(VERSION 3.5) - -project(rosidl_typesupport_microxrcedds_cpp LANGUAGES CXX) - -find_package(ament_cmake_python REQUIRED) -find_package(rosidl_runtime_c REQUIRED) -find_package(rosidl_typesupport_microxrcedds_c REQUIRED) - -ament_export_dependencies(rmw) -ament_export_dependencies(rosidl_cmake) -ament_export_dependencies(rosidl_runtime_cpp) -ament_export_dependencies(rosidl_typesupport_microxrcedds_c) - -ament_export_include_directories(include) - -ament_python_install_package(${PROJECT_NAME}) - -add_library(${PROJECT_NAME} - src/identifier.cpp - ) - -target_compile_definitions(${PROJECT_NAME} - PRIVATE - $<$:"ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_BUILDING_DLL"> - ) - -target_include_directories(${PROJECT_NAME} - PUBLIC - $ - $ - ) - -ament_target_dependencies(${PROJECT_NAME} - "rosidl_typesupport_microxrcedds_c" - "rosidl_runtime_c" - ) -ament_export_libraries(${PROJECT_NAME}) -ament_export_targets(${PROJECT_NAME}) - -ament_index_register_resource("rosidl_typesupport_cpp") - -target_compile_options(${PROJECT_NAME} - PRIVATE - $<$:-Wall> - $<$:-Wextra> - $<$:-Wpedantic> - ) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD - 14 - CXX_STANDARD_REQUIRED - YES - ) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() -endif() - -if(BUILD_SHARED_LIBS) - set(${PROJECT_NAME}_LIBRARY_TYPE "SHARED") -else() - set(${PROJECT_NAME}_LIBRARY_TYPE "STATIC") -endif() - -ament_package( - CONFIG_EXTRAS "rosidl_typesupport_microxrcedds_cpp-extras.cmake.in" - ) - -install( - PROGRAMS - main/rosidl_typesupport_microxrcedds_cpp - DESTINATION - lib/rosidl_typesupport_microxrcedds_cpp - ) - -install( - DIRECTORY - cmake - resource - DESTINATION - share/${PROJECT_NAME} - ) - -install( - DIRECTORY - include/ - DESTINATION - include - ) - -install( - TARGETS - ${PROJECT_NAME} - EXPORT - ${PROJECT_NAME} - ARCHIVE DESTINATION - lib - LIBRARY DESTINATION - lib - RUNTIME DESTINATION - bin - ) diff --git a/rosidl_typesupport_microxrcedds_cpp/cmake/rosidl_typesupport_microxrcedds_cpp_generate_interfaces.cmake b/rosidl_typesupport_microxrcedds_cpp/cmake/rosidl_typesupport_microxrcedds_cpp_generate_interfaces.cmake deleted file mode 100644 index f81a7b0..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/cmake/rosidl_typesupport_microxrcedds_cpp_generate_interfaces.cmake +++ /dev/null @@ -1,244 +0,0 @@ -# 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. - -find_package(ament_cmake_ros REQUIRED) -find_package(microcdr REQUIRED) -find_package(rmw REQUIRED) - -set(_output_path "${CMAKE_CURRENT_BINARY_DIR}/rosidl_typesupport_microxrcedds_cpp/${PROJECT_NAME}") - -set(_generated_files "") -foreach(_abs_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES}) - get_filename_component(_parent_folder "${_abs_idl_file}" DIRECTORY) - get_filename_component(_parent_folder "${_parent_folder}" NAME) - get_filename_component(_idl_name "${_abs_idl_file}" NAME_WE) - string_camel_case_to_lower_case_underscore("${_idl_name}" _header_name) - list(APPEND _generated_files - "${_output_path}/${_parent_folder}/detail/microxrcedds/${_header_name}__type_support_cpp.cpp" - "${_output_path}/${_parent_folder}/detail/${_header_name}__rosidl_typesupport_microxrcedds_cpp.hpp" - ) -endforeach() - -set(_dependency_files "") -set(_dependencies "") -foreach(_pck_name ${rosidl_generated_interfaces_DEPENDENCY_PACKAGE_NAMES}) - foreach(_idl_file ${${_pkg_name}_IDL_FILES}) - set(_abs_idl_file "${${_pkg_name}_DIR}/../${_idl_file}") - normalize_path(_abs_idl_file "${_abs_idl_file}") - list(APPEND _dependency_files "${_abs_idl_file}") - list(APPEND _dependencies "${_pkg_name}:${_abs_idl_file}") - endforeach() -endforeach() - -# Check if all templates exits -set(target_dependencies - "${rosidl_typesupport_microxrcedds_cpp_BIN}" - ${rosidl_typesupport_microxrcedds_cpp_GENERATOR_FILES} - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em" - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}/idl__type_support_cpp.cpp.em" - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}/msg__rosidl_typesupport_microxrcedds_cpp.hpp.em" - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}/msg__type_support_cpp.cpp.em" - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}/srv__rosidl_typesupport_microxrcedds_cpp.hpp.em" - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}/srv__type_support_cpp.cpp.em" - ${rosidl_generate_interfaces_ABS_IDL_FILES} - ${_dependency_files}) -foreach(dep ${target_dependencies}) - if(NOT EXISTS "${dep}") - message(FATAL_ERROR "Target dependency '${dep}' does not exist") - endif() -endforeach() - - -# Generate script argument file -set(generator_arguments_file "${CMAKE_CURRENT_BINARY_DIR}/rosidl_typesupport_microxrcedds_cpp__arguments.json") -rosidl_write_generator_arguments( - "${generator_arguments_file}" - PACKAGE_NAME "${PROJECT_NAME}" - IDL_TUPLES "${rosidl_generate_interfaces_IDL_TUPLES}" - ROS_INTERFACE_DEPENDENCIES "${_dependencies}" - OUTPUT_DIR "${_output_path}" - TEMPLATE_DIR "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}" - TARGET_DEPENDENCIES ${target_dependencies} - ) - -# Execute python script -add_custom_command( - OUTPUT - ${_generated_files} - COMMAND - ${PYTHON_EXECUTABLE} ${rosidl_typesupport_microxrcedds_cpp_BIN} - --generator-arguments-file "${generator_arguments_file}" - DEPENDS - ${target_dependencies} ${_dds_idl_files} - COMMENT - "Generating C++ type support for eProsima Micro XRCE-DDS" - VERBATIM - ) - -# Generate header to switch between export and import for a specific package -set(_visibility_control_file -"${_output_path}/msg/rosidl_typesupport_microxrcedds_cpp__visibility_control.h") -string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER) -configure_file( - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}/rosidl_typesupport_microxrcedds_cpp__visibility_control.h.in" - "${_visibility_control_file}" - @ONLY - ) - -set(_target_suffix "__rosidl_typesupport_microxrcedds_cpp") - -# Generate Micro XRCE-DDS typesupport shared library -add_library(${rosidl_generate_interfaces_TARGET}${_target_suffix} - ${rosidl_typesupport_microxrcedds_c_LIBRARY_TYPE} - ${_generated_files} - ) - -# Change output library name if asked to -if(rosidl_generate_interfaces_LIBRARY_NAME) - set_target_properties(${rosidl_generate_interfaces_TARGET}${_target_suffix} PROPERTIES - OUTPUT_NAME - "${rosidl_generate_interfaces_LIBRARY_NAME}${_target_suffix}" - ) -endif() - -# Set C++ standard -set_target_properties(${rosidl_generate_interfaces_TARGET}${_target_suffix} PROPERTIES - CXX_STANDARD - 14 - CXX_STANDARD_REQUIRED - YES - POSITION_INDEPENDENT_CODE - YES - ) - -# Set flag for visibility macro -target_compile_definitions(${rosidl_generate_interfaces_TARGET}${_target_suffix} - PRIVATE - $<$:"ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_BUILDING_DLL_${PROJECT_NAME}"> - ) - -# Set compiler flags -target_compile_options(${rosidl_generate_interfaces_TARGET}${_target_suffix} - PRIVATE - $<$:-Wall> - $<$:-Wextra> - $<$:-Wpedantic> - $<$:/W4> - ) - -# Include headers from other generators -target_include_directories(${rosidl_generate_interfaces_TARGET}${_target_suffix} - PUBLIC - ${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp - ${CMAKE_CURRENT_BINARY_DIR}/rosidl_typesupport_microxrcedds_cpp - ) - -ament_target_dependencies(${rosidl_generate_interfaces_TARGET}${_target_suffix} - "microcdr" - "rmw" - "rosidl_runtime_cpp" - "rosidl_typesupport_microxrcedds_cpp" - "rosidl_typesupport_interface" - ) - -foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES}) - ament_target_dependencies(${rosidl_generate_interfaces_TARGET}${_target_suffix} - ${_pkg_name} - ) - target_link_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix} - ${${_pkg_name}_LIBRARIES${_target_suffix}} - ) -endforeach() - -target_link_libraries( - ${rosidl_generate_interfaces_TARGET}${_target_suffix} - ${rosidl_generate_interfaces_TARGET}__rosidl_generator_cpp - microcdr - ) - -# Make top level generation target depend on this library -add_dependencies( - ${rosidl_generate_interfaces_TARGET} - ${rosidl_generate_interfaces_TARGET}${_target_suffix} - ) - -# Make this library depend on target created by rosidl_generator_cpp -add_dependencies( - ${rosidl_generate_interfaces_TARGET}${_target_suffix} - ${rosidl_generate_interfaces_TARGET}__cpp - ) - -if(NOT rosidl_generate_interfaces_SKIP_INSTALL) - install( - DIRECTORY - "${_output_path}/" - DESTINATION - "include/${PROJECT_NAME}" - PATTERN - "*.c" EXCLUDE - ) - - if(NOT _generated_files STREQUAL "") - ament_export_include_directories(include) - endif() - - install( - TARGETS - ${rosidl_generate_interfaces_TARGET}${_target_suffix} - ARCHIVE DESTINATION - lib - LIBRARY DESTINATION - lib - RUNTIME DESTINATION - bin - ) - - rosidl_export_typesupport_libraries(${_target_suffix} - ${rosidl_generate_interfaces_TARGET}${_target_suffix} - ) -endif() - - -# test -if(BUILD_TESTING AND rosidl_generate_interfaces_ADD_LINTER_TESTS) - if(NOT _generated_files STREQUAL "") - find_package(ament_cmake_cppcheck REQUIRED) - ament_cppcheck( - TESTNAME - "cppcheck_rosidl_typesupport_microxrcedds_cpp" - ${_generated_files} - ) - - find_package(ament_cmake_cpplint REQUIRED) - get_filename_component(_cpplint_root "${_output_path}" DIRECTORY) - ament_cpplint( - TESTNAME - "cpplint_rosidl_typesupport_microxrcedds_cpp" - MAX_LINE_LENGTH - 999 - ROOT - "${_cpplint_root}" - ${_output_path} - ) - - find_package(ament_cmake_uncrustify REQUIRED) - ament_uncrustify( - TESTNAME - "uncrustify_rosidl_typesupport_microxrcedds_cpp" - MAX_LINE_LENGTH - 0 - ${_output_path} - ) - endif() -endif() diff --git a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.h b/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.h deleted file mode 100644 index 140e4f3..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.h +++ /dev/null @@ -1,20 +0,0 @@ -// 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 ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_H_ -#define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_H_ - -#define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE "rosidl_typesupport_microxrcedds_cpp" - -#endif // ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_H_ diff --git a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.hpp b/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.hpp deleted file mode 100644 index bb9e074..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/identifier.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_HPP_ -#define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_HPP_ - -#include -#include - -namespace rosidl_typesupport_microxrcedds_cpp -{ - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT -extern const char * typesupport_identifier; - -} // namespace rosidl_typesupport_microxrcedds_cpp - -#endif // ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_HPP_ diff --git a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/message_type_support_decl.hpp b/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/message_type_support_decl.hpp deleted file mode 100644 index 7a87b43..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/message_type_support_decl.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// 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 ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_ -#define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_ - -// Provides the definition of the rosidl_message_type_support_t struct. -#include -// Provides visibility macros like ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC. -#include - -namespace rosidl_typesupport_microxrcedds_cpp -{ - -// This is implemented in the shared library provided by this package. -template -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC -const rosidl_message_type_support_t * get_message_type_support_handle(); - -} // namespace rosidl_typesupport_microxrcedds_cpp - -#endif // ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__MESSAGE_TYPE_SUPPORT_DECL_HPP_ diff --git a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/service_type_support_decl.hpp b/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/service_type_support_decl.hpp deleted file mode 100644 index 5f021fe..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/service_type_support_decl.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 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 ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_ -#define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_ - -// Provides the definition of the rosidl_service_type_support_t struct. -#include -// Provides visibility macros like ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC. -#include - -namespace rosidl_typesupport_microxrcedds_cpp -{ - -// This is implemented in the shared library provided by this package. -template -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC -const rosidl_service_type_support_t * get_service_type_support_handle(); - -} // namespace rosidl_typesupport_microxrcedds_cpp - -#endif // ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__SERVICE_TYPE_SUPPORT_DECL_HPP_ diff --git a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/visibility_control.h b/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/visibility_control.h deleted file mode 100644 index 331bfed..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/include/rosidl_typesupport_microxrcedds_cpp/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// 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 ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__VISIBILITY_CONTROL_H_ -#define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__VISIBILITY_CONTROL_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ - #ifdef __GNUC__ - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT __attribute__ ((dllexport)) - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT __attribute__ ((dllimport)) - #else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT __declspec(dllexport) - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT __declspec(dllimport) - #endif - #ifdef ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_BUILDING_DLL - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT - #else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT - #endif - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_LOCAL -#else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT __attribute__ ((visibility("default"))) - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT - #if __GNUC__ >= 4 - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC __attribute__ ((visibility("default"))) - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_LOCAL __attribute__ ((visibility("hidden"))) - #else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_LOCAL - #endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif // ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__VISIBILITY_CONTROL_H_ diff --git a/rosidl_typesupport_microxrcedds_cpp/main/rosidl_typesupport_microxrcedds_cpp b/rosidl_typesupport_microxrcedds_cpp/main/rosidl_typesupport_microxrcedds_cpp deleted file mode 100644 index 7b76b4f..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/main/rosidl_typesupport_microxrcedds_cpp +++ /dev/null @@ -1,47 +0,0 @@ -# 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. - -#!/usr/bin/env python3 - -import argparse -import os -import sys - - -from rosidl_typesupport_microxrcedds_cpp import generate_typesupport_microxrcedds_cpp - -def is_valid_file(parser, file_name): - if not os.path.exists(file_name): - parser.error("File does not exist: '{0}'".format(file_name)) - file_name_abs = os.path.abspath(file_name) - if not os.path.isfile(file_name_abs): - parser.error("Path exists but is not a file: '{0}'".format(file_name_abs)) - return file_name - - -def main(argv=sys.argv[1:]): - parser = argparse.ArgumentParser( - description='Generate the C++ interfaces for Micro XRCE-DDS.', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument( - '--generator-arguments-file', - required=True, - help='The location of the file containing the generator arguments') - args = parser.parse_args(argv) - - return generate_typesupport_microxrcedds_cpp(args.generator_arguments_file) - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/rosidl_typesupport_microxrcedds_cpp/package.xml b/rosidl_typesupport_microxrcedds_cpp/package.xml deleted file mode 100644 index fc7eb22..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/package.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - rosidl_typesupport_microxrcedds_cpp - 0.0.1 - Generate the C++ interfaces for eProsima Micro XRCE-DDS. - Borja Outerelo - Apache License 2.0 - - ament_cmake_ros - rosidl_typesupport_microxrcedds_c - rosidl_cmake - rosidl_runtime_cpp - - ament_cmake_ros - rosidl_typesupport_microxrcedds_c - rosidl_cmake - rosidl_runtime_cpp - - rmw - - rosidl_parser - rosidl_typesupport_interface - - ament_lint_auto - ament_lint_common - - rosidl_typesupport_cpp_packages - - - ament_cmake - - diff --git a/rosidl_typesupport_microxrcedds_cpp/resource/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em b/rosidl_typesupport_microxrcedds_cpp/resource/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em deleted file mode 100644 index 674e068..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/resource/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em +++ /dev/null @@ -1,95 +0,0 @@ -// generated from rosidl_typesupport_microxrcedds_cpp/resource/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em -// with input from @(package_name):@(interface_path) -// generated code does not contain a copyright notice -@ -@####################################################################### -@# EmPy template for generating __rosidl_typesupport_microxrcedds_cpp.hpp files -@# -@# Context: -@# - package_name (string) -@# - interface_path (Path relative to the directory named after the package) -@# - content (IdlContent, list of elements, e.g. Messages or Services) -@####################################################################### -@ -@{ -from rosidl_cmake import convert_camel_case_to_lower_case_underscore -include_parts = [package_name] + list(interface_path.parents[0].parts) + \ - [convert_camel_case_to_lower_case_underscore(interface_path.stem)] -header_guard_variable = '__'.join([x.upper() for x in include_parts]) + \ - '__ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_HPP_' - -include_directives = set() -}@ - -#ifndef @(header_guard_variable) -#define @(header_guard_variable) - -@{ -####################################################################### -# Handle message -####################################################################### -from rosidl_parser.definition import Message -for message in content.get_elements_of_type(Message): - TEMPLATE( - 'msg__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - message=message, - include_directives=include_directives) - -####################################################################### -# Handle service -####################################################################### -from rosidl_parser.definition import Service -for service in content.get_elements_of_type(Service): - TEMPLATE( - 'srv__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - service=service, - include_directives=include_directives) - -####################################################################### -# Handle action -####################################################################### -from rosidl_parser.definition import Action -for action in content.get_elements_of_type(Action): - TEMPLATE( - 'msg__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.goal, - include_directives=include_directives) - TEMPLATE( - 'msg__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.result, - include_directives=include_directives) - TEMPLATE( - 'msg__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.feedback, - include_directives=include_directives) - TEMPLATE( - 'srv__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - service=action.send_goal_service, - include_directives=include_directives) - TEMPLATE( - 'srv__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - service=action.get_result_service, - include_directives=include_directives) - TEMPLATE( - 'msg__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.feedback_message, - include_directives=include_directives) -}@ - -#endif // @(header_guard_variable) diff --git a/rosidl_typesupport_microxrcedds_cpp/resource/idl__type_support_cpp.cpp.em b/rosidl_typesupport_microxrcedds_cpp/resource/idl__type_support_cpp.cpp.em deleted file mode 100644 index e3500f9..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/resource/idl__type_support_cpp.cpp.em +++ /dev/null @@ -1,95 +0,0 @@ -// generated from rosidl_typesupport_microxrcedds_cpp/resource/idl__type_support.cpp.em -// with input from @(package_name):@(interface_path) -// generated code does not contain a copyright notice -@ -@####################################################################### -@# EmPy template for generating __type_support.cpp files -@# -@# Context: -@# - package_name (string) -@# - interface_path (Path relative to the directory named after the package) -@# - content (IdlContent, list of elements, e.g. Messages or Services) -@####################################################################### -@ -@{ -from rosidl_cmake import convert_camel_case_to_lower_case_underscore -include_parts = [package_name] + list(interface_path.parents[0].parts) + [ - 'detail', convert_camel_case_to_lower_case_underscore(interface_path.stem)] -include_base = '/'.join(include_parts) - -include_detail_parts = [package_name] + list(interface_path.parents[0].parts) + [ - 'detail', convert_camel_case_to_lower_case_underscore(interface_path.stem)] -include_detail_base = '/'.join(include_detail_parts) -}@ -#include "@(include_base)__rosidl_typesupport_microxrcedds_cpp.hpp" -#include "@(include_detail_base)__struct.hpp" - -@{ -include_directives = set() - -####################################################################### -# Handle message -####################################################################### -from rosidl_parser.definition import Message -for message in content.get_elements_of_type(Message): - TEMPLATE( - 'msg__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - message=message, - include_directives=include_directives) - -####################################################################### -# Handle service -####################################################################### -from rosidl_parser.definition import Service -for service in content.get_elements_of_type(Service): - TEMPLATE( - 'srv__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - service=service, - include_directives=include_directives) - -####################################################################### -# Handle action -####################################################################### -from rosidl_parser.definition import Action -for action in content.get_elements_of_type(Action): - TEMPLATE( - 'msg__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.goal, - include_directives=include_directives) - TEMPLATE( - 'msg__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.result, - include_directives=include_directives) - TEMPLATE( - 'msg__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.feedback, - include_directives=include_directives) - TEMPLATE( - 'srv__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - service=action.send_goal_service, - include_directives=include_directives) - TEMPLATE( - 'srv__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - service=action.get_result_service, - include_directives=include_directives) - TEMPLATE( - 'msg__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - message=action.feedback_message, - include_directives=include_directives) -}@ diff --git a/rosidl_typesupport_microxrcedds_cpp/resource/msg__rosidl_typesupport_microxrcedds_cpp.hpp.em b/rosidl_typesupport_microxrcedds_cpp/resource/msg__rosidl_typesupport_microxrcedds_cpp.hpp.em deleted file mode 100644 index 7f24dbb..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/resource/msg__rosidl_typesupport_microxrcedds_cpp.hpp.em +++ /dev/null @@ -1,102 +0,0 @@ -@# Included from rosidl_typesupport_microxrcedds_cpp/resource/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em -@{ -from rosidl_cmake import convert_camel_case_to_lower_case_underscore - -include_parts = [package_name] + list(interface_path.parents[0].parts) + [ - 'detail', convert_camel_case_to_lower_case_underscore(interface_path.stem)] -include_base = '/'.join(include_parts) - -header_files = [ - 'rosidl_runtime_c/message_type_support_struct.h', - 'rosidl_typesupport_interface/macros.h', - package_name + '/msg/rosidl_typesupport_microxrcedds_cpp__visibility_control.h', - include_base + '__struct.hpp', -] -}@ -@[for header_file in header_files]@ -@[ if header_file in include_directives]@ -// already included above -// @ -@[ else]@ -@{include_directives.add(header_file)}@ -@[ end if]@ -#include "@(header_file)" -@[end for]@ - -#ifndef _WIN32 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-parameter" -# ifdef __clang__ -# pragma clang diagnostic ignored "-Wdeprecated-register" -# pragma clang diagnostic ignored "-Wreturn-type-c-linkage" -# endif -#endif -#ifndef _WIN32 -# pragma GCC diagnostic pop -#endif - -@{ -header_files = [ - 'ucdr/microcdr.h', -] -}@ -@[for header_file in header_files]@ -@[ if header_file in include_directives]@ -// already included above -// @ -@[ else]@ -@{include_directives.add(header_file)}@ -@[ end if]@ -#include "@(header_file)" -@[end for]@ -@[for ns in message.structure.namespaced_type.namespaces]@ - -namespace @(ns) -{ -@[end for]@ - -namespace typesupport_microxrcedds_cpp -{ - -bool -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -cdr_serialize( - const @('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])) & ros_message, - ucdrBuffer * cdr); - -bool -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -cdr_deserialize( - ucdrBuffer * cdr, - @('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])) & ros_message); - -size_t -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -get_serialized_size( - const @('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])) & ros_message, - size_t current_alignment); - -size_t -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -max_serialized_size_@(message.structure.namespaced_type.name)( - bool * full_bounded, - size_t current_alignment); - -} // namespace typesupport_microxrcedds_cpp -@[ for ns in reversed(message.structure.namespaced_type.namespaces)]@ - -} // namespace @(ns) -@[ end for]@ - -#ifdef __cplusplus -extern "C" -{ -#endif - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -const rosidl_message_type_support_t * - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])))(); - -#ifdef __cplusplus -} -#endif diff --git a/rosidl_typesupport_microxrcedds_cpp/resource/msg__type_support_cpp.cpp.em b/rosidl_typesupport_microxrcedds_cpp/resource/msg__type_support_cpp.cpp.em deleted file mode 100644 index 9e50981..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/resource/msg__type_support_cpp.cpp.em +++ /dev/null @@ -1,504 +0,0 @@ -@# Included from rosidl_typesupport_microxrcedds_cpp/resource/idl__type_support.cpp.em -@{ -from rosidl_parser.definition import AbstractGenericString -from rosidl_parser.definition import AbstractNestedType -from rosidl_parser.definition import AbstractSequence -from rosidl_parser.definition import AbstractString -from rosidl_parser.definition import BoundedString -from rosidl_parser.definition import AbstractWString -from rosidl_parser.definition import Array -from rosidl_parser.definition import BasicType -from rosidl_parser.definition import BoundedSequence -from rosidl_parser.definition import UnboundedSequence -from rosidl_parser.definition import NamespacedType - -header_files = [ - 'limits', - 'algorithm', - 'stdexcept', - 'string', - 'cstring', - 'rosidl_typesupport_cpp/message_type_support.hpp', - 'rosidl_typesupport_microxrcedds_cpp/identifier.hpp', - 'rosidl_typesupport_microxrcedds_c/message_type_support.h', - 'rosidl_typesupport_microxrcedds_cpp/message_type_support_decl.hpp', - 'ucdr/microcdr.h', -] - -def get_suffix(typename): - if typename == 'boolean': - return 'bool' - elif typename == 'int8': - return 'int8_t' - elif typename in ('uint8', 'octet'): - return 'uint8_t' - elif typename == 'uint16': - return 'uint16_t' - elif typename == 'int16': - return 'int16_t' - elif typename == 'uint32': - return 'uint32_t' - elif typename == 'int32': - return 'int32_t' - elif typename == 'uint64': - return 'uint64_t' - elif typename == 'int64': - return 'int64_t' - else: - return typename - -}@ -@[for header_file in header_files]@ -@[ if header_file in include_directives]@ -// already included above -// @ -@[ else]@ -@{include_directives.add(header_file)}@ -@[ end if]@ -@[ if '/' not in header_file]@ -#include <@(header_file)> -@[ else]@ -#include "@(header_file)" -@[ end if]@ -@[end for]@ - -#define MICROXRCEDDS_PADDING sizeof(uint32_t) - -// forward declaration of message dependencies and their conversion functions -@[for member in message.structure.members]@ -@{ -type_ = member.type -if isinstance(type_, AbstractNestedType): - type_ = type_.value_type -}@ -@[ if isinstance(type_, NamespacedType)]@ -@[ for ns in type_.namespaces]@ -namespace @(ns) -{ -@[ end for]@ -namespace typesupport_microxrcedds_cpp -{ -bool cdr_serialize( - const @('::'.join(type_.namespaced_name())) &, - ucdrBuffer *); - -bool cdr_deserialize( - ucdrBuffer *, - @('::'.join(type_.namespaced_name())) &); - -size_t get_serialized_size( - const @('::'.join(type_.namespaced_name())) &, - size_t current_alignment); - -size_t -max_serialized_size_@(type_.name)( - bool * full_bounded, - size_t current_alignment); -} // namespace typesupport_microxrcedds_cpp -@[ for ns in reversed(type_.namespaces)]@ -} // namespace @(ns) -@[ end for]@ - -@[ end if]@ -@[end for]@ -@ -@[ for ns in message.structure.namespaced_type.namespaces]@ - -namespace @(ns) -{ -@[ end for]@ - -namespace typesupport_microxrcedds_cpp -{ - -bool -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -cdr_serialize( - const @('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])) & ros_message, - ucdrBuffer * cdr) -{ - (void) ros_message; - (void) cdr; - bool rv = false; - -@[for member in message.structure.members]@ - // Member: @(member.name) -@[ if isinstance(member.type, AbstractNestedType)]@ - { -@[ if isinstance(member.type, Array)]@ -@[ if isinstance(member.type.value_type, BasicType)]@ - size_t size = ros_message.@(member.name).size(); - rv = ucdr_serialize_array_@(get_suffix(member.type.value_type.typename))(cdr, ros_message.@(member.name).data(), size); -@[ else]@ - // Micro CDR only support arrays of basic types. -@[ end if]@ -@[ elif isinstance(member.type, AbstractSequence)]@ -@[ if isinstance(member.type.value_type, BasicType)]@ - size_t size = ros_message.@(member.name).size(); -@[ if member.type.value_type.typename == 'boolean']@ -@[ if isinstance(member.type, BoundedSequence)]@ - bool temp[@(member.type.maximum_size)] = {0}; - std::copy(ros_message.@(member.name).begin(), ros_message.@(member.name).end(), std::begin(temp)); - rv = ucdr_serialize_sequence_bool(cdr, temp, size); -@[ else]@ - bool * temp = new bool[size]; - std::copy(ros_message.@(member.name).begin(), ros_message.@(member.name).end(), temp); - rv = ucdr_serialize_sequence_bool(cdr, temp, size); - delete[] temp; -@[ end if]@ -@[ else]@ - rv = ucdr_serialize_sequence_@(get_suffix(member.type.value_type.typename))(cdr, &ros_message.@(member.name)[0], size); -@[ end if]@ -@[ elif isinstance(member.type.value_type, AbstractString)]@ - size_t size = ros_message.@(member.name).size(); - rv = ucdr_serialize_uint32_t(cdr, size); - for (size_t i = 0; rv && i < size; ++i) { - rv = ucdr_serialize_string(cdr, ros_message.@(member.name)[i].c_str()); - } -@[ elif isinstance(member.type.value_type, NamespacedType)]@ - size_t size = ros_message.@(member.name).size(); - rv = ucdr_serialize_uint32_t(cdr, size); - - size_t i = 0; - while (i < size && rv) { - rv = @('::'.join(member.type.value_type.namespaces))::typesupport_microxrcedds_cpp::cdr_serialize( - ros_message.@(member.name)[i], - cdr); - i++; - } -@[ end if]@ -@[ end if]@ - } -@[ elif isinstance(member.type, BasicType)]@ - rv = ucdr_serialize_@(get_suffix(member.type.typename))(cdr, ros_message.@(member.name)); -@[ elif isinstance(member.type, AbstractString)]@ - rv = ucdr_serialize_string(cdr, ros_message.@(member.name).c_str()); -@[ elif isinstance(member.type, AbstractWString)]@ - // Micro CDR does not support WString type. -@[ elif isinstance(member.type, NamespacedType)]@ - rv = @('::'.join(member.type.namespaces))::typesupport_microxrcedds_cpp::cdr_serialize( - ros_message.@(member.name), - cdr); -@[ else]@ - // Micro CDR does not support this type. -@[ end if]@ -@[end for]@ - - return rv; -} - -bool -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -cdr_deserialize( - ucdrBuffer * cdr, - @('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])) & ros_message) -{ - (void) cdr; - (void) ros_message; - bool rv = false; - -@[for member in message.structure.members]@ - // Member: @(member.name) -@[ if isinstance(member.type, AbstractNestedType)]@ - { -@[ if isinstance(member.type, Array)]@ -@[ if isinstance(member.type.value_type, BasicType)]@ - const size_t size = ros_message.@(member.name).size(); - rv = ucdr_deserialize_array_@(get_suffix(member.type.value_type.typename))(cdr, ros_message.@(member.name).data(), size); -@[ else]@ - // Micro CDR only support arrays of basic types. -@[ end if]@ -@[ elif isinstance(member.type, AbstractSequence)]@ -@[ if isinstance(member.type.value_type, BasicType)]@ - uint32_t size; - const size_t capacity = ros_message.@(member.name).capacity(); - ros_message.@(member.name).resize(capacity); -@[ if member.type.value_type.typename == 'boolean']@ -@[ if isinstance(member.type, BoundedSequence)]@ - bool temp[@(member.type.maximum_size)] = {0}; - rv = ucdr_deserialize_sequence_bool(cdr, temp, @(member.type.maximum_size), &size); - if (rv) { - std::copy(std::begin(temp), std::begin(temp) + size, ros_message.@(member.name).begin()); - } -@[ else]@ - bool * temp = new bool[capacity]; - rv = ucdr_deserialize_sequence_bool(cdr, temp, capacity, &size); - if (rv) { - std::copy(temp, temp + size, ros_message.@(member.name).begin()); - } - delete[] temp; -@[ end if]@ -@[ else]@ - rv = ucdr_deserialize_sequence_@(get_suffix(member.type.value_type.typename))(cdr, &ros_message.@(member.name)[0], capacity, &size); -@[ end if]@ - if (rv) { - ros_message.@(member.name).resize(size); - } -@[ elif isinstance(member.type.value_type, AbstractString)]@ - uint32_t size; - rv = ucdr_deserialize_uint32_t(cdr, &size); - - if (size > ros_message.@(member.name).capacity()) { - ros_message.@(member.name).resize(size); - } else { - ros_message.@(member.name).resize(ros_message.@(member.name).capacity()); - } - - for (size_t i = 0; rv && i < size; i++) { - uint32_t capacity = ros_message.@(member.name)[i].capacity(); - char * temp = static_cast(malloc(capacity * sizeof(char))); - rv = ucdr_deserialize_string(cdr, temp, capacity); - if (rv) { - std::string stemp(temp); - stemp.shrink_to_fit(); - ros_message.@(member.name)[i] = std::move(stemp); - } - free(temp); - } -@[ elif isinstance(member.type.value_type, NamespacedType)]@ - uint32_t size; - rv = ucdr_deserialize_uint32_t(cdr, &size); - ros_message.@(member.name).resize(size); - - size_t i = 0; - while (i < size && rv) { - rv = @('::'.join(member.type.value_type.namespaces))::typesupport_microxrcedds_cpp::cdr_deserialize( - cdr, - ros_message.@(member.name)[i]); - i++; - } -@[ end if]@ -@[ end if]@ - } -@[ elif isinstance(member.type, BasicType)]@ - rv = ucdr_deserialize_@(get_suffix(member.type.typename))(cdr, &ros_message.@(member.name)); -@[ elif isinstance(member.type, AbstractString)]@ - ros_message.@(member.name).resize(ros_message.@(member.name).capacity()); - rv = ucdr_deserialize_string(cdr, &ros_message.@(member.name)[0], ros_message.@(member.name).capacity()); - if (rv) { - ros_message.@(member.name).resize(std::strlen(&ros_message.@(member.name)[0])); - } -@[ elif isinstance(member.type, AbstractWString)]@ - // Micro CDR does not support WString type. -@[ elif isinstance(member.type, NamespacedType)]@ - rv = @('::'.join(member.type.namespaces))::typesupport_microxrcedds_cpp::cdr_deserialize( - cdr, - ros_message.@(member.name)); -@[ else]@ - // Micro CDR does not support this type. -@[ end if]@ -@[end for]@ - - return rv; -} - -size_t -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -get_serialized_size( - const @('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])) & ros_message, - size_t current_alignment) -{ - (void) current_alignment; - (void) ros_message; - - const size_t initial_alignment = current_alignment; - -@[for member in message.structure.members]@ - // Member: @(member.name) -@[ if isinstance(member.type, AbstractNestedType)]@ - { -@[ if isinstance(member.type, Array)]@ -@[ if isinstance(member.type.value_type, BasicType)]@ - const size_t array_size = @(member.type.size); - const size_t item_size = sizeof(ros_message.@(member.name)[0]); - current_alignment += ucdr_alignment(current_alignment, item_size) + (array_size * item_size); -@[ end if]@ -@[ elif isinstance(member.type, AbstractSequence)]@ - // Member is abstractsequence -@[ if isinstance(member.type.value_type, BasicType)]@ - size_t sequence_size = ros_message.@(member.name).size(); - size_t item_size = sizeof(ros_message.@(member.name)[0]); - current_alignment += ucdr_alignment(current_alignment, MICROXRCEDDS_PADDING) + MICROXRCEDDS_PADDING; - current_alignment += ucdr_alignment(current_alignment, item_size) + (sequence_size * item_size); -@[ elif isinstance(member.type.value_type, NamespacedType)]@ - const size_t sequence_size = ros_message.@(member.name).size(); - current_alignment += ucdr_alignment(current_alignment, MICROXRCEDDS_PADDING) + MICROXRCEDDS_PADDING; - - for (size_t i = 0; i < sequence_size; i++) { - const size_t item_size = @('::'.join(member.type.value_type.namespaces))::typesupport_microxrcedds_cpp::get_serialized_size( - ros_message.@(member.name)[i], - current_alignment); - current_alignment += ucdr_alignment(current_alignment, item_size) + item_size; - } -@[ elif isinstance(member.type.value_type, AbstractString)]@ - const size_t sequence_size = ros_message.@(member.name).size(); - current_alignment += ucdr_alignment(current_alignment, MICROXRCEDDS_PADDING) + MICROXRCEDDS_PADDING; - - for (size_t i = 0; i < sequence_size; i++) { - const size_t item_size = ros_message.@(member.name)[i].size() + 1; - current_alignment += ucdr_alignment(current_alignment, item_size) + item_size; - } -@[ end if]@ -@[ end if]@ - } -@[ elif isinstance(member.type, BasicType)]@ - { - const size_t item_size = sizeof(ros_message.@(member.name)); - current_alignment += ucdr_alignment(current_alignment, item_size) + item_size; - } -@[ elif isinstance(member.type, AbstractString)]@ - current_alignment += ucdr_alignment(current_alignment, MICROXRCEDDS_PADDING) + MICROXRCEDDS_PADDING; - current_alignment += ros_message.@(member.name).size() + 1; -@[ elif isinstance(member.type, NamespacedType)]@ - current_alignment += @('::'.join(member.type.namespaces))::typesupport_microxrcedds_cpp::get_serialized_size( - ros_message.@(member.name), - current_alignment); -@[ end if]@ -@[end for]@ - - return current_alignment - initial_alignment; -} - -size_t -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -max_serialized_size_@(message.structure.namespaced_type.name)( - bool * full_bounded, - size_t current_alignment) -{ - (void) current_alignment; - *full_bounded = true; - - const size_t initial_alignment = current_alignment; - -@[for member in message.structure.members]@ - // Member: @(member.name) -@[ if isinstance(member.type, AbstractNestedType)]@ - { -@[ if isinstance(member.type, Array)]@ -@[ if isinstance(member.type.value_type, BasicType)]@ - const size_t array_size = @(member.type.size); - current_alignment += ucdr_alignment(current_alignment, sizeof(@(get_suffix(member.type.value_type.typename)))) + (array_size * sizeof(@(get_suffix(member.type.value_type.typename)))); -@[ else]@ - *full_bounded = false; -@[ end if]@ -@[ elif isinstance(member.type, BoundedSequence)]@ -@[ if isinstance(member.type.value_type, BasicType)]@ - const size_t max_sequence_size = @(member.type.maximum_size); - current_alignment += ucdr_alignment(current_alignment, MICROXRCEDDS_PADDING) + MICROXRCEDDS_PADDING; - current_alignment += ucdr_alignment(current_alignment, sizeof(@(get_suffix(member.type.value_type.typename)))) + (max_sequence_size * sizeof(@(get_suffix(member.type.value_type.typename)))); -@[ else]@ - *full_bounded = false; -@[ end if]@ -@[ elif isinstance(member.type, UnboundedSequence)]@ - *full_bounded = false; -@[ end if]@ - } -@[ elif isinstance(member.type, BasicType)]@ - current_alignment += ucdr_alignment(current_alignment, sizeof(@(get_suffix(member.type.typename)))) + sizeof(@(get_suffix(member.type.typename))); -@[ elif isinstance(member.type, BoundedString)]@ - current_alignment += ucdr_alignment(current_alignment, MICROXRCEDDS_PADDING); - current_alignment += @(member.type.maximum_size) + 1; -@[ elif isinstance(member.type, NamespacedType)]@ - current_alignment += @('::'.join(member.type.namespaces))::typesupport_microxrcedds_cpp::max_serialized_size_@(member.type.name)( - full_bounded, - current_alignment); -@[ else]@ - *full_bounded = false; -@[ end if]@ -@[end for]@ - - return current_alignment - initial_alignment; -} - -static bool _@(message.structure.namespaced_type.name)__cdr_serialize( - const void * untyped_ros_message, - ucdrBuffer * cdr) -{ - auto typed_message = - static_cast( - untyped_ros_message); - return cdr_serialize(*typed_message, cdr); -} - -static bool _@(message.structure.namespaced_type.name)__cdr_deserialize( - ucdrBuffer * cdr, - void * untyped_ros_message) -{ - auto typed_message = - static_cast<@('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])) *>( - untyped_ros_message); - return cdr_deserialize(cdr, *typed_message); -} - -static uint32_t _@(message.structure.namespaced_type.name)__get_serialized_size( - const void * untyped_ros_message) -{ - auto typed_message = - static_cast( - untyped_ros_message); - return static_cast(get_serialized_size(*typed_message, 0)); -} - -static size_t _@(message.structure.namespaced_type.name)__get_serialized_size_with_initial_alignment( - const void * untyped_ros_message, size_t current_alignment) -{ - auto typed_message = - static_cast( - untyped_ros_message); - return static_cast(get_serialized_size(*typed_message, current_alignment)); -} - -static size_t _@(message.structure.namespaced_type.name)__max_serialized_size() -{ - bool full_bounded; - return max_serialized_size_@(message.structure.namespaced_type.name)(&full_bounded, 0); -} - -static message_type_support_callbacks_t _@(message.structure.namespaced_type.name)__callbacks = { - "@('::'.join([package_name] + list(interface_path.parents[0].parts)))", - "@(message.structure.namespaced_type.name)", - _@(message.structure.namespaced_type.name)__cdr_serialize, - _@(message.structure.namespaced_type.name)__cdr_deserialize, - _@(message.structure.namespaced_type.name)__get_serialized_size, - _@(message.structure.namespaced_type.name)__get_serialized_size_with_initial_alignment, - _@(message.structure.namespaced_type.name)__max_serialized_size -}; - -static rosidl_message_type_support_t _@(message.structure.namespaced_type.name)__handle = { - rosidl_typesupport_microxrcedds_cpp::typesupport_identifier, - &_@(message.structure.namespaced_type.name)__callbacks, - get_message_typesupport_handle_function, -}; - -} // namespace typesupport_microxrcedds_cpp -@[ for ns in reversed(message.structure.namespaced_type.namespaces)]@ - -} // namespace @(ns) -@[ end for]@ - -namespace rosidl_typesupport_microxrcedds_cpp -{ - -template<> -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT_@(package_name) -const rosidl_message_type_support_t * -get_message_type_support_handle<@('::'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name]))>() -{ - return &@('::'.join([package_name] + list(interface_path.parents[0].parts)))::typesupport_microxrcedds_cpp::_@(message.structure.namespaced_type.name)__handle; -} - -} // namespace rosidl_typesupport_microxrcedds_cpp - -#ifdef __cplusplus -extern "C" -{ -#endif - -const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])))() { - return &@('::'.join([package_name] + list(interface_path.parents[0].parts)))::typesupport_microxrcedds_cpp::_@(message.structure.namespaced_type.name)__handle; -} - -#ifdef __cplusplus -} -#endif diff --git a/rosidl_typesupport_microxrcedds_cpp/resource/rosidl_typesupport_microxrcedds_cpp__visibility_control.h.in b/rosidl_typesupport_microxrcedds_cpp/resource/rosidl_typesupport_microxrcedds_cpp__visibility_control.h.in deleted file mode 100644 index 8937b7f..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/resource/rosidl_typesupport_microxrcedds_cpp__visibility_control.h.in +++ /dev/null @@ -1,43 +0,0 @@ -// generated from -// rosidl_typesupport_microxrcedds_cpp/resource/rosidl_typesupport_microxrcedds_cpp__visibility_control.h.in -// generated code does not contain a copyright notice - -#ifndef @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__VISIBILITY_CONTROL_H_ -#define @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__VISIBILITY_CONTROL_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ - #ifdef __GNUC__ - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT_@PROJECT_NAME@ __attribute__ ((dllexport)) - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT_@PROJECT_NAME@ __attribute__ ((dllimport)) - #else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT_@PROJECT_NAME@ __declspec(dllexport) - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT_@PROJECT_NAME@ __declspec(dllimport) - #endif - #ifdef ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_BUILDING_DLL_@PROJECT_NAME@ - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT_@PROJECT_NAME@ - #else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@PROJECT_NAME@ ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT_@PROJECT_NAME@ - #endif -#else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT_@PROJECT_NAME@ __attribute__ ((visibility("default"))) - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_IMPORT_@PROJECT_NAME@ - #if __GNUC__ >= 4 - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@PROJECT_NAME@ __attribute__ ((visibility("default"))) - #else - #define ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@PROJECT_NAME@ - #endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif // @PROJECT_NAME_UPPER@__MSG__ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__VISIBILITY_CONTROL_H_ diff --git a/rosidl_typesupport_microxrcedds_cpp/resource/srv__rosidl_typesupport_microxrcedds_cpp.hpp.em b/rosidl_typesupport_microxrcedds_cpp/resource/srv__rosidl_typesupport_microxrcedds_cpp.hpp.em deleted file mode 100644 index 09ee852..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/resource/srv__rosidl_typesupport_microxrcedds_cpp.hpp.em +++ /dev/null @@ -1,49 +0,0 @@ -@# Included from rosidl_typesupport_microxrcedds_cpp/resource/idl__rosidl_typesupport_microxrcedds_cpp.hpp.em -@{ -TEMPLATE( - 'msg__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - message=service.request_message, - include_directives=include_directives) -}@ - -@{ -TEMPLATE( - 'msg__rosidl_typesupport_microxrcedds_cpp.hpp.em', - package_name=package_name, - interface_path=interface_path, - message=service.response_message, - include_directives=include_directives) -}@ - -@{ -header_files = [ - 'rmw/types.h', - 'rosidl_typesupport_cpp/service_type_support.hpp', - 'rosidl_typesupport_interface/macros.h', - package_name + '/msg/rosidl_typesupport_microxrcedds_cpp__visibility_control.h', -] -}@ -@[for header_file in header_files]@ -@[ if header_file in include_directives]@ -// already included above -// @ -@[ else]@ -@{include_directives.add(header_file)}@ -@[ end if]@ -#include "@(header_file)" -@[end for]@ - -#ifdef __cplusplus -extern "C" -{ -#endif - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_PUBLIC_@(package_name) -const rosidl_service_type_support_t * - ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts) + [service.namespaced_type.name])))(); - -#ifdef __cplusplus -} -#endif diff --git a/rosidl_typesupport_microxrcedds_cpp/resource/srv__type_support_cpp.cpp.em b/rosidl_typesupport_microxrcedds_cpp/resource/srv__type_support_cpp.cpp.em deleted file mode 100644 index 6b17f3b..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/resource/srv__type_support_cpp.cpp.em +++ /dev/null @@ -1,97 +0,0 @@ -@# Included from rosidl_typesupport_microxrcedds_cpp/resource/idl__type_support.cpp.em -@{ -from rosidl_cmake import convert_camel_case_to_lower_case_underscore - -include_parts = [package_name] + list(interface_path.parents[0].parts) + \ - [convert_camel_case_to_lower_case_underscore(interface_path.stem)] -include_base = '/'.join(include_parts) -}@ -@{ -TEMPLATE( - 'msg__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - message=service.request_message, - include_directives=include_directives) -}@ - -@{ -TEMPLATE( - 'msg__type_support_cpp.cpp.em', - package_name=package_name, - interface_path=interface_path, - message=service.response_message, - include_directives=include_directives) -}@ - -@{ -header_files = [ - 'rmw/error_handling.h', - 'rosidl_typesupport_microxrcedds_c/service_type_support.h', - 'rosidl_typesupport_microxrcedds_cpp/identifier.hpp', - 'rosidl_typesupport_microxrcedds_cpp/service_type_support_decl.hpp', -] -}@ -@[for header_file in header_files]@ -@[ if header_file in include_directives]@ -// already included above -// @ -@[ else]@ -@{include_directives.add(header_file)}@ -@[ end if]@ -#include "@(header_file)" -@[end for]@ -@[ for ns in service.namespaced_type.namespaces]@ - -namespace @(ns) -{ -@[ end for]@ - -namespace typesupport_microxrcedds_cpp -{ - -static service_type_support_callbacks_t _@(service.namespaced_type.name)__callbacks = { - "@('::'.join([package_name] + list(interface_path.parents[0].parts)))", - "@(service.namespaced_type.name)", - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name)_Request), - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name)_Response), -}; - -static rosidl_service_type_support_t _@(service.namespaced_type.name)__handle = { - rosidl_typesupport_microxrcedds_cpp::typesupport_identifier, - &_@(service.namespaced_type.name)__callbacks, - get_service_typesupport_handle_function, -}; - -} // namespace typesupport_microxrcedds_cpp -@[ for ns in reversed(service.namespaced_type.namespaces)]@ - -} // namespace @(ns) -@[ end for]@ - -namespace rosidl_typesupport_microxrcedds_cpp -{ - -template<> -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT_@(package_name) -const rosidl_service_type_support_t * -get_service_type_support_handle<@('::'.join([package_name] + list(interface_path.parents[0].parts) + [service.namespaced_type.name]))>() -{ - return &@('::'.join([package_name] + list(interface_path.parents[0].parts)))::typesupport_microxrcedds_cpp::_@(service.namespaced_type.name)__handle; -} - -} // namespace rosidl_typesupport_microxrcedds_cpp - -#ifdef __cplusplus -extern "C" -{ -#endif - -const rosidl_service_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name))() { - return &@('::'.join([package_name] + list(interface_path.parents[0].parts)))::typesupport_microxrcedds_cpp::_@(service.namespaced_type.name)__handle; -} - -#ifdef __cplusplus -} -#endif diff --git a/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp-extras.cmake.in b/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp-extras.cmake.in deleted file mode 100644 index a0b1aa3..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp-extras.cmake.in +++ /dev/null @@ -1,30 +0,0 @@ -# generated from -# rosidl_typesupport_microxrcedds_cpp/ -# rosidl_typesupport_microxrcedds_cpp-extras.cmake.in - -# use the same type of library -set(rosidl_typesupport_microxrcedds_c_LIBRARY_TYPE "@rosidl_typesupport_microxrcedds_c_LIBRARY_TYPE@") - -# specific order: dependents before dependencies -list(APPEND rosidl_typesupport_microxrcedds_cpp_LIBRARIES microcdr) - -find_package(ament_cmake_core QUIET REQUIRED) -ament_register_extension( - "rosidl_generate_idl_interfaces" - "rosidl_typesupport_microxrcedds_cpp" - "rosidl_typesupport_microxrcedds_cpp_generate_interfaces.cmake") - -set(rosidl_typesupport_microxrcedds_cpp_BIN - "${rosidl_typesupport_microxrcedds_cpp_DIR}/../../../lib/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp") -normalize_path(rosidl_typesupport_microxrcedds_cpp_BIN - "${rosidl_typesupport_microxrcedds_cpp_BIN}") - -set(rosidl_typesupport_microxrcedds_cpp_GENERATOR_FILES - "${rosidl_typesupport_microxrcedds_cpp_DIR}/../../../@PYTHON_INSTALL_DIR@/rosidl_typesupport_microxrcedds_cpp/__init__.py") -normalize_path(rosidl_typesupport_microxrcedds_cpp_GENERATOR_FILES - "${rosidl_typesupport_microxrcedds_cpp_GENERATOR_FILES}") - -set(rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR - "${rosidl_typesupport_microxrcedds_cpp_DIR}/../resource") -normalize_path(rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR - "${rosidl_typesupport_microxrcedds_cpp_TEMPLATE_DIR}") diff --git a/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp/__init__.py b/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp/__init__.py deleted file mode 100644 index 5c759fc..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 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. - -from rosidl_cmake import generate_files - - -def generate_typesupport_microxrcedds_cpp(generator_arguments_file): - mapping = { - 'idl__rosidl_typesupport_microxrcedds_cpp.hpp.em': 'detail/%s__rosidl_typesupport_microxrcedds_cpp.hpp', - 'idl__type_support_cpp.cpp.em': 'detail/microxrcedds/%s__type_support_cpp.cpp' - } - generate_files(generator_arguments_file, mapping) - return 0 diff --git a/rosidl_typesupport_microxrcedds_cpp/src/identifier.cpp b/rosidl_typesupport_microxrcedds_cpp/src/identifier.cpp deleted file mode 100644 index 1bc888d..0000000 --- a/rosidl_typesupport_microxrcedds_cpp/src/identifier.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 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. - -#include -#include - -namespace rosidl_typesupport_microxrcedds_cpp -{ -ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP_EXPORT -const char * - typesupport_identifier = - ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE; -} // namespace rosidl_typesupport_microxrcedds_cpp diff --git a/test/cpp/CMakeLists.txt b/test/cpp/CMakeLists.txt deleted file mode 100644 index 4db1e66..0000000 --- a/test/cpp/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -# 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. - -cmake_minimum_required(VERSION 3.5) - -project(rosidl_typesupport_microxrcedds_cpp_tests LANGUAGES CXX) - -find_package(ament_cmake REQUIRED) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() - - find_package(rosidl_typesupport_microxrcedds_cpp REQUIRED) - find_package(rosidl_typesupport_microxrcedds_test_msg REQUIRED) - find_package(rosidl_runtime_cpp REQUIRED) - find_package(rosidl_typesupport_cpp REQUIRED) - find_package(ament_cmake_gtest REQUIRED) - - set(TEST_NAME test_typesupport) - ament_add_gtest(${TEST_NAME} - src/test_typesupport.cpp - ) - - ament_target_dependencies(${TEST_NAME} - rosidl_typesupport_microxrcedds_test_msg - rosidl_typesupport_microxrcedds_cpp - rosidl_runtime_c - rosidl_typesupport_c - ) - - target_link_libraries(${TEST_NAME} - microcdr - ) - - target_compile_options(${TEST_NAME} - PRIVATE - $<$:-Wall> - $<$:-Wextra> - $<$:-pedantic> - ) - - set_target_properties(${TEST_NAME} PROPERTIES - CXX_STANDARD - 14 - CXX_STANDARD_REQUIRED - YES - ) -endif() - -ament_package() diff --git a/test/cpp/package.xml b/test/cpp/package.xml deleted file mode 100644 index f707c26..0000000 --- a/test/cpp/package.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - rosidl_typesupport_microxrcedds_cpp_tests - 0.1.0 - Test for rosidl_typesupport_microxrcedds_cpp. - Borja Outerelo - Apache License 2.0 - - ament_cmake - - rosidl_default_generators - - ament_lint_auto - ament_lint_common - - rosidl_typesupport_microxrcedds_cpp - rosidl_typesupport_microxrcedds_test_msg - ament_cmake_gtest - builtin_interfaces - - - ament_cmake - - diff --git a/test/cpp/src/test_typesupport.cpp b/test/cpp/src/test_typesupport.cpp deleted file mode 100644 index 81340e6..0000000 --- a/test/cpp/src/test_typesupport.cpp +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright 2019 - present 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. - - -#include - -#include "rosidl_runtime_cpp/message_type_support_decl.hpp" -#include "rosidl_typesupport_cpp/message_type_support.hpp" - -// Generic MicroXRCE-DDS typesupport includes -#include -#include - -// Specific defined types used during testing -#include "rosidl_typesupport_microxrcedds_test_msg/msg/primitive.hpp" -#include "rosidl_typesupport_microxrcedds_test_msg/msg/sequence.hpp" -#include "rosidl_typesupport_microxrcedds_test_msg/msg/compound.hpp" - -/* - * @brief TestTypeSupport class, used to automate typesupport testing for a specific type. - */ -template -class TestTypeSupport : public ::testing::Test -{ -public: - /* - * @brief Default constructor. - */ - TestTypeSupport() = default; - - /* - * @brief Lvalue copy constructor (deleted). - * @param[in] other Test to be copied. - */ - TestTypeSupport( - const TestTypeSupport & other) = delete; - - /* - * @brief Rvalue copy constructor (deleted). - * @param[in] other Test to be copied. - */ - TestTypeSupport( - TestTypeSupport && other) = delete; - - /* - * @brief Setup function. - * @param[in] init_test_type Initialized rvalue instance of the ROS 2 type to be tested. - * @param[in] compare_func_handle Function used for comparing two instances of T type. - */ - void setup( - T && init_test_type, - std::function & compare_func_handle) - { - rosidl_message_type_support_ = rosidl_typesupport_cpp::get_message_type_support_handle(); - rosidl_message_type_support_ = get_message_typesupport_handle( - rosidl_message_type_support_, ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE); - - message_type_support_callbacks_ = static_cast( - rosidl_message_type_support_->data); - - tested_type_ = std::move(init_test_type); - compare_func_handle_ = &compare_func_handle; - } - - /* - * @brief Checks for correctness of the retrieved typesupport's identifier. - */ - void check_identifier() - { - ASSERT_EQ(strcmp(rosidl_message_type_support_->typesupport_identifier, - ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE), 0); - } - - /* - * @brief Tests serialization and deserialization of a T type message, - * and compares the original instance and the deserialized one - * in terms of equalness. - */ - void test_serialize_deserialize() - { - ucdrBuffer mb_writer; - ucdrBuffer mb_reader; - - /* - * TODO(jamoralp): improve this buffer's creation in terms of size. - * Maybe we can use CDR max serialized size here, also to check that this method works properly. - */ - uint8_t mb_buffer[5000]; - ucdr_init_buffer(&mb_writer, mb_buffer, sizeof(mb_buffer)); - ucdr_init_buffer(&mb_reader, mb_buffer, sizeof(mb_buffer)); - - ASSERT_TRUE(message_type_support_callbacks_->cdr_serialize(&tested_type_, &mb_writer)); - - T test_out; - ASSERT_TRUE(message_type_support_callbacks_->cdr_deserialize(&mb_reader, &test_out)); - - compare(tested_type_, test_out); - } - -protected: - /* - * @brief Compare two given instances of the same type (T), in terms of equalness. - * @param[in] A First instance to be compared. - * @param[in] B Second instance to be compared. - */ - void compare( - const T & A, - const T & B) - { - (*compare_func_handle_)(A, B); - } - - T tested_type_; - const rosidl_message_type_support_t * rosidl_message_type_support_; - const message_type_support_callbacks_t * message_type_support_callbacks_; - std::function * compare_func_handle_; -}; - -/****************************************************************************** - Serialize/deserialize test suites. - *****************************************************************************/ - -/* - * @brief Primitive ROS 2 types serialization and deserialization tests. - */ -template -class PrimitivesTestTypeSupport : public TestTypeSupport {}; - -TYPED_TEST_CASE(PrimitivesTestTypeSupport, - testing::Types); -TYPED_TEST(PrimitivesTestTypeSupport, serialize_primitive_types) -{ - std::function compare_primitives ([]( - const rosidl_typesupport_microxrcedds_test_msg::msg::Primitive & A, - const rosidl_typesupport_microxrcedds_test_msg::msg::Primitive & B) -> void - { - EXPECT_EQ(A.bool_test, B.bool_test); - EXPECT_EQ(A.byte_test, B.byte_test); - EXPECT_EQ(A.char_test, B.char_test); - EXPECT_EQ(A.float32_test, B.float32_test); - EXPECT_EQ(A.double_test, B.double_test); - EXPECT_EQ(A.int8_test, B.int8_test); - EXPECT_EQ(A.uint8_test, B.uint8_test); - EXPECT_EQ(A.int16_test, B.int16_test); - EXPECT_EQ(A.uint16_test, B.uint16_test); - EXPECT_EQ(A.int32_test, B.int32_test); - EXPECT_EQ(A.uint32_test, B.uint32_test); - EXPECT_EQ(A.int64_test, B.int64_test); - EXPECT_EQ(A.uint64_test, B.uint64_test); - - EXPECT_EQ(A.nested_test.unbounded_string1.compare(B.nested_test.unbounded_string1), 0); - EXPECT_EQ(A.nested_test.unbounded_string2.compare(B.nested_test.unbounded_string2), 0); - EXPECT_EQ(A.nested_test.unbounded_string3.compare(B.nested_test.unbounded_string3), 0); - EXPECT_EQ(A.nested_test.unbounded_string4.compare(B.nested_test.unbounded_string4), 0); - }); - - // Initialize data to be serialized and deserialized - rosidl_typesupport_microxrcedds_test_msg::msg::Primitive init_primitive; - init_primitive.bool_test = 0x01; - init_primitive.byte_test = 0x01; - init_primitive.char_test = 0x01; - init_primitive.float32_test = 100.001; - init_primitive.double_test = 100.001; - init_primitive.int8_test = 0x01; - init_primitive.uint8_test = 0x01; - init_primitive.int16_test = 0x0101; - init_primitive.uint16_test = 0x0101; - init_primitive.int32_test = 0x01010101; - init_primitive.uint32_test = 0x01010101; - init_primitive.int64_test = 0x0101010101010101; - init_primitive.uint64_test = 0x0101010101010101; - init_primitive.nested_test.unbounded_string1 = "ABCDEF"; - init_primitive.nested_test.unbounded_string2 = "TGHIJKLMNO"; - init_primitive.nested_test.unbounded_string3 = "PQRSTVWX"; - init_primitive.nested_test.unbounded_string4 = "TYZ0123456789"; - - this->setup(std::move(init_primitive), compare_primitives); - this->check_identifier(); - this->test_serialize_deserialize(); -} - -/* - * @brief Sequence ROS 2 types serialization and deserialization tests. - */ -template -class SequencesTestTypeSupport : public TestTypeSupport {}; - -TYPED_TEST_CASE(SequencesTestTypeSupport, - testing::Types); -TYPED_TEST(SequencesTestTypeSupport, serialize_sequence_types) -{ - std::function compare_sequences ([]( - const rosidl_typesupport_microxrcedds_test_msg::msg::Sequence & A, - const rosidl_typesupport_microxrcedds_test_msg::msg::Sequence & B) -> void - { - EXPECT_EQ(A.sequence_string_test.size(), B.sequence_string_test.size()); - - for (size_t i = 0; i < A.sequence_string_test.size(); ++i) - { - EXPECT_EQ(A.sequence_string_test[i].compare(B.sequence_string_test[i]), 0); - } - }); - - // Initialize data to be serialized and deserialized - rosidl_typesupport_microxrcedds_test_msg::msg::Sequence init_sequence; - init_sequence.sequence_string_test.emplace_back("This"); - init_sequence.sequence_string_test.emplace_back("is"); - init_sequence.sequence_string_test.emplace_back("a"); - init_sequence.sequence_string_test.emplace_back("test"); - - this->setup(std::move(init_sequence), compare_sequences); - this->check_identifier(); - this->test_serialize_deserialize(); -} - -/* - * @brief Compound ROS 2 types serialization and deseralization tests, - * when padding is required for sequences. - */ -template -class CompoundSequencesTestTypeSupport : public TestTypeSupport {}; - -TYPED_TEST_CASE(CompoundSequencesTestTypeSupport, - testing::Types); -TYPED_TEST(CompoundSequencesTestTypeSupport, serialize_compound_types) -{ - std::function compare_compound ([]( - const rosidl_typesupport_microxrcedds_test_msg::msg::Compound & A, - const rosidl_typesupport_microxrcedds_test_msg::msg::Compound & B) -> void - { - EXPECT_EQ(A.string_data.compare(B.string_data), 0); - - EXPECT_EQ(A.sequence_data.size(), B.sequence_data.size()); - for (size_t i = 0; i < A.sequence_data.size(); ++i) - { - EXPECT_EQ(A.sequence_data[i].bool_test, B.sequence_data[i].bool_test); - EXPECT_EQ(A.sequence_data[i].byte_test, B.sequence_data[i].byte_test); - EXPECT_EQ(A.sequence_data[i].char_test, B.sequence_data[i].char_test); - EXPECT_EQ(A.sequence_data[i].float32_test, B.sequence_data[i].float32_test); - EXPECT_EQ(A.sequence_data[i].double_test, B.sequence_data[i].double_test); - EXPECT_EQ(A.sequence_data[i].int8_test, B.sequence_data[i].int8_test); - EXPECT_EQ(A.sequence_data[i].uint8_test, B.sequence_data[i].uint8_test); - EXPECT_EQ(A.sequence_data[i].int16_test, B.sequence_data[i].int16_test); - EXPECT_EQ(A.sequence_data[i].uint16_test, B.sequence_data[i].uint16_test); - EXPECT_EQ(A.sequence_data[i].int32_test, B.sequence_data[i].int32_test); - EXPECT_EQ(A.sequence_data[i].uint32_test, B.sequence_data[i].uint32_test); - EXPECT_EQ(A.sequence_data[i].int64_test, B.sequence_data[i].int64_test); - EXPECT_EQ(A.sequence_data[i].uint64_test, B.sequence_data[i].uint64_test); - - EXPECT_EQ(A.sequence_data[i].nested_test.unbounded_string1.compare( - B.sequence_data[i].nested_test.unbounded_string1), 0); - EXPECT_EQ(A.sequence_data[i].nested_test.unbounded_string2.compare( - B.sequence_data[i].nested_test.unbounded_string2), 0); - EXPECT_EQ(A.sequence_data[i].nested_test.unbounded_string3.compare( - B.sequence_data[i].nested_test.unbounded_string3), 0); - EXPECT_EQ(A.sequence_data[i].nested_test.unbounded_string4.compare( - B.sequence_data[i].nested_test.unbounded_string4), 0); - } - }); - - // Initialize data to be serialized and deserialized - rosidl_typesupport_microxrcedds_test_msg::msg::Compound init_compound; - init_compound.string_data = "AAAAAAAAAAA"; - - size_t compound_seq_size = 4; - for (size_t i = 1; i <= compound_seq_size; ++i) - { - rosidl_typesupport_microxrcedds_test_msg::msg::Primitive primitive_elem; - primitive_elem.bool_test = 0x01; - primitive_elem.byte_test = 0x01 * i; - primitive_elem.char_test = 0x01 * i; - primitive_elem.float32_test = 100.001 * i; - primitive_elem.double_test = 100.001 * i; - primitive_elem.int8_test = 0x01 * i; - primitive_elem.uint8_test = 0x01 * i; - primitive_elem.int16_test = 0x0101 * i; - primitive_elem.uint16_test = 0x0101 * i; - primitive_elem.int32_test = 0x01010101 * i; - primitive_elem.uint32_test = 0x01010101 * i; - primitive_elem.int64_test = 0x0101010101010101 * i; - primitive_elem.uint64_test = 0x0101010101010101 * i; - primitive_elem.nested_test.unbounded_string1 = "ABCDEFGH"; - primitive_elem.nested_test.unbounded_string2 = "IJKLMNOPQ"; - primitive_elem.nested_test.unbounded_string3 = "RSTUVWXYZ"; - primitive_elem.nested_test.unbounded_string4 = std::to_string(1111111 * i); - - init_compound.sequence_data.emplace_back(std::move(primitive_elem)); - } - - this->setup(std::move(init_compound), compare_compound); - this->check_identifier(); - this->test_serialize_deserialize(); -}