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
38 
39  // publisher events
42 
43  // sentinel value
46 
49 {
53  void * data;
55  rmw_event_type_t event_type;
56 } rmw_event_t;
57 
63 
65 
77  rmw_event_t * rmw_event,
78  const rmw_publisher_t * publisher,
79  rmw_event_type_t event_type);
80 
82 
94  rmw_event_t * rmw_event,
95  const rmw_subscription_t * subscription,
96  rmw_event_type_t event_type);
97 
99 
109 rmw_ret_t
111  const rmw_event_t * event_handle,
112  void * event_info,
113  bool * taken);
114 
116 
121 rmw_ret_t
122 rmw_event_fini(rmw_event_t * event);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif // RMW__EVENT_H_
Definition: event.h:41
#define RMW_PUBLIC
Definition: visibility_control.h:48
Encapsulate the RMW event implementation, data, and type.
Definition: event.h:48
#define RMW_WARN_UNUSED
Definition: macros.h:22
Definition: event.h:44
rmw_ret_t rmw_event_fini(rmw_event_t *event)
Finalize an rmw_event_t.
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.
Definition: types.h:111
rmw_event_type_t
Define QoS policy events.
Definition: event.h:33
RMW_PUBLIC_TYPE
Type mapping of rcutils log severity types to rmw specific types.
Definition: types.h:353
const char * implementation_identifier
Implementation identifier, used to ensure two different implementations are not being mixed...
Definition: event.h:51
rmw_event_type_t event_type
The event type that occurred.
Definition: event.h:55
Definition: event.h:36
rmw_ret_t rmw_take_event(const rmw_event_t *event_handle, void *event_info, bool *taken)
Take an event from the event handle.
int32_t rmw_ret_t
Definition: ret_types.h:25
rmw_event_t rmw_get_zero_initialized_event(void)
Return a zero initialized event structure.
struct RMW_PUBLIC_TYPE rmw_event_t rmw_event_t
Encapsulate the RMW event implementation, data, and type.
Definition: types.h:65
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.
void * data
Data specific to this event type from either the publisher or subscriber.
Definition: event.h:53
Definition: event.h:40