nros C API
Lightweight ROS 2 client for embedded real-time systems
Loading...
Searching...
No Matches
subscription.h
Go to the documentation of this file.
1
24#ifndef NROS_SUBSCRIPTION_H
25#define NROS_SUBSCRIPTION_H
26
27/* Type and function definitions live in <rclc/detail/nros_generated.h>.
28 * This per-module header is kept as a thin shim so existing code that
29 * does `#include <rclc/subscription.h>` continues to compile. */
30#include "rclc/types.h"
31/* phase-454 W10 — the DECLARED QoS depth of this component's subscriptions,
32 * and `NROS_ASSERT_DECLARED_DEPTH` over it. Included HERE, from the subscribe
33 * surface, so a C call site that spells a depth reaches the check without
34 * naming a second header — and so `<rclc/rclc.h>` carries it, which is what
35 * `just check c`'s umbrella syntax check compiles. Costs nothing when no
36 * contract declared anything: the table is then absent and every assertion is
37 * a comparison of a number with itself. */
38#include "rclc/detail/declared_qos.h"
39
40#ifndef __cplusplus
41/* issue 1256 -- `rclc/detail/declared_qos.h` is freestanding, so the policy values its
42 * table answers in are literals there. This is the first header that sees both
43 * them and the enums they stand for, so the two are held equal HERE: a drift
44 * fails every C build that includes the subscribe surface, rather than checking
45 * every call site against the wrong enumerator. */
46_Static_assert(_NROS_DQ_C_NROS_DQ_RELIABLE == RCLC_QOS_RELIABILITY_RELIABLE,
47 "declared_qos.h's reliable value drifted from RCLC_QOS_RELIABILITY_RELIABLE");
48_Static_assert(_NROS_DQ_C_NROS_DQ_BEST_EFFORT == RCLC_QOS_RELIABILITY_BEST_EFFORT,
49 "declared_qos.h's best_effort value drifted from RCLC_QOS_RELIABILITY_BEST_EFFORT");
50_Static_assert(_NROS_DQ_C_NROS_DQ_VOLATILE == RCLC_QOS_DURABILITY_VOLATILE,
51 "declared_qos.h's volatile value drifted from RCLC_QOS_DURABILITY_VOLATILE");
52_Static_assert(_NROS_DQ_C_NROS_DQ_TRANSIENT_LOCAL == RCLC_QOS_DURABILITY_TRANSIENT_LOCAL,
53 "declared_qos.h's transient_local value drifted from "
54 "RCLC_QOS_DURABILITY_TRANSIENT_LOCAL");
55#endif
56
80 struct rcl_subscription_t* subscription, const struct rcl_node_t* node,
81 const struct rclc_message_type_t* type_info, const char* topic_name) {
82 return rclc_subscription_init_with_qos(subscription, node, type_info, topic_name,
84}
85
86#endif /* NROS_SUBSCRIPTION_H */
87
88/* Every upstream-path header carries the whole C API, as `<rclc/rclc.h>` does
89 * (phase-492): a ported file that includes only `<rclc/subscription.h>` still finds
90 * `RCLC_CHECK_RET`, `RCLC_LOG_*` and the rcl spellings. Outside the guard, so
91 * this header's own declarations are complete before the umbrella reads them. */
92#include "rclc/rclc.h"
@ RCLC_QOS_DURABILITY_VOLATILE
Definition nros_generated.h:523
@ RCLC_QOS_DURABILITY_TRANSIENT_LOCAL
Definition nros_generated.h:527
rcl_ret_t rclc_subscription_init_with_qos(struct rcl_subscription_t *subscription, const struct rcl_node_t *node, const struct rclc_message_type_t *type_info, const char *topic_name, const struct rclc_qos_t *qos)
const struct rclc_qos_t RCLC_QOS_SENSOR_DATA
int rcl_ret_t
Definition nros_generated.h:903
@ RCLC_QOS_RELIABILITY_BEST_EFFORT
Definition nros_generated.h:499
@ RCLC_QOS_RELIABILITY_RELIABLE
Definition nros_generated.h:503
Umbrella header for the nano-ros C API, at upstream's path.
Definition nros_generated.h:1454
Definition nros_generated.h:1971
Definition nros_generated.h:1927
static rcl_ret_t rclc_subscription_init_best_effort(struct rcl_subscription_t *subscription, const struct rcl_node_t *node, const struct rclc_message_type_t *type_info, const char *topic_name)
rclc's best-effort preset constructor for a subscription.
Definition subscription.h:79
Shared types and constants for the nros C API.