diff --git a/rcl/src/rcl/client.c b/rcl/src/rcl/client.c index b54fe0f0a..970465551 100644 --- a/rcl/src/rcl/client.c +++ b/rcl/src/rcl/client.c @@ -51,7 +51,9 @@ struct rcl_client_impl_s atomic_int_least64_t sequence_number; rcl_service_event_publisher_t * service_event_publisher; char * remapped_service_name; +#ifdef RCL_MICROROS_COMPLETE_IMPL rosidl_type_hash_t type_hash; +#endif // RCL_MICROROS_COMPLETE_IMPL }; rcl_client_t @@ -190,8 +192,8 @@ rcl_client_init( ret = RCL_RET_ERROR; goto destroy_client; } -#endif // RCL_MICROROS_COMPLETE_IMPL client->impl->type_hash = *type_support->get_type_hash_func(type_support); +#endif // RCL_MICROROS_COMPLETE_IMPL RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client initialized"); TRACEPOINT( diff --git a/rcl/src/rcl/node.c b/rcl/src/rcl/node.c index 6c0facdc2..17093adc0 100644 --- a/rcl/src/rcl/node.c +++ b/rcl/src/rcl/node.c @@ -208,8 +208,10 @@ rcl_node_init( node->impl->logger_name = NULL; node->impl->fq_name = NULL; node->impl->options = rcl_node_get_default_options(); +#ifdef RCL_MICROROS_COMPLETE_IMPL node->impl->registered_types_by_type_hash = rcutils_get_zero_initialized_hash_map(); node->impl->get_type_description_service = rcl_get_zero_initialized_service(); +#endif // RCL_MICROROS_COMPLETE_IMPL node->context = context; // Initialize node impl. ret = rcl_node_options_copy(options, &(node->impl->options)); @@ -625,6 +627,7 @@ void rcl_node_type_description_service_handle_request( rcl_ret_t rcl_node_type_description_service_init(rcl_node_t * node) { +#ifdef RCL_MICROROS_COMPLETE_IMPL RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT); RCL_CHECK_ARGUMENT_FOR_NULL(node->impl, RCL_RET_NODE_INVALID); @@ -660,10 +663,15 @@ rcl_ret_t rcl_node_type_description_service_init(rcl_node_t * node) allocator.deallocate(service_name, allocator.state); return ret; +#else + (void)node; + return RCL_RET_UNSUPPORTED; +#endif //RCL_MICROROS } rcl_ret_t rcl_node_type_description_service_fini(rcl_node_t * node) { +#ifdef RCL_MICROROS_COMPLETE_IMPL RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT); RCL_CHECK_ARGUMENT_FOR_NULL(node->impl, RCL_RET_NODE_INVALID); if (!rcl_service_is_valid(&node->impl->get_type_description_service)) { @@ -678,12 +686,17 @@ rcl_ret_t rcl_node_type_description_service_fini(rcl_node_t * node) } return ret; +#else + (void)node; + return RCL_RET_UNSUPPORTED; +#endif //RCL_MICROROS } rcl_ret_t rcl_node_get_type_description_service( const rcl_node_t * node, rcl_service_t ** service_out) { +#ifdef RCL_MICROROS_COMPLETE_IMPL RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT); RCL_CHECK_ARGUMENT_FOR_NULL(node->impl, RCL_RET_NODE_INVALID); RCL_CHECK_ARGUMENT_FOR_NULL(service_out, RCL_RET_SERVICE_INVALID); @@ -694,6 +707,11 @@ rcl_ret_t rcl_node_get_type_description_service( *service_out = &node->impl->get_type_description_service; return RCL_RET_OK; +#else + (void)node; + (void)service_out; + return RCL_RET_UNSUPPORTED; +#endif //RCL_MICROROS } #ifdef __cplusplus diff --git a/rcl/src/rcl/node_impl.h b/rcl/src/rcl/node_impl.h index 8d4f5847e..ff202f8b2 100644 --- a/rcl/src/rcl/node_impl.h +++ b/rcl/src/rcl/node_impl.h @@ -30,8 +30,10 @@ struct rcl_node_impl_s rcl_guard_condition_t * graph_guard_condition; const char * logger_name; const char * fq_name; +#ifdef RCL_MICROROS_COMPLETE_IMPL rcutils_hash_map_t registered_types_by_type_hash; rcl_service_t get_type_description_service; +#endif // RCL_MICROROS_COMPLETE_IMPL }; #endif // RCL__NODE_IMPL_H_ diff --git a/rcl/src/rcl/publisher.c b/rcl/src/rcl/publisher.c index 89f11faf7..c783a9fc6 100644 --- a/rcl/src/rcl/publisher.c +++ b/rcl/src/rcl/publisher.c @@ -140,8 +140,8 @@ rcl_publisher_init( RCL_SET_ERROR_MSG("Failed to register type for subscription"); goto fail; } -#endif // RCL_MICROROS_COMPLETE_IMPL publisher->impl->type_hash = *type_support->get_type_hash_func(type_support); +#endif // RCL_MICROROS_COMPLETE_IMPL RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Publisher initialized"); // context diff --git a/rcl/src/rcl/publisher_impl.h b/rcl/src/rcl/publisher_impl.h index 26bbb43da..d9edd4316 100644 --- a/rcl/src/rcl/publisher_impl.h +++ b/rcl/src/rcl/publisher_impl.h @@ -25,7 +25,9 @@ struct rcl_publisher_impl_s rmw_qos_profile_t actual_qos; rcl_context_t * context; rmw_publisher_t * rmw_handle; +#ifdef RCL_MICROROS_COMPLETE_IMPL rosidl_type_hash_t type_hash; +#endif // RCL_MICROROS_COMPLETE_IMPL }; #endif // RCL__PUBLISHER_IMPL_H_ diff --git a/rcl/src/rcl/service.c b/rcl/src/rcl/service.c index e975ab7fa..c1f9821c1 100644 --- a/rcl/src/rcl/service.c +++ b/rcl/src/rcl/service.c @@ -50,7 +50,9 @@ struct rcl_service_impl_s rmw_service_t * rmw_handle; rcl_service_event_publisher_t * service_event_publisher; char * remapped_service_name; +#ifdef RCL_MICROROS_COMPLETE_IMPL rosidl_type_hash_t type_hash; +#endif // RCL_MICROROS_COMPLETE_IMPL }; rcl_service_t @@ -201,8 +203,8 @@ rcl_service_init( ret = RCL_RET_ERROR; goto destroy_service; } -#endif // RCL_MICROROS_COMPLETE_IMPL service->impl->type_hash = *type_support->get_type_hash_func(type_support); +#endif // RCL_MICROROS_COMPLETE_IMPL RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service initialized"); TRACEPOINT( diff --git a/rcl/src/rcl/subscription.c b/rcl/src/rcl/subscription.c index b758ce1f1..76d1b3c4b 100644 --- a/rcl/src/rcl/subscription.c +++ b/rcl/src/rcl/subscription.c @@ -135,8 +135,8 @@ rcl_subscription_init( RCL_SET_ERROR_MSG("Failed to register type for subscription"); goto fail; } -#endif // RCL_MICROROS_COMPLETE_IMPL subscription->impl->type_hash = *type_support->get_type_hash_func(type_support); +#endif // RCL_MICROROS_COMPLETE_IMPL RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Subscription initialized"); ret = RCL_RET_OK; diff --git a/rcl/src/rcl/subscription_impl.h b/rcl/src/rcl/subscription_impl.h index 8193421cf..64c0b75a1 100644 --- a/rcl/src/rcl/subscription_impl.h +++ b/rcl/src/rcl/subscription_impl.h @@ -24,7 +24,9 @@ struct rcl_subscription_impl_s rcl_subscription_options_t options; rmw_qos_profile_t actual_qos; rmw_subscription_t * rmw_handle; +#ifdef RCL_MICROROS_COMPLETE_IMPL rosidl_type_hash_t type_hash; +#endif // RCL_MICROROS_COMPLETE_IMPL }; #endif // RCL__SUBSCRIPTION_IMPL_H_ diff --git a/rcl_action/src/rcl_action/action_client.c b/rcl_action/src/rcl_action/action_client.c index 2cf0c5f3f..bc6d779da 100644 --- a/rcl_action/src/rcl_action/action_client.c +++ b/rcl_action/src/rcl_action/action_client.c @@ -67,7 +67,9 @@ _rcl_action_get_zero_initialized_client_impl(void) 0, 0, 0, +#ifdef RCL_MICROROS_COMPLETE_IMPL rosidl_get_zero_initialized_type_hash() +#endif // RCL_MICROROS_COMPLETE_IMPL }; return null_action_client; } @@ -244,8 +246,8 @@ rcl_action_client_init( RCL_SET_ERROR_MSG("Failed to register type for action"); goto fail; } -#endif // RCL_MICROROS_COMPLETE_IMPL action_client->impl->type_hash = *type_support->get_type_hash_func(type_support); +#endif // RCL_MICROROS_COMPLETE_IMPL RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Action client initialized"); return ret; diff --git a/rcl_action/src/rcl_action/action_client_impl.h b/rcl_action/src/rcl_action/action_client_impl.h index f1d430a8d..ad1098609 100644 --- a/rcl_action/src/rcl_action/action_client_impl.h +++ b/rcl_action/src/rcl_action/action_client_impl.h @@ -33,7 +33,9 @@ typedef struct rcl_action_client_impl_s size_t wait_set_result_client_index; size_t wait_set_feedback_subscription_index; size_t wait_set_status_subscription_index; +#ifdef RCL_MICROROS_COMPLETE_IMPL rosidl_type_hash_t type_hash; +#endif // RCL_MICROROS_COMPLETE_IMPL } rcl_action_client_impl_t; diff --git a/rcl_action/src/rcl_action/action_server.c b/rcl_action/src/rcl_action/action_server.c index c561cae63..5fdaa04e1 100644 --- a/rcl_action/src/rcl_action/action_server.c +++ b/rcl_action/src/rcl_action/action_server.c @@ -162,7 +162,9 @@ rcl_action_server_init( action_server->impl->goal_handles = NULL; action_server->impl->num_goal_handles = 0u; action_server->impl->clock = NULL; +#ifdef RCL_MICROROS_COMPLETE_IMPL action_server->impl->type_hash = rosidl_get_zero_initialized_type_hash(); +#endif // RCL_MICROROS_COMPLETE_IMPL rcl_ret_t ret = RCL_RET_OK; // Initialize services @@ -208,8 +210,8 @@ rcl_action_server_init( RCL_SET_ERROR_MSG("Failed to register type for action"); goto fail; } -#endif // RCL_MICROROS_COMPLETE_IMPL action_server->impl->type_hash = *type_support->get_type_hash_func(type_support); +#endif // RCL_MICROROS_COMPLETE_IMPL return ret; fail: diff --git a/rcl_action/src/rcl_action/action_server_impl.h b/rcl_action/src/rcl_action/action_server_impl.h index 572f799f6..f3eaed24c 100644 --- a/rcl_action/src/rcl_action/action_server_impl.h +++ b/rcl_action/src/rcl_action/action_server_impl.h @@ -39,7 +39,9 @@ typedef struct rcl_action_server_impl_s size_t wait_set_cancel_service_index; size_t wait_set_result_service_index; size_t wait_set_expire_timer_index; +#ifdef RCL_MICROROS_COMPLETE_IMPL rosidl_type_hash_t type_hash; +#endif // RCL_MICROROS_COMPLETE_IMPL } rcl_action_server_impl_t;