Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions rmw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ endif()

find_package(ament_cmake_ros REQUIRED)

find_package(c_utilities REQUIRED)

include(cmake/configure_rmw_library.cmake)

include_directories(include)
Expand All @@ -18,14 +20,19 @@ set(rmw_sources
"src/validate_namespace.c"
"src/validate_node_name.c"
"src/validate_topic_name.c"
"src/sanity_checks.c")
set_source_files_properties(
${rmw_sources}
PROPERTIES LANGUAGE "C")
"src/sanity_checks.c"
)
set_source_files_properties(${rmw_sources} PROPERTIES LANGUAGE "C")
add_library(${PROJECT_NAME} ${rmw_sources})
ament_target_dependencies(${PROJECT_NAME}
"c_utilities"
)
configure_rmw_library(${PROJECT_NAME} LANGUAGE "C")

ament_export_dependencies(rosidl_generator_c)
ament_export_dependencies(
c_utilities
rosidl_generator_c
)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})

Expand Down
10 changes: 3 additions & 7 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ extern "C"
#include <stddef.h>
#include <stdint.h>

#include "c_utilities/types.h"

#include "rosidl_generator_c/message_type_support_struct.h"
#include "rosidl_generator_c/service_type_support.h"

Expand Down Expand Up @@ -336,13 +338,7 @@ RMW_WARN_UNUSED
rmw_ret_t
rmw_get_node_names(
const rmw_node_t * node,
rmw_string_array_t * node_names);

RMW_PUBLIC
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing this function instead of just changing the type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the destroy function is part of the c_utilities package, here:

https://github.com/ros2/c_utilities/blob/master/include/c_utilities/types/string_array.h#L77

RMW_WARN_UNUSED
rmw_ret_t
rmw_destroy_node_names(
rmw_string_array_t * node_names);
utilities_string_array_t * node_names);

RMW_PUBLIC
RMW_WARN_UNUSED
Expand Down
4 changes: 3 additions & 1 deletion rmw/include/rmw/sanity_checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ extern "C"
{
#endif

#include "c_utilities/types.h"

#include "rmw/macros.h"
#include "rmw/types.h"
#include "rmw/visibility_control.h"
Expand All @@ -34,7 +36,7 @@ rmw_check_zero_rmw_topic_names_and_types(rmw_topic_names_and_types_t * tnat);
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_check_zero_rmw_string_array(rmw_string_array_t * array);
rmw_check_zero_rmw_string_array(utilities_string_array_t * array);

#if __cplusplus
}
Expand Down
6 changes: 0 additions & 6 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,6 @@ typedef struct RMW_PUBLIC_TYPE rmw_topic_names_and_types_t
char ** type_names;
} rmw_topic_names_and_types_t;

typedef struct RMW_PUBLIC_TYPE rmw_string_array_t
{
size_t size;
char ** data;
} rmw_string_array_t;

typedef struct RMW_PUBLIC_TYPE rmw_gid_t
{
const char * implementation_identifier;
Expand Down
3 changes: 3 additions & 0 deletions rmw/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

<buildtool_depend>ament_cmake_ros</buildtool_depend>

<build_depend>c_utilities</build_depend>
<build_export_depend>c_utilities</build_export_depend>

<!-- This is required for the definition of the rosidl typesupport types -->
<build_export_depend>rosidl_generator_c</build_export_depend>

Expand Down
4 changes: 3 additions & 1 deletion rmw/src/sanity_checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <stdlib.h>
#include <string.h>

#include "c_utilities/types.h"

#include "rmw/error_handling.h"
#include "rmw/types.h"

Expand Down Expand Up @@ -45,7 +47,7 @@ rmw_check_zero_rmw_topic_names_and_types(

rmw_ret_t
rmw_check_zero_rmw_string_array(
rmw_string_array_t * array)
utilities_string_array_t * array)
{
if (!array) {
RMW_SET_ERROR_MSG("array is null");
Expand Down