.. _program_listing_file_include_rclc_executor_handle.h: Program Listing for File executor_handle.h ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/rclc/executor_handle.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright (c) 2020 - for information on the respective copyright owner // see the NOTICE file and/or the repository https://github.com/ros2/rclc. // Copyright 2014 Open Source Robotics Foundation, Inc. // // 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 RCLC__EXECUTOR_HANDLE_H_ #define RCLC__EXECUTOR_HANDLE_H_ #if __cplusplus extern "C" { #endif #include #include #include #include // #define ROS_PACKAGE_NAME "rclc" typedef enum { RCLC_SUBSCRIPTION, RCLC_SUBSCRIPTION_WITH_CONTEXT, RCLC_TIMER, // RCLC_TIMER_WITH_CONTEXT, // TODO RCLC_CLIENT, RCLC_CLIENT_WITH_REQUEST_ID, // RCLC_CLIENT_WITH_CONTEXT, // TODO RCLC_SERVICE, RCLC_SERVICE_WITH_REQUEST_ID, RCLC_SERVICE_WITH_CONTEXT, RCLC_ACTION_CLIENT, RCLC_ACTION_SERVER, RCLC_GUARD_CONDITION, // RCLC_GUARD_CONDITION_WITH_CONTEXT, //TODO RCLC_NONE } rclc_executor_handle_type_t; typedef enum { ON_NEW_DATA, ALWAYS } rclc_executor_handle_invocation_t; typedef void (* rclc_subscription_callback_t)(const void *); typedef rclc_subscription_callback_t rclc_callback_t; typedef void (* rclc_subscription_callback_with_context_t)(const void *, void *); typedef void (* rclc_service_callback_t)(const void *, void *); typedef void (* rclc_service_callback_with_request_id_t)(const void *, rmw_request_id_t *, void *); typedef void (* rclc_service_callback_with_context_t)(const void *, void *, void *); typedef void (* rclc_client_callback_t)(const void *); typedef void (* rclc_client_callback_with_request_id_t)(const void *, rmw_request_id_t *); typedef void (* rclc_gc_callback_t)(); typedef struct { rclc_executor_handle_type_t type; rclc_executor_handle_invocation_t invocation; union { rcl_subscription_t * subscription; rcl_timer_t * timer; rcl_client_t * client; rcl_service_t * service; rcl_guard_condition_t * gc; rclc_action_client_t * action_client; rclc_action_server_t * action_server; }; void * data; rmw_request_id_t req_id; void * data_response_msg; void * callback_context; // TODO(jst3si) new type to be stored as data for // service/client objects // look at memory allocation for this struct! // struct { // void * request_msg // void * response_msg // rmw_request_id_t req_id; //} rclc_service_data_type_t union { rclc_subscription_callback_t subscription_callback; rclc_subscription_callback_with_context_t subscription_callback_with_context; rclc_service_callback_t service_callback; rclc_service_callback_with_request_id_t service_callback_with_reqid; rclc_service_callback_with_context_t service_callback_with_context; rclc_client_callback_t client_callback; rclc_client_callback_with_request_id_t client_callback_with_reqid; rclc_gc_callback_t gc_callback; }; size_t index; bool initialized; bool data_available; void * custom; } rclc_executor_handle_t; typedef struct { size_t number_of_subscriptions; size_t number_of_timers; size_t number_of_clients; size_t number_of_services; size_t number_of_action_clients; size_t number_of_action_servers; size_t number_of_guard_conditions; size_t number_of_events; } rclc_executor_handle_counters_t; RCLC_PUBLIC rcl_ret_t rclc_executor_handle_counters_zero_init(rclc_executor_handle_counters_t * handle_counters); RCLC_PUBLIC rcl_ret_t rclc_executor_handle_init( rclc_executor_handle_t * handle, size_t max_handles); RCLC_PUBLIC rcl_ret_t rclc_executor_handle_clear( rclc_executor_handle_t * handle, size_t max_handles); RCLC_PUBLIC rcl_ret_t rclc_executor_handle_print(rclc_executor_handle_t * handle); RCLC_PUBLIC void * rclc_executor_handle_get_ptr(rclc_executor_handle_t * handle); #if __cplusplus } #endif #endif // RCLC__EXECUTOR_HANDLE_H_