rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
event.h
Go to the documentation of this file.
1 // Copyright 2019 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RMW__EVENT_H_
16 #define RMW__EVENT_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include <stdint.h>
24 
25 #include "rcutils/allocator.h"
26 
27 #include "rmw/macros.h"
28 #include "rmw/types.h"
29 #include "rmw/ret_types.h"
30 #include "rmw/visibility_control.h"
31 
33 typedef enum rmw_event_type_t
34 {
35  // subscription events
40 
41  // publisher events
45 
46  // sentinel value
49 
52 {
56  void * data;
59 } rmw_event_t;
60 
66 
68 
81  rmw_event_t * rmw_event,
82  const rmw_publisher_t * publisher,
83  rmw_event_type_t event_type);
84 
86 
99  rmw_event_t * rmw_event,
100  const rmw_subscription_t * subscription,
101  rmw_event_type_t event_type);
102 
104 
114 rmw_ret_t
116  const rmw_event_t * event_handle,
117  void * event_info,
118  bool * taken);
119 
121 
126 rmw_ret_t
127 rmw_event_fini(rmw_event_t * event);
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif // RMW__EVENT_H_
RMW_EVENT_REQUESTED_QOS_INCOMPATIBLE
@ RMW_EVENT_REQUESTED_QOS_INCOMPATIBLE
Definition: event.h:38
RMW_PUBLIC
#define RMW_PUBLIC
Definition: visibility_control.h:48
rmw_subscription_event_init
rmw_ret_t rmw_subscription_event_init(rmw_event_t *rmw_event, const rmw_subscription_t *subscription, rmw_event_type_t event_type)
Initialize a rmw subscription event.
types.h
rmw_event_type_t
rmw_event_type_t
Define publisher/subscription events.
Definition: event.h:33
RMW_PUBLIC_TYPE
RMW_PUBLIC_TYPE
Type mapping of rcutils log severity types to rmw specific types.
Definition: types.h:540
ret_types.h
macros.h
rmw_get_zero_initialized_event
rmw_event_t rmw_get_zero_initialized_event(void)
Return a zero initialized event structure.
rmw_event_fini
rmw_ret_t rmw_event_fini(rmw_event_t *event)
Finalize an rmw_event_t.
RMW_WARN_UNUSED
#define RMW_WARN_UNUSED
Indicate that a variable is not used, and prevent compiler from issuing warnings.
Definition: macros.h:24
RMW_EVENT_INVALID
@ RMW_EVENT_INVALID
Definition: event.h:47
rmw_subscription_t
Definition: types.h:182
rmw_event_t::event_type
rmw_event_type_t event_type
The event type that occurred.
Definition: event.h:58
RMW_EVENT_LIVELINESS_LOST
@ RMW_EVENT_LIVELINESS_LOST
Definition: event.h:42
rmw_event_t::implementation_identifier
const char * implementation_identifier
Implementation identifier, used to ensure two different implementations are not being mixed.
Definition: event.h:54
allocator.h
rmw_publisher_t
Structure which encapsulates an rmw publisher.
Definition: types.h:119
RMW_EVENT_LIVELINESS_CHANGED
@ RMW_EVENT_LIVELINESS_CHANGED
Definition: event.h:36
rmw_ret_t
int32_t rmw_ret_t
Return code for rmw functions.
Definition: ret_types.h:26
visibility_control.h
RMW_EVENT_MESSAGE_LOST
@ RMW_EVENT_MESSAGE_LOST
Definition: event.h:39
rmw_take_event
rmw_ret_t rmw_take_event(const rmw_event_t *event_handle, void *event_info, bool *taken)
Take an event from the event handle.
rmw_event_t
Encapsulate the RMW event implementation, data, and type.
Definition: event.h:51
RMW_EVENT_REQUESTED_DEADLINE_MISSED
@ RMW_EVENT_REQUESTED_DEADLINE_MISSED
Definition: event.h:37
rmw_event_t::data
void * data
Data specific to this event type from either the publisher or subscriber.
Definition: event.h:56
RMW_EVENT_OFFERED_QOS_INCOMPATIBLE
@ RMW_EVENT_OFFERED_QOS_INCOMPATIBLE
Definition: event.h:44
RMW_EVENT_OFFERED_DEADLINE_MISSED
@ RMW_EVENT_OFFERED_DEADLINE_MISSED
Definition: event.h:43
rmw_publisher_event_init
rmw_ret_t rmw_publisher_event_init(rmw_event_t *rmw_event, const rmw_publisher_t *publisher, rmw_event_type_t event_type)
Initialize a rmw publisher event.
rmw_event_t
struct RMW_PUBLIC_TYPE rmw_event_t rmw_event_t
Encapsulate the RMW event implementation, data, and type.