nros C API
Lightweight ROS 2 client for embedded real-time systems
Loading...
Searching...
No Matches
Data Fields
nros_node_ref_t Struct Reference

#include <nros_generated.h>

Data Fields

uint32_t generation
 
uint8_t node_id
 

Detailed Description

phase-379 W4 — a checkable reference to the node an entity was created on.

Replaces the *const nros_node_t each entity used to store. That pointer was never dereferenced anywhere in the C API — it was assigned, nulled, and asserted on — so it bought provenance nobody could use while leaving a raw pointer that invites a dereference the platform cannot support:

rcl's alternative (rcl_publisher_fini(&pub, &node)) does not remove that assumption; it relocates it to a caller who cannot check it either.

So the entity stores an IDENTITY instead: the executor slot the node is bound to, plus the generation that slot carried when the entity was created. nros_node_fini bumps the generation, which makes "finalise an entity after its node" a return code rather than a silent success.

generation == 0 is reserved and never issued, so a zeroed struct — the common C mistake — can never resolve.

Field Documentation

◆ generation

uint32_t nros_node_ref_t::generation

Slot generation when the entity was created. 0 = no node bound.

◆ node_id

uint8_t nros_node_ref_t::node_id

Executor node slot (nros_node_t::node_id). 0 = the primary node.


The documentation for this struct was generated from the following file: