From 92484f6e840a13d621f47c9c65ce0585678cbe33 Mon Sep 17 00:00:00 2001 From: Mauro Date: Fri, 2 Oct 2020 16:37:10 +0100 Subject: [PATCH 1/9] Add event_types.h --- include/rcutils/event_types.h | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 include/rcutils/event_types.h diff --git a/include/rcutils/event_types.h b/include/rcutils/event_types.h new file mode 100644 index 00000000..9b41ef97 --- /dev/null +++ b/include/rcutils/event_types.h @@ -0,0 +1,60 @@ +// Copyright 2020 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 RCUTILS__EVENT_TYPES_H_ +#define RCUTILS__EVENT_TYPES_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +enum EventQueueType { + SUBSCRIPTION_EVENT, + SERVICE_EVENT, + CLIENT_EVENT, + GUARD_CONDITION_EVENT +}; + +typedef enum EventQueueType EventQueueType; + +struct EventQ { + void * entity; + EventQueueType type; +}; + +typedef struct EventQ EventQ; + +typedef void (*Event_callback)(void * context, EventQ event); + +struct EventHandle { + + // Associated context (executor) + void * context; + + // Event handle; + void * ros2_handle; + + // Event callback + Event_callback callback; +}; + +typedef struct EventHandle EventHandle; + + +#ifdef __cplusplus +} +#endif + +#endif // RCUTILS__EVENT_TYPES_H_ \ No newline at end of file From 9ea81cfe435a6fe60f2abf40d7a4c23f29d40f6a Mon Sep 17 00:00:00 2001 From: Mauro Date: Fri, 2 Oct 2020 18:40:22 +0100 Subject: [PATCH 2/9] add constness --- include/rcutils/event_types.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/rcutils/event_types.h b/include/rcutils/event_types.h index 9b41ef97..444ccd7c 100644 --- a/include/rcutils/event_types.h +++ b/include/rcutils/event_types.h @@ -30,21 +30,21 @@ enum EventQueueType { typedef enum EventQueueType EventQueueType; struct EventQ { - void * entity; + const void * entity; EventQueueType type; }; typedef struct EventQ EventQ; -typedef void (*Event_callback)(void * context, EventQ event); +typedef void (*Event_callback)(const void * context, EventQ event); struct EventHandle { // Associated context (executor) - void * context; + const void * context; // Event handle; - void * ros2_handle; + const void * ros2_handle; // Event callback Event_callback callback; From 4c98c3add2561839837330ec03daf2e8d4fcb57d Mon Sep 17 00:00:00 2001 From: Mauro Date: Thu, 8 Oct 2020 14:59:00 +0100 Subject: [PATCH 3/9] Add custom user event --- include/rcutils/event_types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/rcutils/event_types.h b/include/rcutils/event_types.h index 444ccd7c..96d891e8 100644 --- a/include/rcutils/event_types.h +++ b/include/rcutils/event_types.h @@ -24,7 +24,8 @@ enum EventQueueType { SUBSCRIPTION_EVENT, SERVICE_EVENT, CLIENT_EVENT, - GUARD_CONDITION_EVENT + GUARD_CONDITION_EVENT, + USER_EVENT_BASE = 1000 }; typedef enum EventQueueType EventQueueType; From 889cec3165ad030809a64d2fefc117c985493c00 Mon Sep 17 00:00:00 2001 From: Mauro Date: Mon, 12 Oct 2020 13:06:14 +0100 Subject: [PATCH 4/9] Rename EventQ->ExecutorEvent --- include/rcutils/event_types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/rcutils/event_types.h b/include/rcutils/event_types.h index 96d891e8..28810cd6 100644 --- a/include/rcutils/event_types.h +++ b/include/rcutils/event_types.h @@ -30,14 +30,14 @@ enum EventQueueType { typedef enum EventQueueType EventQueueType; -struct EventQ { +struct ExecutorEvent { const void * entity; EventQueueType type; }; -typedef struct EventQ EventQ; +typedef struct ExecutorEvent ExecutorEvent; -typedef void (*Event_callback)(const void * context, EventQ event); +typedef void (*Event_callback)(const void * context, ExecutorEvent event); struct EventHandle { From 00920af1a852c87b73ad46efad937601abb4d5ff Mon Sep 17 00:00:00 2001 From: Mauro Date: Mon, 12 Oct 2020 16:18:17 +0100 Subject: [PATCH 5/9] Rename Event to ExecutorEvent --- .../{event_types.h => executor_event_types.h} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename include/rcutils/{event_types.h => executor_event_types.h} (77%) diff --git a/include/rcutils/event_types.h b/include/rcutils/executor_event_types.h similarity index 77% rename from include/rcutils/event_types.h rename to include/rcutils/executor_event_types.h index 28810cd6..add11f44 100644 --- a/include/rcutils/event_types.h +++ b/include/rcutils/executor_event_types.h @@ -20,26 +20,26 @@ extern "C" { #endif -enum EventQueueType { +enum ExecutorEventType { SUBSCRIPTION_EVENT, SERVICE_EVENT, CLIENT_EVENT, - GUARD_CONDITION_EVENT, + WAITABLE_EVENT, USER_EVENT_BASE = 1000 }; -typedef enum EventQueueType EventQueueType; +typedef enum ExecutorEventType ExecutorEventType; struct ExecutorEvent { const void * entity; - EventQueueType type; + ExecutorEventType type; }; typedef struct ExecutorEvent ExecutorEvent; -typedef void (*Event_callback)(const void * context, ExecutorEvent event); +typedef void (*ExecutorEventCallback)(const void * context, ExecutorEvent event); -struct EventHandle { +struct ExecutorEventHandle { // Associated context (executor) const void * context; @@ -48,10 +48,10 @@ struct EventHandle { const void * ros2_handle; // Event callback - Event_callback callback; + ExecutorEventCallback callback; }; -typedef struct EventHandle EventHandle; +typedef struct ExecutorEventHandle ExecutorEventHandle; #ifdef __cplusplus From 8b84c548a45bb5a353a61b5380e403947239c5e3 Mon Sep 17 00:00:00 2001 From: Mauro Date: Tue, 13 Oct 2020 17:03:26 +0100 Subject: [PATCH 6/9] Remove ExecutorEventHandle --- include/rcutils/executor_event_types.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/rcutils/executor_event_types.h b/include/rcutils/executor_event_types.h index add11f44..09266592 100644 --- a/include/rcutils/executor_event_types.h +++ b/include/rcutils/executor_event_types.h @@ -39,20 +39,6 @@ typedef struct ExecutorEvent ExecutorEvent; typedef void (*ExecutorEventCallback)(const void * context, ExecutorEvent event); -struct ExecutorEventHandle { - - // Associated context (executor) - const void * context; - - // Event handle; - const void * ros2_handle; - - // Event callback - ExecutorEventCallback callback; -}; - -typedef struct ExecutorEventHandle ExecutorEventHandle; - #ifdef __cplusplus } From fc9cf369981477560ea254b49f597a40b89629e4 Mon Sep 17 00:00:00 2001 From: iRobot ROS <49500531+irobot-ros@users.noreply.github.com> Date: Wed, 14 Oct 2020 16:40:28 +0100 Subject: [PATCH 7/9] Update executor_event_types.h --- include/rcutils/executor_event_types.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/rcutils/executor_event_types.h b/include/rcutils/executor_event_types.h index 09266592..bec275ed 100644 --- a/include/rcutils/executor_event_types.h +++ b/include/rcutils/executor_event_types.h @@ -25,7 +25,6 @@ enum ExecutorEventType { SERVICE_EVENT, CLIENT_EVENT, WAITABLE_EVENT, - USER_EVENT_BASE = 1000 }; typedef enum ExecutorEventType ExecutorEventType; @@ -44,4 +43,4 @@ typedef void (*ExecutorEventCallback)(const void * context, ExecutorEvent event) } #endif -#endif // RCUTILS__EVENT_TYPES_H_ \ No newline at end of file +#endif // RCUTILS__EVENT_TYPES_H_ From c1a5db274d613a499d12b9deebeaa0f9cd8a36f8 Mon Sep 17 00:00:00 2001 From: iRobot ROS <49500531+irobot-ros@users.noreply.github.com> Date: Wed, 14 Oct 2020 16:40:57 +0100 Subject: [PATCH 8/9] Update executor_event_types.h --- include/rcutils/executor_event_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rcutils/executor_event_types.h b/include/rcutils/executor_event_types.h index bec275ed..e81c7378 100644 --- a/include/rcutils/executor_event_types.h +++ b/include/rcutils/executor_event_types.h @@ -24,7 +24,7 @@ enum ExecutorEventType { SUBSCRIPTION_EVENT, SERVICE_EVENT, CLIENT_EVENT, - WAITABLE_EVENT, + WAITABLE_EVENT }; typedef enum ExecutorEventType ExecutorEventType; From f3261f555a0c276e66c6880989d1894556f6cf72 Mon Sep 17 00:00:00 2001 From: Mauro Date: Tue, 20 Oct 2020 15:44:09 +0100 Subject: [PATCH 9/9] Rename ExecutorEventCallback -> EventsExecutorCallback --- include/rcutils/executor_event_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rcutils/executor_event_types.h b/include/rcutils/executor_event_types.h index e81c7378..b68deb13 100644 --- a/include/rcutils/executor_event_types.h +++ b/include/rcutils/executor_event_types.h @@ -36,7 +36,7 @@ struct ExecutorEvent { typedef struct ExecutorEvent ExecutorEvent; -typedef void (*ExecutorEventCallback)(const void * context, ExecutorEvent event); +typedef void (*EventsExecutorCallback)(const void * context, ExecutorEvent event); #ifdef __cplusplus