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
39 
40  // publisher events
44 
45  // sentinel value
48 
51 {
55  void * data;
58 } rmw_event_t;
59 
65 
67 
80  rmw_event_t * rmw_event,
81  const rmw_publisher_t * publisher,
82  rmw_event_type_t event_type);
83 
85 
98  rmw_event_t * rmw_event,
99  const rmw_subscription_t * subscription,
100  rmw_event_type_t event_type);
101 
103 
113 rmw_ret_t
115  const rmw_event_t * event_handle,
116  void * event_info,
117  bool * taken);
118 
120 
125 rmw_ret_t
126 rmw_event_fini(rmw_event_t * event);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #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 QoS policy 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:499
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:46
rmw_subscription_t
Definition: types.h:144
rmw_event_t::event_type
rmw_event_type_t event_type
The event type that occurred.
Definition: event.h:57
RMW_EVENT_LIVELINESS_LOST
@ RMW_EVENT_LIVELINESS_LOST
Definition: event.h:41
rmw_event_t::implementation_identifier
const char * implementation_identifier
Implementation identifier, used to ensure two different implementations are not being mixed.
Definition: event.h:53
allocator.h
rmw_publisher_t
Structure which encapsulates an rmw publisher.
Definition: types.h:90
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_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:50
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:55
RMW_EVENT_OFFERED_QOS_INCOMPATIBLE
@ RMW_EVENT_OFFERED_QOS_INCOMPATIBLE
Definition: event.h:43
RMW_EVENT_OFFERED_DEADLINE_MISSED
@ RMW_EVENT_OFFERED_DEADLINE_MISSED
Definition: event.h:42
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.