nros rmw-cffi
C vtable for plugging a third-party RMW backend into nros
Loading...
Searching...
No Matches
rmw_ret.h
Go to the documentation of this file.
1
#ifndef NROS_RMW_RET_H
2
#define NROS_RMW_RET_H
3
4
#include <stdint.h>
5
46
72
typedef
int32_t
rmw_ret_t
;
73
76
#define NROS_RMW_RET_EXTENSION_BASE 1000
77
79
#define NROS_RMW_RET_OK 0
80
82
#define NROS_RMW_RET_ERROR 1
/* upstream RMW_RET_ERROR */
83
85
#define NROS_RMW_RET_TIMEOUT 2
/* upstream RMW_RET_TIMEOUT */
86
94
#define NROS_RMW_RET_BAD_ALLOC 10
/* upstream RMW_RET_BAD_ALLOC */
95
98
#define NROS_RMW_RET_INVALID_ARGUMENT 11
/* upstream RMW_RET_INVALID_ARGUMENT */
99
102
#define NROS_RMW_RET_UNSUPPORTED 3
/* upstream RMW_RET_UNSUPPORTED */
103
107
#define NROS_RMW_RET_INCOMPATIBLE_QOS (NROS_RMW_RET_EXTENSION_BASE + 0)
108
111
#define NROS_RMW_RET_TOPIC_NAME_INVALID (NROS_RMW_RET_EXTENSION_BASE + 1)
112
114
#define NROS_RMW_RET_NODE_NAME_NON_EXISTENT 203
/* upstream RMW_RET_NODE_NAME_NON_EXISTENT */
115
119
#define NROS_RMW_RET_LOAN_NOT_SUPPORTED (NROS_RMW_RET_EXTENSION_BASE + 2)
120
124
#define NROS_RMW_RET_NO_DATA (NROS_RMW_RET_EXTENSION_BASE + 3)
125
128
#define NROS_RMW_RET_WOULD_BLOCK (NROS_RMW_RET_EXTENSION_BASE + 4)
129
135
#define NROS_RMW_RET_BUFFER_TOO_SMALL (NROS_RMW_RET_EXTENSION_BASE + 5)
136
138
#define NROS_RMW_RET_MESSAGE_TOO_LARGE (NROS_RMW_RET_EXTENSION_BASE + 6)
139
144
#define NROS_RMW_RET_INCOMPATIBLE_ABI (NROS_RMW_RET_EXTENSION_BASE + 7)
145
150
#define NROS_RMW_RET_NO_BACKEND (NROS_RMW_RET_EXTENSION_BASE + 8)
151
156
#define NROS_RMW_RET_AMBIGUOUS_BACKEND (NROS_RMW_RET_EXTENSION_BASE + 9)
157
162
#define NROS_RMW_RET_UNKNOWN_BACKEND (NROS_RMW_RET_EXTENSION_BASE + 10)
163
171
#define NROS_RMW_RET_CONNECTION_FAILED (NROS_RMW_RET_EXTENSION_BASE + 11)
172
186
#define NROS_RMW_RET_INVALID_CONFIG (NROS_RMW_RET_EXTENSION_BASE + 12)
187
195
#define NROS_RMW_RET_SESSION_LOST (NROS_RMW_RET_EXTENSION_BASE + 13)
196
203
#define NROS_RMW_RET_INCORRECT_RMW_IMPLEMENTATION 12
/* upstream, unreachable here */
204
205
/* ---- Enum width pin ------------------------------------------------------
206
* Every enum in these headers crosses the C ABI by memory (struct fields,
207
* out-parameters), and its Rust mirror is bindgen output generated on the
208
* host, where an unfixed C enum is `unsigned int`. arm-none-eabi's AAPCS
209
* default is variable-size enums (the smallest integer that holds the
210
* values), so the same enum was ONE byte in C there and four in Rust. Each
211
* enum therefore carries a `*_FORCE_INT_WIDTH_ = 0x7fffffff` enumerator,
212
* which makes it `int`-sized on every ABI, and this assert beside it, so
213
* any C or C++ TU that includes the header proves the width on its own
214
* target. `-fno-short-enums` is not
215
* the fix: every consumer, in tree and out, would have to pass it.
216
* `just check abi-enum-width` fails an enum here without both. */
217
#if defined(__cplusplus) && __cplusplus >= 201103L
218
#define NROS_RMW_ASSERT_ENUM_INT_WIDTH(T) \
219
static_assert(sizeof(T) == sizeof(int), \
220
#T " must be int-sized: its Rust mirror is c_uint")
221
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
222
#define NROS_RMW_ASSERT_ENUM_INT_WIDTH(T) \
223
_Static_assert(sizeof(T) == sizeof(int), \
224
#T " must be int-sized: its Rust mirror is c_uint")
225
#else
226
#define NROS_RMW_ASSERT_ENUM_INT_WIDTH(T) \
227
typedef char nros_rmw_enum_int_width_##T[(sizeof(T) == sizeof(int)) ? 1 : -1]
228
#endif
229
230
#endif
/* NROS_RMW_RET_H */
rmw_ret_t
int32_t rmw_ret_t
Definition
rmw_ret.h:72
include
nros
rmw_ret.h
Generated by
1.15.0